Repository navigation
fix: terminal lifecycle tests fail during module loading - #180156
Conversation
|
🦞👀 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. What this changesThis PR preserves real agent-event exports while mocking the emitter and removes the corresponding closed-mock baseline exemption. Example: Collect agent-lifecycle-terminal.test.ts.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a broken test fixture with a minimal change, preserves every existing assertion, and has no actionable review findings. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe terminal lifecycle backstop converts attempt outcomes into agent events; this fixture intercepts event emission to verify terminal selection and sanitized errors. flowchart TD
A[Terminal lifecycle test] --> B[Export preserving event mock]
B --> C[Real lifecycle registration]
A --> D[Terminal lifecycle backstop]
D --> E[Mocked event emitter]
E --> F[Existing assertions]
Technical reviewBest possible solution: Preserve the real event module, override only the observed emitter, and remove its obsolete baseline exemption. Do we have a high-confidence way to reproduce the issue? Source confirms that the original factory replaces every export except emitAgentEvent while runtime dependencies require lifecycle registration during import; no target code was executed during this read-only review. Is this the best way to solve the issue? This is the smallest complete repair: it follows the existing export-completeness recipe, preserves the intended emitter observation, and adds no lifecycle stub or production test seam. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f7c9c5f23266. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +3, Other -1. Total +2 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 21, 2026, 10:11 PM ET / October 22, 2026, 02:11 UTC. |
|
Fixed: Terminal lifecycle tests now preserve the real lifecycle-rotation contract while exercising terminal event assertions. |
Terminal lifecycle tests now preserve real agent-event lifecycle registration while observing emitted terminal events.
What Problem This Solves
Fixes a terminal lifecycle test suite that fails during module loading before any of its behavior assertions can run. The suite replaced the complete agent-event module to observe one emitter, so runtime code imported by the same test could not register its required lifecycle-rotation cleanup handler.
User Impact
There is no user-visible or runtime behavior change. Contributors regain reliable coverage for terminal publication, retry selection, and sanitized failure messages, while the production lifecycle-rotation contract remains active inside the fixture.
Why This Change Was Made
The fixture now passes the real agent-event module through and overrides only
emitAgentEvent, the function its assertions inspect. This follows the repository's export-complete mock pattern and avoids a lifecycle stub or production-only test seam. The matching grandfathered closed-mock entry is removed from the shrinking ratchet; no other baseline entry or assertion changes.Evidence
Scheduled run 39703131373 failed the target suite before collection with the missing
registerAgentEventLifecycleRotationHandlerexport, while 924 other tests passed in that job.On the exact two-file candidate:
src/auto-reply/reply/agent-lifecycle-terminal.test.tscollected and passed all 10 existing cases in 38.52 seconds.Hosted CI and exact-head review continue on the published commit.