Repository navigation
refactor(gateway): make reload restart transactional - #114368
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:29 AM ET / 06:29 UTC. ClawSweeper reviewWhat this changesThis PR consolidates Gateway reload restart bookkeeping from parallel nullable fields into a discriminated transaction object, with shared deferred-work status formatting. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open for maintainer review. It is a broad Gateway lifecycle refactor on a protected Priority: P2 Review scores
Verification
How this fits togetherGateway reload accepts a new configuration, waits for active work when necessary, and coordinates channel and process restart behavior. This change sits in the restart coordinator between reload planning and the eventual restart/retry/defer outcomes. flowchart LR
A[Config reload request] --> B[Reload plan]
B --> C[Active work tracker]
C --> D[Restart transaction]
D --> E{Defer, retry, or restart?}
E --> F[Channel restart owner]
E --> G[Gateway restart outcome]
Decision needed
Why: The patch intentionally reorganizes state that governs retry and restart availability, so its correctness depends on behavioral equivalence rather than type and unit-test evidence alone. Before merge
Agent review detailsSecurityNone. PR surfaceSource +49. Total +49 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Validate one real Gateway reload scenario covering active-work deferral followed by a successful restart, attach a redacted terminal transcript or runtime logs, and have the Gateway owner confirm that the transaction state preserves the intended lifecycle invariants. Do we have a high-confidence way to reproduce the issue? Not applicable as a refactor PR: no current user-facing bug is claimed. The missing merge evidence is a real after-fix reload/restart trace rather than reproduction of a reported failure. Is this the best way to solve the issue? Unclear. A single transaction is a plausible way to remove invalid parallel state combinations, but it should be accepted only after a Gateway owner confirms the actual retry, deferral, and restart transitions are behaviorally equivalent. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 054495d16dd6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Live active-work reload/restart proofRan the exact reviewed head
The state labels below map the production trace to The agent call itself returned successfully: {
"runId": "b3dc163e-830b-4a14-9b75-78028c058877",
"status": "ok",
"text": "PROOF_B_TURN_COMPLETE"
}No repository artifacts were committed, and this proof did not merge the PR. |
|
Rank-up move handling before landing:
|
|
Merged via squash.
|
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Gateway reload restart state was spread across parallel nullable operation and accepted-target fields, making lifecycle, retry, deferral, and restart debt harder to reason about as one transaction. The split reload layout already had the right module owners but lacked a single discriminated transaction state.
Why This Change Was Made
GatewayRestartTransactionnow owns restart lifecycle, retry, deferral, and debt. Discriminated unions replace the parallel nullable state, while deferred-work detail formatting is shared without changing log output. The change stays within the existing reload facade, hot/managed modules, active-work tracker, channel restart owner, and restart coordinator.User Impact
No intended user-visible behavior change. Gateway reload restart bookkeeping is now represented as one explicit transaction, reducing invalid intermediate states and making deferred/retry behavior easier to maintain.
Evidence
node scripts/check-changed.mjspassed on Blacksmith Testboxtbx_01kygwv5xwmrse1sxwrgj5jaav.src/gatewaysweep hit timing/E2E failures and leaked handles. The MCP close/drain failure and reload E2E revision failure reproduced identically on a cleanorigin/mainarchive, so they were classified as pre-existing rather than branch regressions.