Repository navigation
fix: channel messages fail after manual restart - #123885
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 7:31 PM ET / 23:31 UTC. ClawSweeper reviewWhat this changesDetaches channel startup from the short-lived Gateway request or timer admission so manually restarted channels can keep processing messages. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer landing: the focused owner-boundary repair appears correct, but this protected maintainer PR still needs its exact-head checks to finish. Priority: P1 Review scores
Verification
How this fits togetherGateway RPC and timers ask the channel manager to start transport accounts. Those accounts spawn provider, approval, cleanup, and restart work that must outlive the initiating request. flowchart LR
A[Gateway RPC or timer] --> B[Channel manager]
B --> C[Process-owned startup]
C --> D[Channel account task]
D --> E[Inbound execution]
E --> F[Channel delivery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +132. Total +138 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one process-owned wrapper at the channel manager’s canonical startup boundary, with the three lifecycle regressions retained as coverage. Do we have a high-confidence way to reproduce the issue? Yes—current main starts the account task inside the RPC-owned async context, and the added released-root tests directly exercise the resulting admission failure. Is this the best way to solve the issue? Yes—the manager is the single owner of all channel-start callers, while a provider-only or RPC-only fix would miss approval bootstrap or automatic restart descendants. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ce443d9a46b. 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
Fixes an issue where messages could fail with
GatewayDrainingErrorafter an operator stopped and restarted a channel through Gateway RPC, even though the Gateway and channel both reported ready.Why This Change Was Made
Channel account lifetimes are now detached once at the channel manager's canonical startup boundary. Provider work, approval handlers, cleanup, and automatic replacements therefore remain process-owned instead of inheriting the short-lived RPC or timer admission context that requested startup.
The existing lifecycle implementation remains unchanged behind that owner boundary. Production LOC: +7/-1 (net +6); tests: +132/-0.
User Impact
Operators can manually restart a channel and continue receiving messages immediately, without requiring a full Gateway restart to recover the channel.
Evidence
main: after successfulchannels.stopandchannels.start, the first ordinary message failed withGatewayDrainingErrorand retried six times while/readyzandchannels.statusremained healthy.true,true,[false, true]) and pass after the repair.node scripts/run-vitest.mjs src/gateway/server-channels.test.ts— 99 passed.node scripts/run-vitest.mjs src/process/gateway-work-admission.test.ts— 18 passed.pnpm check:changedon Blacksmith Testbox — passed.