Skip to content

fix(desktop): restore stable cron jobs position, compact strip, and balanced sidebar spacing - #43310

Open
ValentinSergief wants to merge 1 commit into
NousResearch:mainfrom
ValentinSergief:fix/sidebar-cron-container-jump
Open

fix(desktop): restore stable cron jobs position, compact strip, and balanced sidebar spacing#43310
ValentinSergief wants to merge 1 commit into
NousResearch:mainfrom
ValentinSergief:fix/sidebar-cron-container-jump

Conversation

@ValentinSergief

@ValentinSergief ValentinSergief commented Jun 10, 2026

Copy link
Copy Markdown

Problem

Two regressions in the Desktop sidebar after the sidebar rework (#42537 / #43147):

  1. The running dot never pulses – the original heuristic keyed off next_run_at being within ~10s of now (nowMs - next < 300_000 && nowMs - next > 0). Origin's PR fix(cron): prevent recurring job re-fire on gateway crash/restart loop #3396 (at-most-once crash-safety) moved advance_next_run() to before run_job(), so next_run_at is always pre-advanced to the next future slot while a job runs. The heuristic never fires.

  2. Triggered jobs jump to the top of the list, then drop backtrigger_job() persists next_run_at = now as the scheduler's "fire now" contract. During the seconds before the scheduler claims the job, the sidebar sorts it to the top, then drops it back to its real slot. Normally (scheduled runs) this never happens because the scheduler pre-advances before the frontend polls – the jump is unique to manual triggers.

Fix

Replace the client-side timing heuristic with an authoritative execution ledger, and stop serving the transient next_run_at = now to the UI.

  • cron/executions.pyactive_execution_start_times(): cross-process durable ledger of in-flight job starts, with a 30-min claim TTL staleness bound (health-check wedge: a wedged claim can't pin the dot forever).
  • cron/jobs.pylist_jobs() / get_job() stamp authoritative is_running + active_run_started_at from the ledger. A display guard never serves a past next_run_at for a scheduled-but-idle job – the computed next slot is shown instead, so the sort key stays stable through a manual trigger.
  • tui_gateway/server.py_cron_sig folds the running set into the change signature, so the desktop learns a job went live immediately instead of waiting on jobs.json mtime.
  • apps/desktop – the dot and "X ago" counter are driven by active_run_started_at (jobStartRef grace counter removed). Balanced search-bar spacing retained.

7 files, +287/-27. No new dependencies, no scheduler-contract changes – the scheduler still reads the persisted next_run_at = now and fires on the next tick.

Testing

  1. Trigger a cron job from the sidebar – dot pulses immediately, "X ago" counts, and the job stays in its sorted position (no jump to top / drop back).
  2. Let the run finish – dot stops, counter flips to "in X min" at the real next slot.
  3. Health-check wedge: a claimed-but-wedged execution expires after 30 min instead of pinning the dot.
  4. Idle state – no dot, stable position.
  5. tests/cron/test_jobs.py + tests/cron/test_execution_ledger.py: 154 tests pass (4 new contract tests for the stamping display guard). ruff clean, tsc clean on both desktop configs.
  6. Verified locally in the running app (rebuild + swap): dot pulses and clears, no position jump.

Fixes #43309

@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch from 967a8a0 to d505d9f Compare June 10, 2026 04:40
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Jun 10, 2026
@ValentinSergief ValentinSergief changed the title fix(desktop): restore fixed cron jobs position and balanced sidebar spacing fix(desktop): restore stable cron jobs position, compact strip, and balanced sidebar spacing Jun 10, 2026
@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch 3 times, most recently from a06d81c to 3a75f73 Compare June 10, 2026 05:11

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Approved

UI polish fix for the desktop cron jobs sidebar section. Tightens the max-height of the cron jobs list and repositions it below the sessions section with better visual separation.

Looks Good

  • max-h-72 reduced to max-h-28 prevents the cron strip from consuming excessive vertical space
  • Cron jobs section now lives below sessions with its own shrink-0 container — more stable layout
  • Running-state pulse animation improved with a proper ping effect
  • pb-1 instead of pb-2 for better spacing balance
  • No security concerns

Reviewed by Hermes Agent

@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch from 3a75f73 to 6761712 Compare June 10, 2026 19:27
@ValentinSergief

ValentinSergief commented Jun 10, 2026

Copy link
Copy Markdown
Author

Thanks for the review, @tonydwb. Pushed a spacing correction on top of this — nav pb-1pb-0, search pb-1pb-1.5 (the p-2 padding inside SidebarMenuButton was invisibly stacking). Both gaps now equal at 12px for visual spacing balance.

Otherwise unchanged. Ready for CI and maintainer review.

@ValentinSergief

ValentinSergief commented Jun 12, 2026

Copy link
Copy Markdown
Author

Verified compatible with #44630 (composer status stack). Sidebar spacing + cron dot work correctly alongside the new composer UI.

@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch from 6761712 to ebe864c Compare June 12, 2026 14:21
@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch 6 times, most recently from 27c2b0f to b4922a7 Compare June 24, 2026 00:26
@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch 7 times, most recently from 0f0f595 to 14a678d Compare July 1, 2026 15:28
@ValentinSergief

Copy link
Copy Markdown
Author

The running indicator is now driven by the execution ledger's active_run_started_at (stamped at dispatch in cron/executions.py, served through list_jobs()/get_job() in cron/jobs.py, folded into the _cron_sig change signature) rather than the transient next_run_at observation — a job that starts while the section is collapsed still shows its run when the section reopens, and the 30-min claim TTL bounds staleness. Contract tests in tests/cron/test_jobs.py cover the stamping.

@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch from 07423e9 to b10f6a5 Compare August 5, 2026 18:25
…a execution ledger

The sidebar's running dot and job-position stability were broken by origin's
PR NousResearch#3396: advance_next_run() moved before run_job(), so next_run_at is
pre-advanced to the next future slot before the run. The old client-side
heuristic (next_run_at within 10s of now = running) never fires, and
trigger_job's transient next_run_at=now write bounces the job to the top
of the sorted list for a few seconds on every manual trigger.

- cron/executions.py: active_execution_start_times() — cross-process durable
  ledger of in-flight job starts, with a 30-min claim TTL staleness bound
- cron/jobs.py: list_jobs()/get_job() stamp authoritative is_running +
  active_run_started_at from the ledger; display guard never serves a past
  next_run_at for a scheduled-but-idle job, so the sort key stays stable
- tui_gateway/server.py: _cron_sig folds the running set into the change
  signature so the desktop learns a job went live without waiting on
  jobs.json mtime
- apps/desktop: dot + "X ago" driven by active_run_started_at (jobStartRef
  grace counter removed); balanced search-bar spacing retained
- tests: contract tests for the stamping display guard
@ValentinSergief
ValentinSergief force-pushed the fix/sidebar-cron-container-jump branch from b10f6a5 to 8445160 Compare August 19, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery 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/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Desktop] Cron jobs section jumps position on zoom — visual regression from sidebar rework #42537

4 participants