Repository navigation
fix(gateway): isolate startup sidecars between test cases - #120503
Conversation
Punchcard-Session: amber-workshop-workshop-36
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 9:43 AM ET / 13:43 UTC. ClawSweeper reviewWhat this changesThe PR updates the Gateway startup test fixture to track, transfer, tombstone, and drain sidecar stop handles between test cases. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessThis maintainer-authored, protected PR remains necessary: current main retains the untracked sidecar-handle fixture paths, while the branch repairs them without changing production behavior. No blocking findings were identified; it needs ordinary human landing judgment. Priority: P3 Review scores
Verification
How this fits togetherGateway startup creates background sidecars and publishes stop handles to its lifecycle owner. This test fixture intercepts those handles so test-case cleanup cannot leak a sidecar into later fake-timer or mock state. flowchart LR
A[Gateway startup] --> B[Sidecar stop handles]
B --> C[Test fixture tracking]
C --> D[Ownership transfer]
D --> E[Case teardown]
E --> F[Isolated next case]
Decision needed
Why: The PR is authored by a repository member and carries the protected maintainer label, so ordinary human landing authority is required even though the patch is correct. Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +167. Total +167 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep production sidecar ownership unchanged and land the fixture-only cleanup after the designated maintainer confirms the current exact head. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main's fixture directly starts and manually stops sidecars but teardown tracks no such handles, making the order-dependent leak path clear; this read-only review did not execute the suite. Is this the best way to solve the issue? Yes. Tracking ownership in the test fixture is the narrowest maintainable fix because production already owns and drains the same two sidecar classes correctly. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 295c8dfe6eb7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Punchcard-Session: amber-workshop-workshop-36
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Punchcard-Session: amber-workshop-workshop-36
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…20503) * test(gateway): stop startup sidecars between cases Punchcard-Session: amber-workshop-workshop-36 * test(gateway): make sidecar cleanup one-shot Punchcard-Session: amber-workshop-workshop-36 * test(gateway): satisfy cleanup type contracts Punchcard-Session: amber-workshop-workshop-36
Related history:
What Problem This Solves
Fixes an order-dependent failure in
src/gateway/server-startup-post-attach.test.tswhere startup sidecars could outlive their test case and fire after a later case had installed fake timers or reset shared mocks.Why This Change Was Made
The fixture tracked published sidecars but did not model ownership transfer. Tests that manually stopped a handle left it registered for teardown, and a transferred handle could be reacquired when the production publisher emitted it again. Direct
startGatewaySidecars()results also bypassed fixture tracking.This test-only repair:
startGatewaySidecars()results;Owner boundary: the repair is entirely in the startup test fixture. Production startup and shutdown behavior are unchanged.
Diff classification:
+0/-0+211/-44User Impact
No runtime or operator-visible behavior changes. Maintainers get deterministic startup test isolation without weakening timing or lifecycle assertions.
Evidence
Exact identities:
ea50fe84538e8f4f91ef211d2e54bb16b3bb17c807cebf272fe42543348105ec5f9965030fdc3b1a70c47ec26490c9347b5be46e326101f444c5bec3mainat refresh:295c8dfe6eb7522eb905e31114362d24bf2392b507cebf272fe42543348105ec5f9965030fdc3b1aatt_01KZGQ417GEE38HNXZRP89Q04Hatt_01KZGQXTHX3CBNMV2ARMKQDF2APunchcard-Session: amber-workshop-workshop-36Focused validation on Node
v26.7.0:node scripts/run-vitest.mjs src/gateway/server-startup-post-attach.test.ts: 71/71 passednode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test-pr120503.tsbuildinfonode scripts/run-oxlint.mjs --type-aware src/gateway/server-startup-post-attach.test.tspnpm exec oxfmt --check src/gateway/server-startup-post-attach.test.tsgit diff --checkorigin/main: clean, no findings, 0.99 confidenceHosted evidence:
31258105170on4562051f93c2exposed only two fixture-local defects: Vitest reset callbacks returnedVitestUtils, and teardown could rethrow a non-Errorvalue.07cebf272fe4fixes only those diagnosed lines with void-returning blocks and first-error normalization. Exact-head CI run31258426709completed successfully with no failed jobs.Current-main overlap:
origin/mainchangessrc/gateway/server-startup-post-attach.test.ts.No changelog entry: this is test-only and has no user-visible or runtime behavior change.
AI Assistance
The exact branch received independent audit, plan review, implementation review, focused validation, and branch-wide autoreview. All reported evidence above was verified on the exact head.