Repository navigation
refactor(cron): retain the prepared watcher handoff owner - #130373
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Exact-head landing verification: Retain the exact prepared lazy cron handoff and join its memoized drain; remove the redundant stopExitWatchers hook and duplicate hot-reload stop call. cron.stop remains the cancellation owner. Production +12/-33 (−21); tests +118/-128 (−10). 412 owner/sibling tests, final226 handler rerun after fixture cleanup, independent29 lazy/drain tests and2 actual eager/lazy supervised-child cases pass. Real process PID/spawn/marker preservation and terminal disable were observed. Full changed gate, fresh P1 and exact-head independent review pass. Hosted CI is green for c6e8981. Best-fix judgment: Keeping boolean preservation would reconstruct and discard handoff wrappers; removing the stream drain would break awaited legacy/fake drains. Retaining the exact handle removes duplication without changing cancellation timing. Limitations: Internal behavior-preserving owner consolidation, not a newly demonstrated operator bug or new retry behavior. Real process integration does not claim a fully booted Gateway. Latest available ClawSweeper comment is a review-start placeholder, without an actionable rank-up list; independent final-source review is complete. No new config, dependency, protocol or database schema is introduced. |
|
Merged via squash.
|
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 4:30 PM ET / 20:30 UTC. ClawSweeper reviewWhat this changesThe PR makes lazy Gateway cron reload shutdown retain the prepared exit-watcher handoff, removes the duplicate watcher-stop hook, and extends eager/lazy real-process reload coverage. Merge readinessKeep open. Current main still uses the boolean-preservation path that can prepare a second handoff; this PR retains the exact prepared owner and removes the redundant stop hook. No blocking correctness defect was found, but the maintainer label and pending exact-head checks require normal maintainer handling. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherGateway reload replaces the cron scheduler while watched child commands may still be running. The old scheduler hands its watchers to the replacement, then drains its own scheduling and stream resources without terminating adopted children. flowchart LR
A[Gateway configuration reload] --> B[Prepare watcher handoff]
B --> C[Replacement cron scheduler]
C --> D[Adopt active child watchers]
B --> E[Original scheduler drain]
E --> F[Stop streams and scheduling]
D --> G[Watched command continues]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -21, Tests -10. Total -31 across 8 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land a rebased version that keeps one prepared watcher-handoff owner, preserves the eager/lazy real-process regression coverage, and passes exact-head Gateway checks. Do we have a high-confidence way to reproduce the issue? Not applicable as a reported user bug: this PR tightens an internal ownership invariant, and its body plus source tests define the relevant reload scenario. Is this the best way to solve the issue? Yes. Retaining the exact handoff at the lazy proxy is narrower and more maintainable than reacquiring a wrapper during shutdown, while deletion of the duplicate stop hook follows the existing cron.stop ownership boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 94b7d0898878. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
The lazy Gateway cron proxy discarded its prepared watcher-handoff handle when stopping and prepared another wrapper through a boolean-preservation helper. An additional exposed stop hook duplicated work already owned by
cron.stop. This made reload shutdown ownership harder to follow after #115761.Why This Change Was Made
Retain the exact prepared handoff and join its memoized owner drain. Remove the redundant Gateway state hook, lazy forwarding method, and hot-reload duplicate call. Keep
cron.stopas the synchronous cancellation owner and preserve awaited stream-watcher cleanup in the legacy/fake drain path.Production LOC: +12/-33 (net -21). Tests: +118/-128 (net -10; primarily tabulating existing eager/lazy real-process coverage). No public API, config, protocol, database, dependency, watcher implementation, or process-supervisor changes. This is internal owner consolidation, not a newly claimed operator bug or changed handoff-retry guarantee.
User Impact
Watched cron commands retain their existing reload behavior: the replacement adopts watchers while the original owner drains. The same live child PID survives reload and is terminated when the final owner disables it.
Evidence
c6e89818f5135c87d345548e1989399cdbc1848c.finally, all 226 reload-handler tests passed again. The independent verifier separately passed 29 lazy/drain tests and both real-process paths.Maintainer-requested, AI-assisted. Required exact-head hosted CI and native landing checks remain mandatory.