Repository navigation
fix(ci): subagent cancellation test races child registration - #166807
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 changes before merge. Reviewed October 7, 2026, 7:34 PM ET / 23:34 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR synchronizes the subagent cancellation test at session preparation so child registration finishes before cancellation releases parent capacity. Merge readiness⛔ Needs changes before merge - 1 item remains The fixture repair remains useful and is absent from current main. No introduced correctness defect was found; the previously identified flake-validation requirement remains unmet. Priority: P2 Review scores
Verification
How this fits togetherSubagent cancellation discovers registered descendants and holds queued work while stopping their parent. This test fixture controls registration timing and checks that cancellation prevents child launch without affecting unrelated work. flowchart TD
A[Parent cancellation] --> B[Session preparation barrier]
C[Child registration] --> D[Durable registry]
D --> B
B --> E[Descendant discovery]
E --> F[Hold and cancel queued child]
F --> G[Release scheduler capacity]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +9. Total +9 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep cancellation coverage deterministic at the existing preparation boundary while preserving real registry discovery and scheduler cleanup. Do we have a high-confidence way to reproduce the issue? Yes: source exposes the unbarriered registration/cancellation interleaving, and the captured body describes a controlled diagnostic reproducing the CI assertion. This read-only review did not execute tests. Is this the best way to solve the issue? Yes: gating the existing preparation call and then delegating to its original implementation repairs fixture ordering without weakening assertions or changing production cancellation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 14ef7a57ba7c. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Related: #166754
What Problem This Solves
Fixes intermittent CI failures in the subagent cancellation regression when child registration loses a race with parent cancellation.
User Impact
No runtime or user-visible behavior changes. CI retains cancellation coverage without relying on incidental worker timing. No configuration, migration, or public API changes.
Why This Change Was Made
The existing “runtime load” case assumed cancellation would pause while a runtime module loaded. Commit
995b5ac506e(#164403) made that import static. The fixture still made the child dispatchable before awaiting its durable registration, so cancellation could release parent capacity before discovery could see the child.Replace that retired timing assumption with an explicit barrier at the current initial session-preparation boundary. Register the child through the real owner before releasing preparation, then let real discovery, cancellation, and scheduler cleanup run. All existing no-launch, terminal-state, replacement-generation, and unrelated-root assertions remain unchanged.
Evidence
node scripts/run-vitest.mjs src/agents/subagents/registry/subagent-control.test.ts --maxWorkers=1(104.57 s command wall time; 98.25 s Vitest duration). The repaired case took 1.836 s. The original CI file ran for 73.05 s; candidate hosted timing is pending. No new cases, process boots, worker pins, or serial configuration were added.git diff --check, formatting, agents/sessions test types, targeted lint, and the changed-file ratchet/boundary guards passed against an independent frozen dependency install. The production unused-export scan passed. The full-tree and script unused-export scans report the same inherited finding:scripts/publish-model-catalog.mts: readRecommendedModels. That file and its consumers are unchanged in this PR; the symbol is exported but only called internally. It is recorded rather than suppressed or folded into this fixture repair. The overallcheck:changedresult is therefore not green.Test/support-only: +13/−4 lines; no production changes. This repairs an obsolete fixture ordering assumption, not a proven production cancellation bug.