Repository navigation
fix(gateway): cancel dashboard preparation during shutdown - #145118
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 11, 2026, 2:05 PM ET / 18:05 UTC (Revision 2). ClawSweeper reviewWhat this changesCancels background dashboard asset builds and retention when Gateway shutdown begins, with regression coverage for cleanup and subsequent preparation generations. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v2026.9.4 still lack drain-triggered dashboard preparation cancellation. The reviewed patch preserves cleanup ownership, and no actionable correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares dashboard assets in background work after startup. Shutdown must cancel unfinished preparation while continuing to count and await its cleanup before closing the server. flowchart TD
A[Gateway startup] --> B[Dashboard preparation]
C[Shutdown drain] --> D[Combined cancellation signal]
E[Dashboard disable or stop] --> D
D --> B
B --> F[Build or retain assets]
F --> G[Await cleanup and release admitted work]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +6, Tests +66. Total +72 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cancellation in the existing dashboard lifecycle, observe each current drain generation, and await cleanup before releasing admitted work. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the trigger: stop the Gateway while admitted dashboard preparation is unfinished, and drain waits before the stop hook can cancel it. This read-only review did not execute tests or reproduce the runtime failure. Is this the best way to solve the issue? Yes. Composing the existing cancellation signals repairs the ordering gap without bypassing cleanup, adding a competing owner, or changing shutdown timeouts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 58a6953549d0. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Related: #144252
What Problem This Solves
Fixes an issue where stopping a Gateway soon after startup could wait for background dashboard asset preparation before reaching the cleanup that cancels it. On a busy host this could exceed the process supervisor’s shutdown grace period.
Why This Change Was Made
Each Control UI preparation now observes the current Gateway drain signal alongside its existing stop/disable signal. The Gateway still counts and awaits cleanup; a later preparation captures its own drain generation.
User Impact
Shutdown cancels unfinished dashboard builds and asset retention instead of waiting for that background work to finish normally. Existing cancellation, publication fencing, and dashboard re-enablement remain intact.
Evidence
Both build and retention regressions fail on the original owner. The candidate passes 35 lifecycle, serving-identity, and real-retention tests, plus the selected type, lint, and repository checks. Independent Codex review completed scoped-clean through P2.
Real filesystem integration on this main-based candidate interrupted a copy after 6.1 MiB: cleanup left zero admitted roots, no staging directory or late publication, and no warnings. A fresh generation then retained and hash-verified two assets totaling 80 MiB. The process exited naturally and all synthetic fixtures were removed. This exercises the actual source owner and filesystem, not a compiled full-Gateway run.
The original investigation’s three native scenarios served plugin RPCs and health successfully but exceeded their unchanged ten-second shutdown grace. An observation-only replay identified this asset-preparation root and later exited naturally; those earlier failures remain qualified evidence rather than passing candidate runs.
Production grows by six lines to compose the existing cancellation signals; tests grow by 66. No configuration, schema, or timeout changes.
Exact-head required CI passed on
ac36b193in run 34630743135, attempt 2. Attempt 1 timed out in the unchanged profiler CLI help test; its single retry passed without changing the test or timeout. Follow-up: investigate the profiler-help startup hang if it recurs; its cause remains unattributed.