Repository navigation
test(workforce): bound the next host's shutdown drain in the call crash tests (FIX-2269) - #4204
Conversation
…t parks
A wait that starts its own work (dispatcher({ wait: true }), a worker's
call) now owes its park through the new optional RequestWaits.owingPark
verb. The engine keeps the obligation as an engine-owned wake on the
request's session; the durability sweep continues an interrupted request
that still owes one, and its replay parks on the work it already started.
The park, the wait's return or throw, the request's end and a stop clear
it; past 10 minutes from the first owe the request is left interrupted.
History, retention and waits.ended read an owed request as parked.
A call's repeated send now dispatches itself on a flow with a pass, so a
call continued after dying between its row and its dispatch has a request
to wait on and is answered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
…dispatcher out Codex review on #4078: - P2: a stop could land between the sweep's read of the owe and its continuation. The stop now lets the owe go under the request's lease, and the sweep's admission reads the owe again under it; a stop that finds the lease held answers already-resolved. - P1: runOnce records only after its function returns, so a waiting dispatcher that died after its child was accepted would dispatch a second child on the continuation (the seam takes no stable request id). The dispatcher no longer owes a park; only the call does, whose message id is kept first and taken once. Recorded in DECISIONS for Jake's call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
Codex review on #4078 (P2): drivenAgain checked the owed park only when no gate was logged, so a request whose earlier wait's gate was answered and pruned, and which then died in a later call before parking, read as ended to waits.ended and retention. The owe is now read first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
Codex review on #4078 (P2): a call continued after dying between paying its budget and writing its row repeated payPlace with the same message id, counting it twice against the request (refused under perTurn: 1) and appending it twice to the chain. The request now names the ids it paid for and the chain appends an id once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
Codex review on #4078 (P2): runAction cleared the owe right after the gate was written, before the suspension item reached the request's log. A death in between left an interrupted request with an unlogged pending gate (which the resume refuses as busy) and no owe to continue it. The owe is now cleared after the suspension item is flushed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
…owes it Parallel waits in one request share the request's owed-park wake. The wrapper now counts them and clears the wake only when the last settles, and never once one has parked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
A host dies after the turn's send is recorded and before its gate is written; the next host's sweeps continue the request, which parks on the send it already made and is answered in the same request. The control drops the owe and stays interrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
…-d2ex6z # Conflicts: # packages/engine/src/context/createExecutionContext.ts # packages/workforce/src/messages/send-message.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
…sh tests (FIX-2269) Since per-worker token usage, a worker's request owes a request-end hook from its start. The dead host's frozen request never pays it, and the debt is kept per process, which both test hosts share, so the next host's dispose waited out its 10 s drain and the afterEach hook timed out. Dispose its router with a short drain first, as the orchestration crash test does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Second look + architectureVerdict: the test-only fix is fine to merge as a stopgap. Two follow-ups are worth deciding on. Second look (is there a better approach?)
Architecture (only where this PR is the opening)
Suggested actions for the follow-up agent
Generated by Claude Code |
There was a problem hiding this comment.
/simplify review (FIX-2269 shutdown drain)
Scope: One commit on top of main — caps teardown for the crash-restart helper in callThenDie so afterEach does not sit on the default ~10s shutdown drain when the first host is intentionally never disposed.
Did the approach go too far?
No. This PR does not expand the crash simulation from #4078; it only wires the engine’s documented escape hatch (disposeFlowApiRouter(router, { drainMs })) before next.dispose(). That matches notice-after-crash.test.ts and the same ordering as @flow-state-dev/node’s app dispose. Re-running @flow-state-dev/workforce tests locally: 143 files / 1693 tests passed (includes the two callThenDie cases).
The inherent complexity lives in simulating process death (killable stores, abandoned first host, shared stores). A cleaner product shape would be forwarding shutdownDrainMs through createFlowState / bootBoardHost so open = next needs no wrapper — but that is a small engine+harness plumbing change, wider than this follow-up, and not required to ship the fix.
What I’d still consider (optional, not blockers)
- Presentation:
{ ...next, dispose: … }is the only BoardHost spread in this file. A one-liner helper (local or harness) would read the same asnotice-after-crash’s explicitdisposewithout implying a new host shape. - Magic number:
100duplicatesnotice-after-crash.test.ts. A shared named constant (even a comment pointing at the sibling test) would tie the two crash-teardown tests together. - Footgun (maybe): Bounded drain avoids hanging; it does not clear process-global request-end
owedentries from the dead host. This describe is last in the file today — if someone adds tests after it without the same teardown pattern, they could see slow/flakyafterEachagain. Worth a one-line note in the comment if you expect more crash hosts in this file.
Alternatives considered
| Approach | Verdict |
|---|---|
shutdownDrainMs at second bootBoardHost |
Cleanest long-term; needs config forwarding not in harness today |
Skip next.dispose() after short router dispose |
Wrong — stores/adapters stay open |
drainMs: 0 |
Faster but fights stream-contract tests’ lesson on closing while hooks still owe |
| Avoid crash-restart integration test | Would shrink harness complexity but loses FIX-2269 regression coverage |
Verdict: Mechanism is right-sized for the problem. Approve with the optional nits above.
Sent by Cursor Automation: Review For Best Approach
…sh tests The two worker-calls crash tests time out in their afterEach on main (red since FIX-2269); this is #4204's one-file fix, ported so this PR's CI can go green. It no-ops once main carries #4204. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ
There was a problem hiding this comment.
Code Snob on 8098a66005b5996ad05b7db154735509de3022d3.
The dispose override clones the board host so one drain can run before the real dispose. This describe's afterEach already runs before the file hook that calls open.dispose(), so the 100ms disposeFlowApiRouter belongs there and callThenDie stays open = next.
A shutdownDrainMs option on the harness is the longer route. createFlowState does not forward that router option, so the option adds a field this one test would be the only caller of.
Fold that subtraction from #4205. After this PR lands, close the POC unmerged. Do not merge the POC.
packages/workforce/test/worker-calls.test.ts on the POC branch: 11 passed. The two crash tests finish in about 1.3s each.
Sent by Cursor Automation: Code Snob
…st clone (FIX-2269) Folds Cursor's review: the crash suite's afterEach disposes the router with a short drain before the file hook disposes the host, and callThenDie keeps open = next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
Main's README table went stale with #4183 and turns Test (3/3) red on every PR. Written by the lab's own scripts/inventory.mjs --write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f
|
Test (3/3) failed on c82bfb1, and the cause isn't this PR. Generated by Claude Code |
Red on main since #4078: both hook-timeout failures in worker-calls.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K
…(port of #4204) Ported from #4204 so this PR's CI isn't red on main's worker-calls hook timeout; it no-ops once main carries the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd
…sh claude-code-style inventory Both are red on main and unrelated to FIX-2332; this is #4204's change as is, so it no-ops once #4204 merges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEe3E83otCATaGAJdW
* goal(FIX-2242): scene ac waits through interrupted while a park is owed FIX-2269's durability sweep continues an interrupted call a stale threshold later, so a:answer-in-request now follows the request until it completes or times out instead of stopping at interrupted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9 * goal(FIX-2242): clearer wait note; regenerate the Claude Code-style lab inventory The lab's README inventory went stale on main with FIX-2288 (#4183), which reds Test (3/3); this is the same --write output any fix would carry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9 * test(workforce): bound the next host's shutdown drain in the call crash tests (FIX-2269) Since per-worker token usage, a worker's request owes a request-end hook from its start. The dead host's frozen request never pays it, and the debt is kept per process, which both test hosts share, so the next host's dispose waited out its 10 s drain and the afterEach hook timed out. Dispose its router with a short drain first, as the orchestration crash test does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiEuGX4bfXGJoNxGQ6f * test(workforce): port #4204's reshaped crash-suite drain (FIX-2269) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9 --------- Co-authored-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiERr11zgW5NZqDYMfn
…ate (#4199) * FIX-2332: Teammates lab coding runs are background tasks, not a teammate coder leaves the teammates list and stays on the roster as the hidden worker coding tasks go to. Each coding task shows as a background item under the teammates and as a card in the conversation that started it; both open to the run, read only, and its result lands as the coding task's. lead's instructions say start a coding task. FIX-2154 D4 gets a dated amendment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * Port #4204: bound the crash host's drain in worker-calls tests, refresh claude-code-style inventory Both are red on main and unrelated to FIX-2332; this is #4204's change as is, so it no-ops once #4204 merges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2332: a background run gets no empty Talk column The grid kept its 18rem Talk column while a run was open, though the panel isn't drawn there. The column now follows the same condition as the panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi --------- Co-authored-by: Claude <noreply@anthropic.com>
…nfig (#4206) * FIX-2335: Teammates lab drops projects for one working folder from config The lab's host now runs on the existing constant run source, a git checkout the operator names in TEAMMATES_WORKDIR, listed in localRepositories. Unset, missing or not a checkout, the lab fails at start; it never falls back to the current directory or its own checkout. Project tools, TEAMMATES_PROJECTS and the start-up project writes are gone, and so are the header project select, the New project form, the needs-project card and the repository approval card. Task cards say running and done. No WORKER.md mentions a project. ER-8 and FIX-2154 D3 get dated amendments scoped to this lab; packages/ is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2335: workingFolder stays private to host.mts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * FIX-2335: test the working folder check; drop stale header lines and unused import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * FIX-2335: keep the approval card for any worker's waitForUser approval The project tools were the only thing asking for approval, but waitForUser is a control tool every agent worker has. Without the entry and answerApproval a worker that asked would stop with nothing on the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * Claude Code-style lab: regenerate the README inventory main left stale #4183 (FIX-2288) changed the lab's files without rewriting the table, so the lab's inventory test is red on main and on every PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * Port #4204: bound the next host's shutdown drain in the call crash tests Red on main since #4078: both hook-timeout failures in worker-calls.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * Teammates lab: regenerate the README inventory after the merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K --------- Co-authored-by: Claude <noreply@anthropic.com>
Main carries the stack this PR sat on as squashed commits, so the tree is main plus this PR's own changes; ports of #4204 and the claude-code-style inventory are now main's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd
* FIX-2332: Teammates lab coding runs are background tasks, not a teammate coder leaves the teammates list and stays on the roster as the hidden worker coding tasks go to. Each coding task shows as a background item under the teammates and as a card in the conversation that started it; both open to the run, read only, and its result lands as the coding task's. lead's instructions say start a coding task. FIX-2154 D4 gets a dated amendment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2335: Teammates lab drops projects for one working folder from config The lab's host now runs on the existing constant run source, a git checkout the operator names in TEAMMATES_WORKDIR, listed in localRepositories. Unset, missing or not a checkout, the lab fails at start; it never falls back to the current directory or its own checkout. Project tools, TEAMMATES_PROJECTS and the start-up project writes are gone, and so are the header project select, the New project form, the needs-project card and the repository approval card. Task cards say running and done. No WORKER.md mentions a project. ER-8 and FIX-2154 D3 get dated amendments scoped to this lab; packages/ is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2336: Teammates lab's lead becomes Chief of Staff, and acts instead of offering The lead worker is now chief-of-staff (teammates.chief-of-staff), shown as Chief of Staff. Its WORKER.md gains general tool-use guidance: act rather than offer, ask a teammate now when asked about them, hand work to whoever fits, and ask the user only what no tool can find. It adds no project text. researcher and writer each get a line saying who they are. README, TEAM.md, tests and the two teammates-lab goals follow the rename. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2335: workingFolder stays private to host.mts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * FIX-2335: test the working folder check; drop stale header lines and unused import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * FIX-2335: keep the approval card for any worker's waitForUser approval The project tools were the only thing asking for approval, but waitForUser is a control tool every agent worker has. Without the entry and answerApproval a worker that asked would stop with nothing on the page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K * FIX-2337: Teammates lab's message list and composer share one column A --thread-width token (46rem) in the lab's theme caps both the message list and the composer, centred, so their edges line up with Talk open or closed. The composer's box starts at one line and grows with its text up to a cap. The assistant's text takes the column's full width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiCsRqCenZsFQRpJBHi * FIX-2338: new content in the Teammates lab settles in place The conversation follows new content, a streamed answer's growth included, only while the reader is at the end, scrolling the list itself and smoothly; scrolled up, it stays put and offers Jump to latest. The answering line comes from the conversation's items as well as the timed request list, and shows only before an answer's text starts. A task card is drawn the moment it is filed and fills in place when the board's row lands. Unchanged entries keep their objects and Entry and TaskCard are memoized, so a chunk redraws only the growing answer. A send's own stream now keeps tool results and components, so a card lands in order beside the text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd * FIX-2337: composer refits its height when the column's width changes Talk toggling narrows or widens the center column, which rewraps a draft; the box only refit on text changes. A ResizeObserver refits it on a width change. Addresses Codex review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiE77dZBto1MJmMqd8e * FIX-2338: reuse core's looseDeepEqual and keep a filed task's placeholder card stable reuseById compares with looseDeepEqual from @flow-state-dev/core/helpers instead of JSON.stringify. A task card drawn before its board row lands gets one placeholder object per entry, so the memoized card skips re-renders while the answer streams. Drops a duplicated doc comment on the task entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd * FIX-2337: composer sizes to its draft with field-sizing-content Matches the FSD prompt inputs (packages/ui, kitchen-sink) and drops the scrollHeight effect and ResizeObserver: the browser regrows the box when Talk narrows the column. Follows the Cursor review on Codex's resize finding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiE77dZBto1MJmMqd8e * FIX-2338: a failed turn's half-written answer no longer reads as answering The conversation's poll reads recent requests instead of only in-progress ones, and answeringOf takes the ended request ids: the newest request's in-progress item counts only while its record hasn't ended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd * FIX-2337: refresh the lab inventory table after the merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiE77dZBto1MJmMqd8e * Claude Code-style lab: regenerate the README inventory main left stale #4183 (FIX-2288) changed the lab's files without rewriting the table, so the lab's inventory test is red on main and on every PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGfGi2RaecD1vUwy8K (cherry picked from commit 091232e) * test(workforce): bound the dead host's drain in the call crash tests (port of #4204) Ported from #4204 so this PR's CI isn't red on main's worker-calls hook timeout; it no-ops once main carries the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd * Teammates lab: regenerate the README inventory after the merge Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd * FIX-2338: a finished answer doesn't end its request One request can answer more than once (a worker draining its own plan answers, works, and answers again), so answeringOf no longer treats a completed assistant message as the request's end; only the request list does. The conversation shows its 'answering' line only until the turn's answer text starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiGd2GcnfH9FbHkXisd --------- Co-authored-by: Claude <noreply@anthropic.com>
* spec(FIX-2334): workers know their own name and role The identity block and a short tool-use rule become Workforce's default prompt layer, first in the built-in worker flow's prompt, built from the roster each turn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ * spec(FIX-2334): fold fsd-architect's placement answer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ * spec(FIX-2334): fold the simplify review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ * chore: refresh the Claude Code-style lab's inventory table Stale on main since #4183, which turns the lab's inventory test red on every PR. Regenerated with node scripts/inventory.mjs --write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ * test(workforce): port #4204's bounded shutdown drain for the call crash tests The two worker-calls crash tests time out in their afterEach on main (red since FIX-2269); this is #4204's one-file fix, ported so this PR's CI can go green. It no-ops once main carries #4204. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ * spec(FIX-2334): the build removes the Teammates lab's stopgap identity lines Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiFsTymVutTnxtzVCSQ --------- Co-authored-by: Claude <noreply@anthropic.com>


Requested by Jake · project thread
What's red
On main (df92436), both tests in
packages/workforce/test/worker-calls.test.ts→ "a call whose process dies before it parks" fail withHook timed out in 10000msat theafterEachdispose. This happens 3 out of 3 times locally, and it turns Test (2/3) red on unrelated PRs (for example #4193).Why
#4078 (FIX-2269) and #4013 (FIX-2145, per-worker token usage) each passed on their own. They fail together:
request-end-hooks.ts), not per host. So the next host'sdispose()waits out the full 10 s shutdown drain for a run that will never end, and the hook times out.Bisected: with #4013 reverted locally, the tests pass on main. Reverting #4149 alone doesn't fix them.
Fix
This is a test-only change. The test now disposes the next host's router with a 100 ms drain (
disposeFlowApiRouter(router, { drainMs: 100 })) before disposing the host, the same patternorchestration/test/tasks/notice-after-crash.test.tsuses. The next host's own work has already settled by then (next.settled).In a real deployment the dead process's debt dies with that process, so nothing changes at runtime. One thing worth noting, but not changed here: a router's shutdown waits on request-end hooks from any router in the process, not only its own.
Verification
worker-calls.test.ts: red on main (2 failed, hook timeout) → 11/11 green with this change.integration-testsscenariowait-killed-before-it-parks: 2/2 green on main.No changeset needed (test-only).
Generated by Claude Code