Repository navigation
test(infra): synchronize approval shutdown races at callback entry - #134284
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 12:56 PM ET / 16:56 UTC. ClawSweeper reviewWhat this changesThis test-only PR makes three approval-shutdown race tests wait for delivery or binding callbacks to enter their controlled paused phase before stopping the runtime. Merge readinessKeep open. This focused maintainer-authored test PR replaces nondeterministic scheduler waits with callback-entry barriers; the current main test still has the timer-based version, and no functional or security defect was found in the introduced change. Priority: P3 Review scores
Verification
How this fits togetherApproval handlers deliver pending approval prompts through a channel adapter, optionally bind interactions, and clean up entries when the approval runtime stops. The changed tests exercise that delivery/binding-to-shutdown boundary and assert cancellation or unbinding afterward. flowchart LR
Request[Approval request] --> Deliver[Deliver pending prompt]
Deliver --> Bind[Bind interaction]
Bind --> Active[Track active entry]
Stop[Runtime stop] --> Cleanup[Cancel or unbind]
Active --> Cleanup
Before merge
Agent review detailsSecurityNone. PR surfaceTests -19. Total -19 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the deterministic callback-entry barriers while keeping the existing delivery, cancellation, and unbinding assertions as the approval cleanup contract. Do we have a high-confidence way to reproduce the issue? Not applicable: the central problem is nondeterministic test synchronization, and current main visibly uses scheduler delays where this PR uses callback-entry signals. Is this the best way to solve the issue? Yes. Signaling at the controlled callback boundary directly proves the desired race phase, unlike elapsed scheduler turns, while preserving the existing cleanup assertions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 194f06914102. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer review is complete under the standing instruction to land this test-cleanup batch. The latest ClawSweeper review has no actionable findings or rank-up moves. Exact-head CI run 33416230174 passed. All three races now establish callback entry immediately before the controlled suspension. Shutdown, cancellation/unbinding and final in-flight completion assertions remain. All 19 focused and native-adapter tests passed before and after; full changed-file checks and structured Codex autoreview passed. Production +0/-0; tests +20/-39. Proceeding through the native merge workflow. |
|
Merged via squash.
|
What Problem This Solves
Three approval shutdown race tests use two zero-delay timers each to guess when delivery or binding has reached its suspended phase. Scheduler turns do not establish that phase.
Why This Change Was Made
Signal entry directly from the controlled delivery or binding callback, then await that signal before stopping the runtime. Shared deferred helpers also replace three handwritten promise holders. The existing one-second test helper bounds a missing entry signal.
User Impact
More precise shutdown-race proof with six success-path timer callbacks removed. The same cancellation, unbinding, stopped-state and in-flight completion assertions remain; production behavior is unchanged.
Evidence
node scripts/run-vitest.mjs src/infra/approval-handler-runtime.test.ts src/infra/approval-native-runtime.test.tspassed all 19 tests before and after.