Repository navigation
fix(tasks): finish maintenance before Gateway shutdown - #154308
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 21, 2026, 1:52 AM ET / 05:52 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR makes Gateway shutdown cancel queued maintenance, await active task and flow cleanup, and prevent repeated starts from leaving untracked timers. Merge readiness✅ Ready for maintainer review The repair remains necessary: current main still stops timers without joining active maintenance. No actionable introduced defect was found. Likely related people: Peter Steinberger (unverified routing candidate, low confidence). Priority: P2 Review scores
Verification
How this fits togetherTask maintenance periodically reconciles task records and cleans up completed flows. Gateway shutdown must settle that work before retiring the shared runtime and databases. flowchart TD
A[Gateway startup] --> B[Maintenance scheduler]
B --> C[Work admission]
C --> D[Task cleanup]
D --> E[Flow cleanup]
F[Gateway shutdown] --> B
F --> G[Cancel queued work and await completion]
E --> G
G --> H[Retire runtime]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +34, Tests +167. Total +201 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep timer ownership and operation completion together, with shutdown joining admitted cleanup before runtime retirement. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the failure path: hold scheduled cleanup across shutdown and current main returns without settling it. The body reports a controlled failing lifecycle, but this read-only review did not execute it. Is this the best way to solve the issue? Yes. The patch uses the existing admission cancellation contract and awaited shutdown hook while preserving cleanup order, retention rules, configuration, and update-canary behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 784a74bed115. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Merged via squash.
|
What Problem This Solves
Scheduled task maintenance could continue after its Gateway shut down and affect a later runtime in the same process. Repeated startup could also leave a delayed sweep untracked.
User Impact
Shutdown cancels maintenance still waiting for admission and waits for admitted task and flow maintenance before retiring their runtime. The scheduler owns both timers and the complete operation. Existing schemas, retention, configuration, and update behavior are unchanged.
Why This Change Was Made
Clearing timers did not settle an already-started sweep. The existing Gateway shutdown step now awaits its complete task-then-flow operation, and test cleanup callers await the same boundary. An admission-only cancellation signal lets shutdown finish while the Gateway remains suspended; it does not cancel work that already started. Timer and completion ownership live together in a small scheduler module.
Evidence
866f2437, including production and test typechecks, typed lint, all three dead-export scans, formatting, line budgets, schema and import-cycle guards. The fixed-main integration preserves every authored added/removed line; its two overlapping test files retain main’s changes. All 100 current Gateway close/startup and maintenance scheduling cases passed in 153.73 seconds. Formatting and whitespace checks passed. Hosted CI must qualify this successor before landing.The controlled lifecycle establishes the defect and repair; it does not identify which callback caused earlier hosted CI task-list failures.
The earlier CI preflight failure came from a duplicate test inventory entry introduced on main. This successor includes the canonical main repair
f76d38a4; it does not replay the old failed merge checkout.