Skip to content

feat(workforce): a worker message lands once (FIX-2240) - #4008

Merged
jhoffner merged 59 commits into
mainfrom
claude/project-thread-3uc91a
Oct 28, 2026
Merged

jhoffner merged 59 commits into
mainfrom
claude/project-thread-3uc91a

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake. Implements the merged spec specs/issues/FIX-2240 (#3999).

Based on main. FIX-2238 (#4010) and FIX-2160 (#4012) have landed, so this diff is FIX-2240's work only. FIX-2239 stacks on it. Goal leg 9 (real model) is still owed.

What changes

Someone who… Before After
sends a message whose dispatch throws Two tries, then unconfirmed and nothing more The tool answers { sent }, and the sending session's board pass sends it again until it lands
messages a worker whose host accepts the dispatch but never runs it The row says delivered, and the message is lost The row stays unconfirmed until the recipient's onMessageReceived takes it, and is sent again until then
gets a late copy Heard twice once 500 other ids have passed Heard once: the take lives on the row
sent a message to a worker fired before it landed unconfirmed forever refused (final), and the sending session gets a line its next turn reads
  • The send (messages/send-message.ts) owes the session's pass a wake (DISPATCH_ENTRY, NOTICE_DUE_MS), puts the id on an owed list in session state beside the sending request's id, writes the row (now with toState), and dispatches once. A final refusal ends the row refused, told by the tool's answer. Anything else leaves it unconfirmed. A flow that carries no pass sends on the fast path only, and owes nothing.
  • The take (messages/delivery.ts → takeMessage, markDelivered) is FIX-2123's take on the message row. It uses orchestration's decideTake (own, busy, or take over from a taker that ended), then the items, then delivered / deliveredAs / deliveredAt, then the turn. delivered (and a sender's toldAt) is written only after the items are stored: the entry awaits its emitters and flushes the request's items first. The session's 500-id window is gone.
  • The pass's message step (payMessageDebts) runs in the board pass's first half, outside the files branch. Its next due time is folded into the settle (passMessagesDue, beside passPlanDue). It drops an id that has landed or ended and been told, and drops an id with no row once its sending request has ended. It ends a never-taken message undeliverable past maxDebtAgeMs. A taken one is never ended for its age, unless its destination is gone for good (a recheck refusal, or a final dispatch refusal). It re-checks the recipient (recheckRecipient: the roster, or a task's or conversation's record, refusing task_moved when a task is now worked in another session; an answer keeps its exception), then resends with the notice backoff, and records resent. Retryable refusals: a throw, dispatch-rejected, no-dispatch-operation, flow-not-found. Every other refusal is final.
  • Orchestration exports the take rule (takeRule, decideTake, hasEnded) and the backoff (nextResendAt, NOTICE_RESEND_CAP_MS). The notice take and the notice pass now call them.
  • Core / engine: two internal context hooks, _emitMessageAwaited and _flushItems, so the entry can wait for its items to be stored.
  • Repeat-safe send: sendMessage(…, from, { id }). When that row already exists, a repeat writes nothing and pays nothing, and answers as the row reads: an ended row stays not_delivered. FIX-2241 uses it.
  • Shift Manager: Messages shows on its way and couldn't be delivered. The tool line drops its "not confirmed" warning.
  • Docs: a Delivery section in messaging-workers.md, the Messages row in shift-manager/overview.md, and the Worker messages section of the workforce README.
  • Changeset: a-message-lands-once.md (workforce and orchestration, minor).

Seams from the cross-spec review, folded in

  1. Server-sent messages from a session with no pass go out on the fast path only, and never get D1's line. Jake accepted this loss window. I didn't add a hire-time check: whether a flow offers sendMessage can't be read from its definition. The Error Reporter still doesn't mount its board's entries, so its sends are fast-path only. That's a follow-up for the reporter's owner.
  2. The entry's order: take, then items, then delivered, then the turn. FIX-2239's hold goes between the take and the items. A taken row backs off at the cap and is never marked undeliverable while it is taken.
  3. Repeat-safe server id, as above.

All three are recorded in specs/issues/FIX-2240/DECISIONS.md → "Amendments while building".

Evidence

  • packages/workforce/test/worker-messages-delivery.test.ts (durable host, the real sweeper). Covers: a fast path that throws is resent and heard once; a host that accepts nothing stays owed and lands later; an accepted dispatch never taken is resent; a final refusal is told and never resent; a late copy runs nothing; a take-over from an ended taker; a taker that died after the take and before the items is sent again; delivered is written only after the items are flushed; a fired recipient is refused and told with one line; the age limit; a taken message whose destination is gone ends past the age; a repeat-safe id holds one row and one budget place, and a repeat of a refused send stays refused.
  • worker-messages.test.ts (a resent answer keeps its exception) and worker-messages-recheck.test.ts (a resend to a reassigned task is refused).
  • Each control was applied to the code and failed its test: no-debt (5 fail), accept-clears (3), no-recheck (1), take-is-final (1), no early return for the repeat id (1), delivered-at-the-take (1), no flush barrier (1), and one for each review fix.
  • packages/orchestration/test/tasks/delivery-rules.test.ts, plus the notice suites (70 pass). A take rule that never takes over fails 6 of them.
  • Not run yet: goal leg 9 (real model, fault injection).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg

claude added 19 commits October 27, 2026 21:15
…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
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
… 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
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Oct 27, 2026 11:53pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 27, 2026 11:53pm UTC
flow-state-dev-ui Ignored Ignored Preview Oct 27, 2026 11:53pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

FIX-2240

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
… close (FIX-2240)

Folds the Code Snob POC (#4018): a refusal past the age closes once with
force, and takeMessage returns the row it took.

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

# Conflicts:
#	packages/workforce/src/messages/message-received-entry.ts
#	packages/workforce/src/messages/message-tool.ts

Copy link
Copy Markdown
Collaborator Author

Code Snob (#4018): I applied the substance of 7c297b920 here by hand rather than cherry-picking it. The POC's parent c748982 predates two later commits on this head, the delivered-after-stored barrier and the close step, so a cherry-pick wouldn't apply cleanly.

  • End, line, drop. This was already one close(...) step from the previous push.
  • Refusal close. A refusal is now closed with a single call, close(..., pastAge), which passes force only once the row is past the age. The second, stricter write is gone.
  • takeMessage. It returns the row it took, or undefined. MessageTake is removed.
  • Left as they are. The RecheckRecipient alias, because it names the board's injected check in session-board.ts. The file header, because BP-007 requires one.

All 55 message tests pass. #4018 can be closed unmerged.


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Snob. Already tight on 00fef9e4d.

The smaller shape is already on this head. 0776b4030 made close the one end, line, and drop. 18268d263 folded the rest of the code cut: one refusal close (force: pastAge), and takeMessage returns the row. Do not fold 7c297b920, dadd483e4, or 391958643. Those parents are behind this head. Close #4018 unmerged. Do not merge it.

Read: packages/workforce/src/messages/delivery.ts, message-received-entry.ts, send-message.ts, packages/workforce/src/conversation-board/board.ts, packages/orchestration/src/tasks/helpers/request-states.ts, packages/orchestration/src/tasks/notice/task-notice.ts, task-settled-entry.ts, pass.ts.

A further rewrite does not shrink the contract:

  • close is the four end-tell-drop sites. The refusal past the age is that one call with force.
  • takeMessage returns the row. The false arm had no reason, and it is gone.
  • storedEmitters is the wait before delivered and toldAt.
  • owedOf parses the list and skips an entry that does not.
  • decideTake, takeRule, and nextResendAt are the shared pieces. The notice path calls them too.
  • The send's final refusal is told by the tool (told: true). The pass leaves the line. A shared settler needs a callback and ties.
  • oweMessage's wake is the same try as owePass. Importing the board into messages to share four lines is a worse dependency.
  • passMessagesDue is the message due beside the plan's. The settle takes the earliest.
  • RecheckRecipient is the parameter type of payMessageDebts. The file header and the payMessageDebts comment restate the functions. Cutting those shortens the comment. It does not shrink the contract.

Left as recorded: the take rule and the backoff stay in orchestration, a flow with no pass stays fast-path only, D1's line, toldAt, force over a take when the recipient is gone past the age.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00fef9e4df

ℹ️ 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".

A { session } message can reach another conversation of the same worker,
so its answer by name (to: the same worker, inReplyTo) now goes through,
back to the conversation that asked. An answer to a message from the
answering session itself is still refused not_yourself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiD7QxMPGxa4XV4dZEF
…(FIX-2240)

recheckRecipient re-ran a by-name check without inReplyTo, so a reply to a
worker that hears only in its tasks' sessions was refused for good on its
first resend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
@jhoffner jhoffner changed the title feat(workforce): a worker message lands once (FIX-2240) feat(workforce): a worker message lands once (FIX-2240, stacked on FIX-2160 and FIX-2238) Oct 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 594fd76a9a

ℹ️ 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".

…he age (FIX-2240)

A final dispatch refusal on a resend now forces the end once the row is past
maxDebtAgeMs, as a recheck refusal does, so a reply whose session was deleted
after a take stops being resent and its sender is told.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b5466b284

ℹ️ 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".

…240)

A send repeated under its server-chosen id now answers as the row reads, so a
row that ended refused or undeliverable stays not_delivered instead of {ok}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3aecb45dd0

ℹ️ 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".

Comment on lines +119 to +122
row.addressedBy === "task" && row.toTask !== undefined
? await checkTaskTarget(ctx, installation, row.toTask)
: await checkTargetSession(ctx, installation, row.toSession, { session: true });
return checked.ok ? undefined : checked.error;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recheck the destination actually stored on a task message

If the first dispatch fails and the task is retried and reassigned from worker A to worker B before the resend, checkTaskTarget validates B's current session, but dispatchMessage still dispatches to A's stored row.toSession and row.toFlow. Consequently, even firing A does not stop the resend from reaching A's old session: the recipient recheck now checks B instead. Task reassignment creates a different session (conversation-board/board.ts, taskSessionKey), so validate the pinned recipient/session or explicitly reconcile the stored address with the checked target before dispatching.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5efdc4d. recheckRecipient now compares the checked target's session with row.toSession. If the task has moved to another session, the recheck refuses with task_moved: the row ends refused and the sender is told. We don't re-address it to B, because a message written for A's run shouldn't silently reach a different worker. The sender can send it again. New test: worker-messages-recheck.test.ts. Without the comparison it fails.


Generated by Claude Code

Comment on lines +310 to +311
if (isFinalRefusal(outcome.refused) && (await endMessage(ref, "refused", reason, { told: true }))) {
if (resends) await dropOwed(ctx, [id]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Record the initial refusal notification only after it is stored

On a persistent host, a crash after this terminal write but before the tool output is persisted leaves the sender permanently untold. { told: true } records toldAt before sendMessage even returns, and the next line removes the owed pointer. Even if the pointer survives the crash, payMessageDebts skips notification for rows that already have toldAt. Keep the refusal notification owed until its tool output is durable, or persist a sender notification before marking it told, as the late-refusal path does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. It's a recorded decision: the send's own final refusal is told by the tool's answer (told: true), and only a refusal after the send returned gets D1's line. To close this window, every send-time refusal would also need a stored line in the session. The model would then read every such refusal twice, once in the tool output and once as a line. The window itself is a crash after the row's end and before the tool output is stored. That crash also loses the sending turn, and the turn is what would have acted on the answer. I'm leaving it as it is.


Generated by Claude Code

Base automatically changed from claude/project-thread-i68jr1 to main October 27, 2026 23:44
…ns (FIX-2240)

recheckRecipient checked the task as it reads now, but the resend goes to the
session on the row. A reassigned task is worked in another session, so the
recheck now refuses task_moved instead of passing on the new session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiDFT9s67hk1haKhCfg
@jhoffner

Copy link
Copy Markdown
Collaborator Author

Architect: not approving yet. Two fresh Codex P2s on packages/workforce/src/messages/send-message.ts look real and go to the heart of "a message lands once": the resend at :122 rechecks the task's current assignee but still dispatches to the stored row.toSession/row.toFlow, so a reassigned task can resend to the old worker; and :311 marks the refusal told before the tool output is durable, so a crash leaves the sender untold for good. The branch also has merge conflicts with main. Unblock: fix or answer both P2 threads (check the pinned recipient session before resend; keep the refusal notice owed until it's stored), resolve the conflicts, and get CI green.

— FSD Architect

@jhoffner jhoffner changed the title feat(workforce): a worker message lands once (FIX-2240, stacked on FIX-2160 and FIX-2238) feat(workforce): a worker message lands once (FIX-2240) Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

For the Architect's note:


Generated by Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eec5d61923

ℹ️ 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".

context._emitComponentAwaited = createEmitComponentAwaited(activeEmCtx);
context._emitMessageAwaited = createEmitMessageAwaited(activeEmCtx);
// The barrier after an awaited emission: its item is in the request store.
context._flushItems = () => stores.request.flushItems(activeEmCtx.requestId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate item-write failures through the durability barrier

On the filesystem adapter, an item-write failure can still leave a message marked delivered without durable received items. The fresh evidence beyond the earlier ordering finding is that FilesystemRequestStore.flushItems only drains its queue, while createSerializedWriteQueue catches write failures and resolves its drain waiters; the item queue's error callback logs rather than rethrows. Consequently, this new barrier resolves even after persistence fails, allowing markDelivered or tellSender to record delivered or toldAt. A crash before the request's final items write then permanently loses the message or notification because subsequent passes trust those markers. Make the barrier propagate item-persistence failures before treating its completion as proof of storage.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Fixed in 6123c83, at the store rather than in the barrier. The filesystem request store now records an item write's error and rethrows it from flushItems, the same way flushEvents already does and the Postgres store's flush already rejects. With that, a failed write makes the entry throw before markDelivered or toldAt is written. The row stays taken, and the pass's resend takes it over once that request has ended. New test in persist-error-observable.test.ts: a failed item write rejects flushItems once and is reported. Without the recorded error it fails. The full engine suite passes (4104), and an engine patch line is added to the changeset.


Generated by Claude Code

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants