Parent: #502 Related: #1032, #1033, #1034, #1035
Executed reproduction
On exact main at d9d1616e1a4505c58fbc51aff5adb831f4b09ed1, a focused standalone agent test pauses the public runnable scheduler at zero, calls the production agent.start, confirms the typed foreground start is queued before entry, and invokes agent.reset on the owning test-host thread.
The bounded observer shows reset cannot finish until runnable capacity is restored:
agent.test.test262 agent cancellation lets reset exit while a start is scheduler-paused...FAIL (TestUnexpectedResult)
0 passed; 0 skipped; 1 failedreset publishes group.stopping, wakes broadcast and Atomics waiters, and joins every agent. A pre-entry agent cannot observe any group state while blocked in the initial scheduler queue, so test teardown and an intentional zero-capacity policy wait on one another.
Required change
- Give every
Agentrecord a typed initial-start cancellation handle. agent.resetmust cancel pre-entry agents before joining their OS threads.- A canceled start must publish the same terminal
doneand waiter-progress notifications needed by group observers without executing source. - A concurrently granted or running agent must retain the existing broadcast/report/Atomics and stop/join semantics.
- Preserve exact foreground thread, runnable/blocked, stack, waiter, and cancellation accounting under grant-versus-cancel races.
Definition of done
- The zero-capacity reset reproduction completes before capacity is restored.
- Canceled agent source does not run and terminal group/waiter notifications are published.
- Repeated queued cancellations plus running broadcast-park and completion cases balance exact coordinator accounting.
- Focused normal and unsuppressed TSan tests pass with zero leaks/races.
- Full unit, runtime-thread audit, and documentation gates pass.
- #502 records the landed commit and exact evidence.
Guardrails
Do not raise runnable capacity, run agent source outside a scheduler slot, drop a running agent, poll/sleep in reset, weaken test262 rendezvous semantics, or add a corpus-only bypass.