Skip to content

feat(dashboard): auto-refresh CronPage every 30s - #57307

Open
ayounce80 wants to merge 1 commit into
NousResearch:mainfrom
ayounce80:feat/cronpage-auto-refresh
Open

feat(dashboard): auto-refresh CronPage every 30s#57307
ayounce80 wants to merge 1 commit into
NousResearch:mainfrom
ayounce80:feat/cronpage-auto-refresh

Conversation

@ayounce80

Copy link
Copy Markdown

Split out of #57265 (closed as duplicate of #54887 on the auth side) per triage.

CronPage renders once and never refreshes — job state (last run, next run, enabled, last_status) goes stale until a manual reload, unlike SessionsPage which already background-refreshes. This applies the same silent 30s background-refresh pattern SessionsPage uses (~15 lines, no visual flicker: refresh skips the loading state when data is already present).

Verified with npx tsc --noEmit and live on a private deployment (job state updates land within 30s of a cron fire, no observed re-render flicker).

Related: #55130 discusses the underlying polling-vs-push question for the dashboard broadly; this is the minimal parity fix for CronPage in the meantime.

CronPage loaded its job list on mount and after the user's own mutations
only — a cron job firing, failing, or being edited by the CLI/another
process stayed invisible until a manual page reload. SessionsPage already
polls for exactly this reason (separate processes share one session DB;
no push channel yet).

Add a silent 30s background refresh alongside the existing mount load,
mirroring the SessionsPage pattern: errors in a background tick are
swallowed rather than toasted, and the interval re-arms when the selected
profile changes. Stopgap until a server-push state channel exists.
@alt-glitch alt-glitch added type/feature New feature or request comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have labels Jul 2, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the stale cron-state gap. The premise holds on current main: CronPage loads jobs on mount at web/src/pages/CronPage.tsx:606-608, while SessionsPage already uses an interval at web/src/pages/SessionsPage.tsx:904-931 for cross-process state.

Problems

  • The added .then(setJobs) at web/src/pages/CronPage.tsx:619 accepts an in-flight response after its interval has been cleaned up. If the selected profile changes, an older request can overwrite the new profile's list; overlapping interval requests can also resolve out of order. The existing cancellation pattern at web/src/pages/CronPage.tsx:613-627 shows the needed guard shape.

Suggested changes

  • Gate polling results with a cancellation flag or request generation so only the current profile/latest request may call setJobs; consider applying that ordering protection to loadJobs as well.
  • Add a deferred-promise/fake-timer regression test for profile switching or out-of-order responses.

Automated hermes-sweeper review.

const id = setInterval(() => {
api
.getCronJobs(selectedProfile)
.then(setJobs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing this effect's interval does not cancel a request that has already reached getCronJobs. If the user switches profiles, or a later tick finishes first, this response can overwrite the current list. Gate the result with a cleanup flag or request generation before calling setJobs.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants