Repository navigation
fix: settle task notification fixture lifetimes - #157589
Conversation
Join captured notification cleanup before root assertions and fixture teardown. Preserve result-only publication checks and share scope observation across fixture subscribers.
|
🦞👀 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 24, 2026, 5:32 PM ET / 21:32 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch makes task-notification test fixtures wait for captured delivery cleanup and updates related cron, task, subagent, and Gateway tests. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main and the latest release still have the fixture that waits only for delivery results; the branch addresses a concrete test isolation defect, and review found no actionable introduced bug. Priority: P2 Review scores
Verification
How this fits togetherTask notifications can finish their delivery result before their detached Gateway work scope releases its root. Test fixtures must wait for that cleanup before tearing down task state or asserting root counts. flowchart LR
A[Task or cron event] --> B[Notification delivery]
B --> C[Detached Gateway scope]
C --> D[Delivery result]
C --> E[Cleanup and root release]
D --> F[Test fixture]
E --> F
F --> G[State teardown and root assertion]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +126. Total +126 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep fixture settlement tied to captured delivery scope lifetimes, while preserving a separate result-only wait for tests that intentionally inspect early publication. Do we have a high-confidence way to reproduce the issue? Yes, from source: the old fixture joins the delivery result while detached scope cleanup can still hold a Gateway root. The PR body reports a held-cleanup control and a before/after regression, though this read-only review did not run them. Is this the best way to solve the issue? Yes. Joining only the captured delivery scopes addresses fixture teardown without changing production delivery timing or waiting on unrelated roots. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25f07e880f5d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Preserve main's expanded task-history coverage while composing the shared scope observer import. Keep the notification fixture lifetime repair scoped to its original nine test and support files.
|
Merged via squash auto-merge.
|
Join captured notification cleanup before root assertions and fixture teardown. Preserve result-only publication checks and share scope observation across fixture subscribers.
Related: #156547
What Problem This Solves
Fixes test fixtures releasing their task stores while notification cleanup still holds a Gateway root, which can contaminate a later root-count assertion.
User Impact
No user-visible behavior changes. This repairs test lifetime ownership while preserving production's early delivery result, the cron assertion's exact count, and independently held work.
Why This Change Was Made
The existing fixture joined a delivery's result, which intentionally precedes its enclosing async scope's cleanup. It now joins only the actual scopes belonging to captured deliveries. A shared passive observer lets overlapping fixtures retain their observations until their last subscriber finishes. The one test that deliberately checks the early result uses an explicit result-only wait; teardown still joins the complete lifetime.
Evidence
tasks:delivery. The permanent terminal/state regression failed with the old fixture and passes with the repair, including an unrelated real scope that remains held throughout settlement.5048811d36871c898badf94c6174287c0ab661c2to resolve the task-history import conflict, preserving its new transcript coverage. The normal frozen install's complete application lock matched, and the resulting eight-file focused run passed all 91 cases with clean cleanup in 418.64 seconds.check:changedrun then passed on the integrated source, including all nine TypeScript graphs, formatting, lint, and every selected guard; no checks were skipped.Measured file costs
Pre-integration single-worker
pnpm test <file> --maxWorkers=1process-wall measurements include maintained worker preparation. Task history measured 78.91 seconds before and 156.28 seconds after; compilation/preparation dominated, so no performance improvement is claimed. Cron, delivery lifetime, lineage, and state-notification runs measured 94.46, 61.04, 68.04, and 96.82 seconds respectively. All 23 state-notification cases passed with clean command completion.All five publication tests passed in an 83.83-second invocation, but the command then failed during generated-worker-cache removal with
ENOTEMPTY. Only a late.DS_Storeremained and no holder was found after join; that invocation is not reported as a clean command. The earlier focused publication run passed normally. The same cleanup error was retained from the baseline replay and is outside this fixture patch.