Repository navigation
chore(gateway): guard admitted cron work during shutdown - #158080
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 10:16 AM ET / 14:16 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds a Gateway shutdown test that checks queued heartbeat settlement and keeps shared state open until an admitted cron job core finishes. Merge readiness✅ Ready for maintainer review Keep open. Main has the heartbeat-first shutdown fix, but its existing regression uses a supplied cron drain callback. This branch adds distinct coverage for the real drain, and the competing production-order change identified in the prior review is absent. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway coordinates heartbeat wakes and scheduled cron jobs during restart. Shutdown settles queued wakes, drains admitted cron work, and then retires shared state. flowchart LR
A[Restart request] --> B[Gateway shutdown]
B --> C[Heartbeat wake queue]
C --> D[Cron stop and drain]
E[Admitted job core] --> D
D --> F[Shared state retirement]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +160. Total +160 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain main's heartbeat-first shutdown order and add the focused real-cron regression at the Gateway close boundary. Do we have a high-confidence way to reproduce the issue? Yes, for the coverage gap: current source shows that main's test supplies a drain callback while production cron joins active runs. The contributor reports a distinguishing negative control; I did not independently execute it. Is this the best way to solve the issue? Yes. The test exercises the existing close and cron owners without adding a production seam or changing the landed shutdown order. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 83a1e807fa66. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review New same-head lifecycle evidence for Completed published-driver update/restartExecuted the unchanged
Source/package bindings: Safety stop and proof limits@vincentkoc — the canonical fixture mocked chat routing but left memory embeddings at a real OpenAI endpoint. Unexpected embeddings requests used an invalid synthetic fixture credential and received HTTP 401; retrospective baseline logs showed the same behavior. No production credential was available. The owned run was stopped immediately on discovery, with no retry or policy workaround. Further runtime execution is paused pending a hermetic fixture. The harness/container exited 143 during the later no-op assertion, after the first-hop updater had already succeeded. No-op completion, final Doctor checks and rollback restoration remain unproven; only backup creation was verified. Generic clean shutdown and cron ownership migration/survival are observed, not a separate queued-heartbeat or explicit cron-close runtime oracle. The exact-candidate 17 ms CI regression remains the separate proof that queued heartbeat settlement unblocks the drain while admitted sibling work stays joined. Do not count the aggregate cell as green or infer a missing oracle. Sanitized receipts, exact commands, payload inventories, custody and cleanup evidence are retained in the verification work session. This comment records the narrow passing boundary and the remaining gaps; no merge or full-main recovery is claimed. |
|
🦞👀 Re-review progress:
|
|
Current-main reconciliation: I verified that @steipete’s 24babfe94446197e4d9dd35dac8a14556943d7f5 is on main and already repairs queued heartbeat settlement with heartbeat-first shutdown. I am retaining that landed ordering, not replacing it with this branch’s alternative. The competing production hunk in this PR will not land. I am checking only whether the existing regression adds distinct coverage: real Gateway cron This PR is draft while that explicitly test-only scope is qualified. Any rewritten head will require its own normal CI/review. The earlier CI and published-updater receipt belong to the original No merge or full-main recovery is claimed. |
Retain main heartbeat-first ordering from 24babfe. Add distinct real stop-and-drain coverage proving a queued heartbeat settles while an admitted sibling remains joined before shared state retirement; assert eventual retirement and unconditional fixture cleanup. Co-authored-by: vincentkoc <[email protected]>
46d5943 to
49c998b
Compare
|
Merged via squash.
|
…8080) Keep main’s heartbeat-first shutdown unchanged and cover the real Gateway cron stop-and-drain owner with queued heartbeat work plus an admitted isolated sibling. Assert shared state remains available until the sibling actually finishes, retires exactly once afterward, and fixture cleanup restores admission even after failure. The targeted case, 152 affected sibling tests, applicable changed-file gates, independent P0–P2 review, and exact-head hosted CI passed. This is test-only coverage, not a replacement production ordering. Co-authored-by: vincentkoc <[email protected]>
What Problem This Solves
Existing shutdown coverage can miss an early return from the real cron drain while admitted work is still running.
User Impact
No user-visible or production change. This is now a test-only supplement to @steipete’s landed heartbeat-first fix, 24babfe9. Main’s shutdown ordering and all existing tests remain unchanged; the earlier competing production hunk is removed.
Why This Change Was Made
Main’s queued-heartbeat regression supplies a cron drain callback. This additional test exercises the real Gateway
cron.stopAndDrainowner with an admitted isolated sibling. It checks that queued heartbeat settlement does not allow shared state to retire before the sibling’s actual core finishes, and that shared state closes exactly once afterward.It reuses the existing close fixture, with no Gateway/server boot, new production seam, retry, sleep, worker policy or deadline. The unchanged 10-second drain budget is not claimed to provide indefinite protection.
Contributor credit: requested by and co-authored with @vincentkoc. The production ordering fix was independently landed by @steipete.
Work sessions
Evidence
Hosted qualification: ready-event CI 36145105507 passed (44 jobs: 23 successful, 21 skipped). The actual regression passed 1/1 in 35 ms; Vitest 39.76 s, test step 43 s, job 83 s, including 19.031 s worker preparation. Completed exact-head ClawSweeper review found no actionable issues or before-merge items. Required CI/dependency/sensitive-review gates passed.
Historical qualification limit: Prior checks and the partially completed updater proof belong to superseded production candidate
46d5943, not this test-only revision. Its larger updater cell was safety-stopped; it is not being relabeled green or repeated. No claim that RoboClaw’s alternative production ordering landed, or that full-main CI has recovered.View the OpenClaw team session