Skip to content

fix(tray): a cron job stays marked running after the gateway says it is not - #1666

Merged
shanselman merged 5 commits into
openclaw:mainfrom
SebTardif:fix/f057-cron-running-latch
Oct 15, 2026
Merged

shanselman merged 5 commits into
openclaw:mainfrom
SebTardif:fix/f057-cron-running-latch

Conversation

@SebTardif

@SebTardif SebTardif commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a cron job stays marked running after the gateway says it is not, so Remove, Edit, Run Now, and the enable toggle stay disabled.

User Impact

User impact: when the gateway reports no running time and genuinely advances the next run, the job's actions become available again. Active jobs and jobs with unchanged, missing, or regressed schedules stay latched.

Why This Change Was Made

The page latches a job as running when its scheduled time passes before lastRunAtMs changes. That latch previously cleared only when lastRunAtMs changed or the job disappeared. The gateway can instead report runningAtMs as zero and move nextRunAtMs forward while leaving the same last-run value. This change clears only that completed idle transition.

Evidence

Current head: b852d38f407c701334262f08832fc73f706cec77.

Focused predicate coverage passed for all required boundaries:

runningAtMs=0, next=2000, previous=1000: clear
runningAtMs=1500, next=2000, previous=1000: keep
runningAtMs=0, next=1000, previous=1000: keep
runningAtMs=0, next=500, previous=1000: keep
runningAtMs=0, next=0, previous=1000: keep
runningAtMs=0, next=1000, previous=0: keep

An isolated ARM64 WinUI run connected to the repository fixture Gateway and received three cron.list snapshots for the same row. The first established the expired next-run value, the second kept that value and visibly latched the row as Running with its toggle disabled, and the third kept runningAtMs=0 while advancing nextRunAtMs by one hour. The Running badge disappeared and the row toggle became enabled. The fixture report recorded outcome: passed, appResponding: true, and app version stamped with exact head b852d38f.

Cron row actionable after idle next-run advancement

Rubber-duck review found no blocking issue. Its suggested missing and regressed next-run guard cases were added. The low-value source-string assertion identified during maintainer review was removed, leaving only behavioral predicate tests and live UI proof.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: isolated current-head WinUI proof shows the latched row becoming actionable after the fixture Gateway advances the next run while reporting no running time.

Validation

  • .\build.ps1: passed. Shared, CLI, WinNodeCli, SetupEngine, and WinUI built successfully for ARM64.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: passed, 4311 passed, 36 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: passed, 4014 passed, 0 skipped, 0 failed.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --filter FullyQualifiedName~CronRunningLatchTests: passed, 3 passed, 0 failed.
  • Isolated fixture-Gateway WinUI proof: passed, 1 passed, 0 failed. The one-shot proof harness exercised three controlled cron.list snapshots against the exact-head app without modifying the shipped app code.

Real Behavior Proof

  • Environment tested: Windows ARM64, disposable isolated tray profile, loopback repository fixture Gateway, Debug WinUI build.
  • PR head or commit tested: b852d38f407c701334262f08832fc73f706cec77.
  • Exact steps or command run: launched the isolated app through GatewayFixtureRun, navigated to Cron, supplied an expired unchanged idle schedule to latch the row, then supplied runningAtMs=0 with nextRunAtMs advanced by one hour.
  • Evidence after fix: the intermediate snapshot showed Running and disabled the row toggle. The advanced idle snapshot removed Running and enabled the toggle. The fixture recorded three successful cron.list requests and no unexpected requests.
  • Observed result: the row becomes usable only after the gateway reports no running time and the next run genuinely advances.
  • Screenshot or artifact links verified? Yes.
  • Not verified or blocked: none for the changed latch behavior.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: N/A

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No
  • If yes, list the exact upgrade steps: N/A

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

The page latches a job as running when its scheduled time passes
before lastRunAtMs changes. That latch cleared only when lastRunAtMs
changed or the job disappeared. A later list can leave runningAtMs
at zero, move nextRunAtMs forward, and keep the same last run. The
row stayed disabled.

Clear the latch when the gateway reports no running time and the
next run has moved forward.

CronRunningLatchTests passed 4. ./build.ps1 exit 0. Shared 4262
passed, 33 skipped. Tray 3994 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Clear a Cron job’s running indicator when the gateway reports it idle and advances its next scheduled run.

Example: Job idle1666stub reports runningAtMs=0, unchanged lastRunAtMs, and nextRunAtMs advancing from 1700000000000 to 1700003600000.

  • Before: The running indicator persists and job actions remain disabled.
  • After: The running latch clears and the existing action-refresh path restores the controls.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused, and supported by current-head application diagnostics; the source-string test contributes little behavioral confidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): At the reviewed head, the isolated Windows Cron page consumed gateway-stub list updates with runningAtMs=0 and unchanged lastRunAtMs, showed Running for the overdue schedule, and removed it when nextRunAtMs advanced. Copied UI diagnostics prove the changed latch path; separate real-gateway output confirms active-run controls remain disabled and recover after completion.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An idle Cron job remains marked running, leaving its management controls disabled.
