Repository navigation
feat(workforce): a worker can call another worker and wait for the reply (FIX-2239) - #4020
Conversation
…ageReceived (FIX-2238) The tool is sendMessage, the entry onMessageReceived, replyTo is inReplyTo; no alias for the old names (FIX-2070 ER-7). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
…elayed (FIX-2238) onMessageReceived lands a history-only line and a client-only workforce:received component, and hands the flow's turn the received message (id, from, text, call, inReplyTo, budget). The relay goes: a worker answers with sendMessage and inReplyTo, or not at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
An answer lands in its original's session; a message to the filer lands in the filing session (new readonly filingWorkerId). Workers that hear only in their tasks' sessions are refused by name before the row is written. The delegate's ongoing session is born with its filer's count, and a task held from its filing starts a fresh chain when released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
…ure exports (FIX-2240) takeRule/decideTake (own | busy | takeover) and nextResendAt are what the task-notice take and pass already decide by; worker messages will decide by the same pieces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…ure exports (FIX-2240) takeRule/decideTake (own | busy | takeover) and nextResendAt are what the task-notice take and pass already decide by; worker messages will decide by the same pieces. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
The send owes its session's board pass and keeps the id on an owed list, writes the row, and dispatches once. onMessageReceived takes the message on its row (orchestration's take rule, with take-over), lands the items, then marks it delivered. The pass sends an owed message again by the notice backoff until it lands, is refused (final), or passes the host's debt age; a late failure leaves a line in the sending session. The two tries, the tool's unconfirmed answer and the 500-id window go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…peat safely under a server id (FIX-2240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…dn't be delivered past the debt age (FIX-2240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…ailure line (FIX-2240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…to claude/project-thread-3uc91a
…-2240) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
hireWorkforce refuses a worker flow without an onMessageReceived built by messageReceivedEntry. The coder hears only in its tasks' sessions; the error reporter's turn runs for a message. messageReceivedEntry and its types are exported. Shift Manager draws workforce:received as its own item under the sender's name, replacing the 'From X:' prefix match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
…k reads its principal's session (FIX-2160) The partitioned ledger keeps an id index written by its own add (findTaskPartitions, taskLedgerResources); the request host gains sessions.read, which answers a session of the running principal with its flow and readonly state, and any other as absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
… shared (FIX-2160)
The door's talk runs as a block of its own that a coder can also run for a
message: it resumes a finished task's coding session once and answers
{ reply, taskId }, and refuses a task still open (task-running), since a
message never steers. rowsInSession, in orchestration, is the one reader of
the rows that run in a session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
…before the row (FIX-2160)
A { task } target finds its row through the conversation ledger's id index
and lands in the session its run named; a { session } target lands in that
conversation of the user's. Both are checked on the session's record
(requestHost.sessions.read): the user, org and tenant, the worker and its
flow now, and for { session } that it is a conversation. A coder's task
still running is refused task_running. Shift Manager names the target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
The retired-terms guard reads 'kind' as a worker-flow word on Workforce's ground, so the row field is addressedBy, not toKind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
… from the coding session (FIX-2160) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
Docs and READMEs describe sendMessage, onMessageReceived, the received item (which now carries the budget left), the landing rules, the budget and the refusals. The workers-message-each-other goal gets the spec's new legs, controls and sweep. The epic's seam table, ER-6 and stack order follow the cross-spec review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…k reads its principal's session (FIX-2160) The partitioned ledger keeps an id index written by its own add (findTaskPartitions, taskLedgerResources); the request host gains sessions.read, which answers a session of the running principal with its flow and readonly state, and any other as absent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
… shared (FIX-2160)
The door's talk runs as a block of its own that a coder can also run for a
message: it resumes a finished task's coding session once and answers
{ reply, taskId }, and refuses a task still open (task-running), since a
message never steers. rowsInSession, in orchestration, is the one reader of
the rows that run in a session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
…before the row (FIX-2160)
A { task } target finds its row through the conversation ledger's id index
and lands in the session its run named; a { session } target lands in that
conversation of the user's. Both are checked on the session's record
(requestHost.sessions.read): the user, org and tenant, the worker and its
flow now, and for { session } that it is a conversation. A coder's task
still running is refused task_running. Shift Manager names the target.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
The retired-terms guard reads 'kind' as a worker-flow word on Workforce's ground, so the row field is addressedBy, not toKind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
… from the coding session (FIX-2160) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
…task; changesets (FIX-2160) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
… once (FIX-2240) Pins the case a review on #4010 found: a claim before the items made a retry read as a duplicate. The take alone isn't a delivery, so the sender's pass resends and the next request takes it over. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
Resolve the FIX-2070 DECISIONS.md conflict by keeping both amendments: the stack order and FIX-2160's addressedBy/toTask from this branch, the FIX-2240 take-and-resend fields from main. Review on #4010: - send-message: one placeAfter helper for a send's place; the pre-read of the chain row is gone, since reserve, conditional update and give-back already refuse an over-budget send at no cost. - messageReceivedProblem takes the flow and reads its internal actions itself, so the hire carries no copy of the flow's shape. - runs-on-one-task goal: the roster's own tools are listDelegates and sendMessage. - Goal leg 2b names sendMessage, since "wait" alone led the model to file a task and wait on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDWiB5JZRCvyAFUpe9
…dger's id index (FIX-2160) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
…Items (FIX-2240) The serialized queue swallows write errors, so flushItems resolved after a failed write and the message entry's barrier marked delivered without stored items. The filesystem store now records the item error and rethrows it from flushItems, as flushEvents already does and the Postgres store's flush does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
…2239)
Split out of dispatcher({ wait: true })'s private sendAndWait so a call, a
wait-again by call id and a held message park on the one wait gate the same
way. Takes a deadline in ms from now, the host's default when unset. The
dispatcher keeps its runOnce keys, so in-flight waits replay unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
…its deadline (FIX-2239)
sendMessage takes wait, deadline and callId. A call parks on the one wait
gate, bound to the request that acts on the message (its dispatch, then the
row's taker, then deliveredAs), and answers with that request's reply, the
final text of the recipient's onMessageReceived turn. At the deadline it
answers running with its call id, and sendMessage({ callId }) waits again
without sending. Every check runs before the row.
A message to a session stopped for a person, or to a task held on one,
queues at onMessageReceived's admission (queuedBehind: person) until nothing
holds it. The engine reads a session's open person stop
(RequestWaits.personStop) and, from a run that resumed a request, resumes
gates its own session parked on that request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
… row (FIX-2239) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
…ols (FIX-2239) Leg 2b (no waiting) is replaced. DevTeam takes DEVTEAM_WAIT_DEFAULT_MS, so the goal can time a call's default deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
…rose (FIX-2239) The vocabulary check retires "person" where it means the signed-in user, so the row's queued mark is queuedBehind: "user". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
|
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. |
…2239) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
jhoffner
left a comment
There was a problem hiding this comment.
Second look + architecture pass (read-only; for the picking-up agent to triage)
Overall the approach holds: waitOnRequest as the shared park half is the right cut, call stays a message rather than a task, and the tests exercise the intent. Findings below are about whether the diff earns its scope. None block on correctness that I could trace; #1 is the one place this PR is an opportunity to refactor while adding the feature.
1. Duplicated wait-check ladder (worth doing in this PR)
checkWait in packages/workforce/src/messages/call.ts:47 re-implements the ladder in check() in packages/orchestration/src/tasks/helpers/wait-on-task.ts: canHoldWait/runOnce/suspend guard → wait_unavailable, deadline bounds → wait_deadline_out_of_range, the fsd.wait.step:<stepKey> claim → wait_already_pending, and depthRefusal → wait_too_deep. Same codes, near-same prose. The PR exports toolCallOf only so workforce can copy it. Two copies of one rule (the step-claim key is a string both must agree on) will drift.
Leaner shape: extract the task-independent part (guard, bounds, step claim, depth) next to toolCallOf in orchestration (or waitOnRequest's neighbour in core) as one checkWaitable(ctx, { key, deadlineMs, step, binding }) returning refusal or { deadlineMs }; waitOnTask.check keeps its task-specific refusals and the board-slot checks, and callWorker calls the shared piece. That also makes the three-changeset footprint smaller and removes the need for the toolCallOf export to be a public surface.
2. Claim is consumed before later refusals
In checkWait, the step claim (call.ts:69) is taken before the depth check and before sendMessage can refuse (unknown recipient, budget). A refused call says "Nothing was sent", but the step is now claimed, so a second wait in the same step gets wait_already_pending though nothing waits. With parallel tool calls in one step, one bad recipient blocks a good one. Consider claiming only after the send is accepted, or releasing on refusal. (Same ordering exists in waitOnTask, so this may be a shared fix via #1.)
3. Not-admitted call can spin
queueBehindPerson returns not_admitted → entry ends with {} → the caller's awaitReply sees completed without a reply, re-reads the row, after === target (call.ts:191) → running. waitAgain then targets the same ended takenBy request, which completes at once with no reply → running again immediately. Until the sending session's pass resends, a model told to "wait again" can loop each step at no delay. Plausible, not reproduced. Worth either a test for it or a distinct running hint (e.g. not waiting again on a request that already ended without a reply).
4. Entry output schema changed from tapIf to stepIf (message-received-entry.ts:267-273)
The entry's output was the heard marker; it is now { reply? }. isHeard discriminates by heardSchema.safeParse plus an "act" in value check, so a turn whose own output happens to carry act: "none" | "heard" is read as the heard step. Low odds, but the discrimination is by shape rather than by construction. A cleaner way is to carry the heard marker in request state (you already set RECEIVED_CALL_STATE there) and let the final step read that instead of sniffing the output. Also confirm nothing outside the tests read act off the entry's output (my grep found no src/ consumers, only tests).
5. Vocabulary is inconsistent within the PR
Stored/visible values say "user" (queuedBehind: "user"), while the new public core hook is RequestWaits.personStop, and workforce has queueBehindPerson/personHoldOf. The PR text says the pre-push check retires "person" for the signed-in user; personStop is a new exported core name and is harder to rename later than the internals. Suggest userStop (and the workforce helpers) now, keeping recipient: "waiting_on_person" as epic D3 locked it. queuedBehind is also a one-literal enum ("user"), effectively a boolean; fine if more holders are planned, otherwise queued: true is simpler.
6. Smaller notes
repliedtruncates the reply silently toMAX_MESSAGE_CHARS; the caller cannot tell it was cut. Say so in the result (or in the description) rather than slicing quietly.waitOnRequesttakes bothdeadlineMsanddeadlineAt; onlycallusesdeadlineAt. Fine now, but one input (deadlineAt, with the dispatcher computing it) would be a smaller API.personStopdoes alistSuspendedon every message admission, not only for calls. The engine test shows ending a plain request lists nothing extra, but every take now pays a listing; worth a cheap short-circuit if the session has never parked.
What I'd leave alone
queue.ts parking directly with parkOnWait (documented as needed for the task-row binding) and the own-session resume in wait-chain.ts look proportionate and are tested with controls.
Generated by Claude Code
There was a problem hiding this comment.
Simplify pass (FIX-2239)
Verdict: The shape of this change is the right one for the spec. A call is not a synthetic task row, and folding send+wait into a second tool would fight epic D1/ER-1. Extracting waitOnRequest from the dispatcher and keeping queue.ts on raw parkOnWait for mixed bindings (request vs task row) matches DECISIONS and avoids a parallel wait mechanism.
What reads as “a lot of code” is mostly domain surface area, not accidental abstraction:
| Layer | Role |
|---|---|
waitOnRequest (core) |
Shared park + outcome mapping for { requestId } binds |
call.ts |
Tool-facing checks, idempotent send, follow-the-acting-request loop |
queue.ts |
Admission hold behind person stop / question (D3) |
Engine personStop + own-session resume |
Extends existing wait-chain, not a new gate |
The follow loop in awaitReply is the hardest block, but it is doing real work (taker handoff, copy/dead request, fresh queuedBehind for running) that dispatcher({ wait: true }) cannot subsume in one dispatch.
Could a simpler approach have worked?
getTask+ wait on a message-shaped task — Rejected in spec/epic; would duplicate budget/row semantics and fight “calls are messages.”wait: trueonly while recipient is idle — Rejected; breaks queue-behind-person and late-reply retention.- One mega-module instead of
call+queue— Would still need both admission parking and caller-side wait; the split matchesonMessageReceivedadmission vssendMessagetool. - Third-party package — Nothing obvious replaces durable
parkOnWait/ session replay; this correctly composes engine primitives.
Follow-ups worth considering (non-blocking)
- Dedupe tool-step wait prechecks —
call.tscheckWaitparallelswait-on-task.ts(host, deadline bounds,fsd.wait.step, depth). A shared helper next to exportedtoolCallOfwould shrink drift risk when bounds change. replyOf/replyTextOf— Same{ reply }extraction incall.tsandmessage-received-entry.ts; one small shared helper if turn output shape evolves.gateIdvsplanKeydocs —WaitOnRequestInputsays gate id is “the same on every replay,” but callers pass a fresh UUID; replay stability is reallyplanKey+runOnce. Clarify in core docs to avoid wrong refactors.- Optional
planAndParkin core —queue.tsduplicates therunOnceplan +parkOnWaitshape thatwaitOnRequestuses; only worth it if a third copy appears. - Perf (later) —
waitChainDepth/personStoplist all pending suspensions per user; fine at current scale, but the cost grows with concurrent parked waits. Roster fetch on everycontrolToolsresolution inmessage-tool.tspredates/is amplified by calls but is unrelated to call correctness.
Organization / imports
messages/call.ts + queue.ts beside delivery/send is clean. Workforce → orchestration for holds/toolCallOf matches existing patterns; no core → workforce back-edges. Goal leg legs-calls.mts is long but encodes anti-game signals the spec demands — I would not shrink it at the expense of verification strength.
No major concerns from this pass; approving with the nits above as optional polish.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
Code Snob — already tight. No POC.
Head f417cda1e. I read packages/workforce/src/messages/call.ts, queue.ts, message-tool.ts, message-received-entry.ts, packages/core/src/blocks/wait-on-request.ts, dispatcher.ts (sendAndWait), packages/orchestration/src/tasks/helpers/wait-on-task.ts, packages/shift-manager/src/components/ToolLine.tsx, surfaces/Messages.tsx, packages/engine/src/durability/wait-chain.ts, execution/runAction.ts, and goals/shift-manager/workers-message-each-other/legs-calls.mts against act / talk.
waitOnRequestis the shared park, andsendAndWaitalready calls it. A held message stays onparkOnWait: it binds to a task row and has to see a stop (recorded on this PR).checkWaitis getTask's four checks with this tool's sentences ("Nothing was sent") and a request binding. Those checks inwait-on-task.tsare private and sit among the task refusals. A shared helper still carries both sentences and both bindings. The step claim is already shared:fsd.wait.step:throughtoolCallOf, which this PR only exports.awaitReplyis the follow: the dispatch request, thentakenBy, thendeliveredAs, at most five. The no-target read is wait-again's first step. Pulling it out of the loop repeats the ended/target checks.endedReasonandreplyOfhave one caller; inlining drops the name.actingRequesthas two.- The tool's four refusals belong to one strict object, so
callIdcan omittoandtext. A union replaces the strings the model reads.callAnsweris the two call sites. replyTextOfaccepts a string or{ reply }.replyOfaccepts{ reply }and returns undefined when it is absent.isHeard's extraactcheck is the predicate besidesafeParse.ToolLine's label is six phrases.callOutcomeLinehas one caller; inlining drops the name.callNotereads the row (waiting, waiting on the user, answered, answered late). The tool line reads the tool output.talkThroughpolls until the request ends and records when it leftsuspended.actreturns on the first status outsideRUNNING, which is the park. A flag onactstill leaves that record.- The headers in
call.tsandqueue.tsrestate the functions under them. Cutting them shortens the comment. The checks, the follow, and the two parks stay the same length. - The changeset, the README, and the docs page each stand on their own. The goal legs and the unit tests read different things.
Left as recorded: park on takenBy then deliveredAs; queuedBehind: "user"; rowsInSession and hasOpenHold; call: / queue: gates; parkOnWait for a held message; recipient: "waiting_on_person".
One prose mismatch, same length: .changeset/a-worker-calls-another.md still says queuedBehind: "person". The row writes "user".
Sent by Cursor Automation: Code Snob
…all; userStop (FIX-2239) - checkWaitable is the shared ladder (host, bounds, depth, step); the step is claimed after the depth check. - The reply step reads whether a message landed from request state. - RequestHost.waits.personStop is userStop, as the vocabulary check says. - The tool says a reply is cut to 8,000 characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
|
Triage of the second-look review, as of fa03d24. Each point either changed the code or has a reason it didn't.
Package suites: core, engine, orchestration and workforce all pass. Retired-terms passes, and new-dead-code passes. The goal's legs 10, 10b and 10c passed in 3 of 3 real-model runs on f6536df and f417cda. The controls are still running. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa03d24170
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (target === undefined) { | ||
| const next = await read(round); | ||
| if ("ended" in next && next.ended !== undefined) return { status: "failed", callId: id, error: next.ended }; | ||
| if (!("target" in next) || next.target === undefined) return running(); |
There was a problem hiding this comment.
Keep waiting while the initial delivery is being retried
When the initial dispatch throws or receives a retryable refusal before the recipient takes the message, sendMessage preserves the unconfirmed row for redelivery and returns success without a requestId. This branch then returns running immediately, even with time remaining before the deadline. Consequently, a transient delivery failure that recovers within the requested deadline prevents the caller from receiving the reply in its current turn; waiting again before redelivery also returns immediately. Keep the call parked or rechecking until an acting request exists or the deadline expires.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this one. It's a deliberate edge.
- No binding to park on. With no acting request, a wait gate binds to a request or a task row, and a message row is neither. A deadline-only recheck would need a new kind of gate in core.
- The resend is slower than most calls. It comes from the sending session's pass, at
NOTICE_DUE_MSplus backoff. Most call deadlines would pass before it arrives. - The case is rare. Only a thrown dispatch or
dispatch-rejected,no-dispatch-operationorflow-not-foundleaves the row unconfirmed. A busy recipient is accepted and deferred, so it gets arequestId. - Nothing is lost. The call answers
runningwith itscallId, the reply is kept on the row, andsendMessage({ callId })waits on the taker once the resend has one. DECISIONS already drops leaning on the resend timer for the same reason ("a call would have no request to wait on meanwhile").
If this turns out to matter, the right shape is a gate bound to the message row, as a follow-up.
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
…can hold a wait; goal verdict for legs 10-10c (FIX-2239) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
|
Resolve conflicts |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB
|
I resolved the conflict in 851acb3. The only conflict was the verdict log in Generated by Claude Code |


Requested by Jake · project thread
Implements the merged spec specs/issues/FIX-2239, a child of epic FIX-2070.
Base is main. #4008 (FIX-2240), which this was stacked on, has merged. Main is merged in, and the diff is FIX-2239's work only.
What changes
sendMessage({ to, text, wait: true, deadline? })returns the reply as the tool's result in the same turn{ status: "running", callId }at the deadline. Nothing is stopped and the reply is kept.sendMessage({ callId })waits again: it sends nothing, writes no row and pays no budgetqueuedBehind: "user", and a call'srunninganswer saysrecipient: "waiting_on_person"waitOnRequestis the park half ofdispatcher({ wait: true }), now exported and shared. The dispatcher uses it with its old plan key, so in-flight replays still match.RequestHost.waits.userStop()returns the session's request that is parked for the user.userStopis backed by the suspension listing andisUserSuspension.{ requestId }gates in its own session.checkWaitableis the one wait check, shared bygetTask({ wait })and a call. It runs the host guard (canHoldWait), then the deadline bounds, then depth, and claims the step (wait_already_pending) last, so a refusal leaves no claim behind.toolCallOf.messages/call.tsrunscheckWaitablebefore anything is written. It then sends underrunOnceand follows the acting request: dispatch, thentakenBy, thendeliveredAs.messages/queue.tsholds the entry's admission, between FIX-2240's take and the items, and only on a host that can hold a wait.repliedAt.Cross-spec points (Jake approved), and changes made while building
takenByuntil the message is delivered, then ondeliveredAs.queuedBehindreplacesheldBy. Its value is"user", not"person". The pre-push vocabulary check retires "person" where it means the signed-in user, sopersonStopis nowuserStoptoo.recipient: "waiting_on_person"stays as epic D3 locked it.rowsInSessionandhasOpenHold.call:/fsd.call.*, andqueue:/fsd.queue.*for a held message.parkOnWaitdirectly, because it also binds to a task row.getTask's are now one function, which claims the step last.The build changes are amended into
specs/issues/FIX-2239/DECISIONS.md.One Codex point is declined, with reasons on its thread. A call whose first dispatch fails transiently answers
runninginstead of polling for the resend. There is no request or task row to bind a gate to, and the resend timer outlasts most deadlines.Evidence
packages/core/test/wait-on-request.test.ts(5).packages/engine/test/wait-own-session.test.ts(4): the own-session resume works; a plain request end lists nothing; other gates are left alone;userStopscope is checked.packages/workforce/test/worker-calls.test.ts:wait_unavailablewrites no row;no_such_callare refused;wait_too_deepis refused at 6, and the refusal leaves no step claim. That last check was red before the claim moved last.packages/workforce/test/message-queue.test.ts(4): a question hold; no hold; a host without a sweeper doesn't park (red without thecanHoldWaitguard); the user's stop; depth 6.goals/shift-manager/workers-message-each-other, legs 10, 10b and 10c on real models (workersopenai/gpt-5.4-mini, coordinatoranthropic/claude-haiku-5-5):no-person-hold: 10b:queuedignore-deadline: 10b:queuedno-default-deadline: 10:default-deadlinesend-again: 10b:keptrelay-the-call: 10:no-second-lineno-step-guard: 10c:one-wait-per-stepgoal.md.No changeset for
shift-manager(an app). The changesets area-worker-calls-another.md(workforce),wait-on-a-request.md(core, engine) andexport-tool-call-of.md(orchestration).🤖 Generated with Claude Code
https://claude.ai/code/session_01NczDiDJDLpHhanaY6z9YCB