Skip to content

fix(cron): preserve canceled run status through cleanup - #167524

Merged
steipete merged 1 commit into
mainfrom
ci-speed-spd7-latent-e2e
Oct 9, 2026
Merged

steipete merged 1 commit into
mainfrom
ci-speed-spd7-latent-e2e

Conversation

@steipete

@steipete steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes saved cron continuations that lose their killed status when an active scheduled job is removed.

User Impact

Subsequent session reads retain the cancellation outcome after the temporary base session and placement have been cleaned up.

Why This Change Was Made

The asynchronous lifecycle lookup introduced in #165028 lets continuation sealing overtake terminal persistence. Cron now retains the prompt admission until that exact run's accepted terminal writes settle, then closes admission and seals the continuation. Explicit close and replacement remain immediate; the existing ready-row fence stays in force.

Evidence

  • The unchanged real-Gateway e2e passes on d511ab92b63a, fails on 4bd8ee5fedcb with the missing status, and passes with this fix. Both removal and one-shot cleanup remain covered; the repaired case takes 21.990 seconds.
  • The whole cron config passes: 241 files, 2,345 tests. The terminal-write and admission siblings pass another 51 tests.
  • Whole architecture checks pass with zero Madge cycles, as do source-contract checks, boundary lint, and P2 review.
  • Production types, all 27 core test-type graphs, formatting, changed-file lint, and the changed gate’s remaining static checks pass. check-changed stops only at the inherited dead export below; all nine checks after it passed in a separate Linux run.
  • Deadcode reports the unchanged base revision's unused Talk export, ClientVoiceToolEffect, already removed on main by d76f6ec74ec6.

Retain the prompt admission through terminal emission and join its accepted
terminal writes before finalization seals the saved continuation. Explicit
close and replacement still revoke immediately.

The asynchronous lookup introduced by #165028 let sealing overtake the
cancellation write. The unchanged Gateway regression passes on the parent,
fails on that commit, and passes with this fix.
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
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 backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The branch waits for accepted terminal writes before closing a scheduled run’s admission and sealing its saved session.

Example: The operator removes an active scheduled job.

  • Before: The saved run can lose its killed status after temporary session cleanup.
  • After: The saved run retains status: "killed" after the base session and worker placement are removed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable repair with reported real-Gateway regression proof and no identified correctness or security blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR reports a real Gateway removal flow failing before the repair and passing afterward; the inspected scenario uses actual RPC, a CLI child, and persisted readback showing killed after cleanup, alongside successful one-shot retirement. Existing storage formats and schemas are unchanged, so no migration is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A removed scheduled job’s saved session loses the cancellation outcome after cleanup.
Reason: Existing Gateway regression coverage defines the expected retained cancellation status. The focused ordering repair restores that behavior without expanding product surface.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main retains the cleanup race, and the focused repair preserves existing cancellation and revocation contracts. No actionable patch defect was found.

Priority: P2
Reviewed head: 5b14a090e5d5b47476eb6d89a18497fb8385ed54

Before merge

None.

Findings

None.

Agent review details

How this fits together

OpenClaw runs scheduled agent jobs through the Gateway and retains session records for later inspection. Terminal events update those records before the scheduled run releases its temporary resources.

flowchart TD
  A[Scheduled agent job] --> B[Prompt admission]
  B --> C[Agent execution]
  C --> D[Terminal event]
  D --> E[Accepted session writes]
  E --> F[Wait for settlement]
  F --> G[Close admission]
  G --> H[Seal saved session and clean up]
Loading

Technical review

Best possible solution:

Keep terminal persistence in the existing run owner and settle it before continuation sealing, preserving immediate explicit revocation.

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

Yes: source establishes the early-close and asynchronous-persistence race, and the existing real-Gateway removal test asserts the missing killed status. The PR reports failing-before and passing-after runs; this review did not execute them.

Is this the best way to solve the issue?

Yes: joining the existing terminal-write owner repairs the ordering invariant without weakening the ready-row fence or introducing another persistence path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 17cc94a953e7.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +18. Total +18 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 22 4 +18
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 22 4 +18

Labels

Label changes:

  • add P2: The repair restores cancellation status in saved scheduled-run sessions with a limited affected workflow.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The repair restores cancellation status in saved scheduled-run sessions with a limited affected workflow.
  • 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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 8, 2026, 7:43 PM ET / 23:43 UTC.

@steipete
steipete enabled auto-merge (squash) October 9, 2026 08:08
@steipete
steipete merged commit e04a6e1 into main Oct 9, 2026
123 checks passed
@steipete
steipete deleted the ci-speed-spd7-latent-e2e branch October 9, 2026 08:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
)

Retain the prompt admission through terminal emission and join its accepted
terminal writes before finalization seals the saved continuation. Explicit
close and replacement still revoke immediately.

The asynchronous lookup introduced by openclaw#165028 let sealing overtake the
cancellation write. The unchanged Gateway regression passes on the parent,
fails on that commit, and passes with this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant