Repository navigation
refactor(test): keep lifecycle resets out of production - #154669
Conversation
Move private model-catalog resets and asynchronous writer drains into test support. Preserve shipped SDK clear APIs and exercise lazy Gateway activation through its real entry point.
|
🦞👀 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 21, 2026, 6:30 AM ET / 10:30 UTC (Revision 3). ClawSweeper reviewWhat this changesMoves private model-catalog resets and writer-queue drains into test support, updates their callers, and checks lazy Gateway loading through startup. Merge readiness✅ Ready for maintainer review Keep open as useful, review-ready cleanup. The added measurements resolve the prior review’s timing request, and no actionable introduced defects were found. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway prepares model catalogs for agent requests, while writer queues serialize session updates. Test fixtures reset these owners between cases; production startup and write settlement remain unchanged. flowchart TD
A[Test fixtures] --> B[Test lifecycle helpers]
B --> C[Reset prepared model catalogs]
B --> D[Await active writer drains]
C --> E[Isolated next test]
D --> E
F[Gateway startup] --> G[Production runtime owners]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -63, Tests +69. Total +6 across 29 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep private lifecycle cleanup in test support while preserving production startup, writer settlement, and published SDK clear contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor addresses source organization rather than a reported runtime defect; current main confirms the private production exports still exist. Is this the best way to solve the issue? Yes: moving the existing helpers and their callers together removes unnecessary production surface without adding a competing runtime owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b95f9005280f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
) * refactor(test): keep lifecycle resets out of production Move private model-catalog resets and asynchronous writer drains into test support. Preserve shipped SDK clear APIs and exercise lazy Gateway activation through its real entry point. * chore: merge main into lifecycle test cleanup Co-authored-by: Peter Steinberger <[email protected]>
Related: #150153.
What Problem This Solves
Production Gateway modules carry a chain of exports used only to reset test model catalogs, and session writer queues expose a private asynchronous test drain.
User Impact
No user-visible behavior change. Published SDK cache-clear APIs and production writer settlement remain unchanged.
Why This Change Was Made
Move the private reset and drain operations into test support, remove the production forwarding chain, and update callers together. The lazy-loading test now exercises Gateway startup itself. Production code shrinks by 63 lines.
Evidence
Independent review found no actionable issues. The current-main integration passed all 27 admission tests and focused types/lint. Earlier source-bound validation passed 300 owner and sibling tests, three synthetic Telegram Gateway flows, the build, type checks, and changed-code checks. The six production modules are unchanged by integration; the private drain bodies and published clear APIs retain their behavior. Current-head CI remains required.
The reset move exposed a malformed model fixture and an assertion that counted fixture preparation as read-side discovery; both now preserve the actual catalog contract. The Telegram replacement scenario now proves the admitted callback waits without premature edits or retries before replacement is published.
The Discord transcript-capture E2E also stalls at tool execution on the unchanged baseline. This PR updates its cleanup import and does not claim to fix that independent failure.
Test costs
Paired measurement compares baseline
aa099e492dabc5e26c6ec0b5962bc637d5df1f7cwith this exact32c417a14414582b4045077a1926ee4545716c8chead on one AWS c7a.8xlarge host (Linux x86_64, Node 24.19.0, pnpm 12.4.0). Each complete file ran once throughnode scripts/run-vitest.mjs run <file>with verbose/JSON reporters, separate frozen installs, fresh homes/caches, and 431 matching dependency/configuration inputs. Both source trees remained clean.server.lazy.test.tsserver.models-voicewake-misc.test.tsThese are single observations, not statistical performance or CI-savings claims. Setup/download time is excluded. An initial transport attempt failed before executing the payload; it was preserved and cleaned up before the script-only transfer succeeded. No test was retried or edited. Both proof leases are released with cleanup complete.
Current-head CI passed with 140 successful jobs and 17 skipped jobs. Workflow elapsed time was 1,296 seconds (21m36s), including scheduling and parallel work rather than accumulated CPU time. The required Security Review gate also passed.