Reason: Restoring controls when the gateway reports an idle rescheduled job preserves the existing active-run contract.

Merge readiness

✅ Ready for maintainer review

This PR fixes a stale running state that remains on current main, with no introduced correctness or security defect found; maintainer-engaged landing work should continue.

Priority: P2
Reviewed head: 7bea96c1694e255a6637575f3e97ff3176727c0f

Before merge

None.

Findings

None.

Tests

  • Low-value test tests/OpenClaw.Tray.Tests/CronRunningLatchTests.cs: Remove CronPage_ClearsTheLatchWhenTheNextRunMoves: checking that a symbol appears in source cannot establish that the page clears the latch or restores controls.
  • Missing end-to-end proof: No automated page-level regression is shown failing on the base and passing on the head; the focused tests exercise the predicate and a source-string check.
Agent review details

How this fits together

The Windows Cron page consumes gateway cron.list state, reconciles its local running-job set, and projects that state into badges and job controls.

flowchart LR
  A[Gateway cron list] --> B[Cron page parser]
  B --> C[Running latch reconciliation]
  C --> D[Running job set]
  D --> E[Action buttons and badge]
Loading

Technical review

Best possible solution:

Land the focused idle-state reconciliation through the existing running-state owner.

Do we have a high-confidence way to reproduce the issue?

Current-main source retains an inferred running latch when runningAtMs is zero, lastRunAtMs is unchanged, and nextRunAtMs advances; supplied current-head UI diagnostics exercise that transition.

Is this the best way to solve the issue?

The narrow condition corrects local reconciliation without weakening protection for a positive running timestamp or introducing a competing state owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8e8888fed47a.

Provenance checked

  • Cron optimistic running-state reconciliation keeps the original intent (638386e: The earlier Cron history improvement deliberately avoided clearing optimistic running state before completion, keeping active-run controls disabled and history stable.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Régis Brid: Raw commit 638386e adds src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs:908 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 638386ed73ae; files: src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs)
  • Christine Yan: Raw commit 61fcd39 adds src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs:686 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 61fcd3902764; files: src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs)

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A stale Cron running indicator disables job management controls, with impact limited to the affected page and job.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-07T02:32:43.727Z sha b1c55f3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-07T03:02:05.742Z sha 7bea96c :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-07T04:44:23.640Z sha 7bea96c :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-07T09:24:19.409Z sha 7bea96c :: needs maintainer review before merge. :: none

Reviewed October 14, 2026, 10:41 PM ET / October 15, 2026, 02:41 UTC (Revision 5).

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 7, 2026
@karkarl

karkarl commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Global triage: NEEDS_HUMAN_TEST. Take confidence 55%; recommendation confidence 97%; effort small; risk medium.

Reviewed exact head 7bea96c1694e. GitHub currently reports CLEAN with 29 passing, 0 failing, and 0 pending checks. proof label is sufficient. Durable automated signal: Codex review: needs maintainer review before merge..

Maintainer or proof-pool owner: run every declared Windows proof pool at this exact head and replace blocked or historical evidence with current-head results.

This is a triage classification, not a merge action. No branch changes were made.

@shanselman

Copy link
Copy Markdown
Collaborator

Thanks for the volume of careful bug-finding and proof here. We are actively processing this queue and have landed several of your focused fixes, but 40 concurrent open PRs is beyond the maintainer review capacity even when individual patches are good.

Please pause opening new PRs for now and identify the three existing branches you consider highest priority. We will keep working through small, independent, high-confidence fixes first. Additional discoveries should be filed as issues until the active queue is below roughly five PRs. Please also keep each branch to one behavior and squash CI-only retrigger commits when updating a branch.

This is queue management, not a request to stop contributing. The focused fixes and concrete validation are valuable; limiting work in flight will help us review and land them faster.

@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 15, 2026
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4d3c001c-1771-40bf-8817-777a4e08e9c0
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4d3c001c-1771-40bf-8817-777a4e08e9c0
@shanselman
shanselman merged commit e01db9f into openclaw:main Oct 15, 2026
25 checks passed
@shanselman shanselman removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. labels Oct 15, 2026
shanselman added a commit to SebTardif/openclaw-windows-node that referenced this pull request Oct 15, 2026
Preserve both cron timezone editing and the running-state latch behavior added by openclaw#1666.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: f66f0e00-0c9b-4632-8bc4-9dae1cd81754
@SebTardif
SebTardif deleted the fix/f057-cron-running-latch branch October 16, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants