Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4eb29cb
refactor(workforce): rename worker messages to sendMessage and onMess…
claude Oct 27, 2026
86f9091
feat(workforce): a received message is its own item, and nothing is r…
claude Oct 27, 2026
f201a3e
FIX-2238: landing rules, task-sessions refusal and one budget
claude Oct 27, 2026
9413821
FIX-2238: every worker flow on an installation hears a message
claude Oct 27, 2026
1feba42
FIX-2238: docs, changeset, goal amended, epic seams updated
claude Oct 27, 2026
b03e4fe
Merge main into FIX-2238; review fixes
claude Oct 27, 2026
acdd330
FIX-2238: one chain for a task filed held; drop the dead messaged-wor…
claude Oct 27, 2026
752d290
FIX-2238: a received message's budget is what its chain has left
claude Oct 27, 2026
367eb69
FIX-2238: an answer reaches a worker that hears only in its tasks' se…
claude Oct 27, 2026
5d7ca95
FIX-2238 goal: the ring's own hand-offs aren't stray rows; the herald…
claude Oct 27, 2026
bfbae4c
FIX-2238 goal: 3:budget-left grades what the chain had left when heard
claude Oct 27, 2026
0e91fad
FIX-2238 follow-up: a fresh budget for a task held before it starts, …
claude Oct 28, 2026
0232b15
Merge the merged FIX-2238 branch history (no changes): the follow-up …
claude Oct 28, 2026
570849b
FIX-2238 follow-up: read a finished task session the way the steer ro…
claude Oct 28, 2026
d9d39a5
goal(FIX-2238): the goal's text for sendMessage, and its verdict
claude Oct 28, 2026
c14d50c
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Oct 28, 2026
5bb75da
goal(FIX-2238): leg 6's one failure was the goal's timing, fixed in #…
claude Oct 28, 2026
cccdd43
Merge branch 'main' into claude/project-thread-n6abql
jhoffner Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge main into FIX-2238; review fixes
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
  • Loading branch information
claude committed Oct 27, 2026
commit b03e4fef0b820a810dba2323968b905684c238b0
3 changes: 2 additions & 1 deletion goals/shift-manager/workers-message-each-other/legs.mts
Original file line number Diff line number Diff line change
Expand Up @@ -574,10 +574,11 @@ export async function leg2b(world: World): Promise<LegResult> {
alice,
RESEARCHER,
researcher,
`Message ${HELPER_A} asking what its favourite number is, and wait for its answer before you reply to me. Use the tool's wait option if it has one.`,
`Send ${HELPER_A} a message with sendMessage (not a task) asking what its favourite number is, and wait for its answer before you reply to me. Use sendMessage's wait option if it has one.`,
);
if (turn.status !== "completed") r.failures.push(`2b:turn-ends — the turn ${turn.status}: ${turn.reply.slice(0, 200)}`);
// Not waiting only counts if a message went out: a turn with no message tool never waits either.
// A task it files and waits on is a different tool's wait, so the leg names sendMessage.
if (sentIn(turn.calls).length === 0) r.failures.push(`2b:sent — Researcher's turn sent Helper A no message: ${turn.reply.slice(0, 200)}`);
const waited = turn.calls.filter((c) => Object.hasOwn(c.args, "wait") && typeof c.output?.sent === "string");
if (waited.length > 0) r.failures.push(`2b:no-wait — a sendMessage call naming \`wait\` was taken: ${show(waited.map((c) => c.args))}`);
Expand Down
2 changes: 1 addition & 1 deletion goals/workforce-coordination/runs-on-one-task/goal.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
**Signal:** each failure is tagged `<leg>:<assertion>`, and each assertion is **structural** or **judgment** (`TAGS` in `run.mts`, printed with every failure; D1).

- **a**, the concept's walk less the call and the Inbox: `a:routed-listed` launch's routed task for writer is in Alice's list; `a:files-research` writer files researcher's task; `a:ends-running` writer's task stays running past its first request and its research; `a:one-settled` one `onTaskSettled` per research ending starts writer again; `a:step-dispatched` writer files its fact-check as a step in a session of its own; `a:drain-waits` the task ends after that step; `a:answers-after-steps` writer gets a turn after the step ends; `a:lands-once` the draft lands once, under writer's name; `a:draft-content` with the held-out word and researcher's fact; `a:follow-up` Alice's follow-up from the finished task runs in its session and is answered by a turn of writer's after it was filed; `a:follow-up-differs` (judgment) that turn writes a new version, not the original word for word (when it does, the two lines read alike and are told apart by when each landed); `a:original-unchanged` the original reads byte-identical; `a:once` every ending reaches its filer once.
- **j1** (a team that hands out work): `j1:routed` (structural) launch routed Alice's message to editor, `j1:files` (judgment) editor filed for researcher, `j1:waits-in-request` editor reads the research's ending with `getTask` in the same request, `j1:read-once` and so no notice turn runs for it (an `onTaskSettled` request that finds the notice no longer owed, output `{ owed: false }`, runs no turn and isn't counted), `j1:heard-once` the ending is heard exactly once, by that read, `j1:answer`, `j1:tools` no task turn is offered a tool beyond the allow list and the roster's own two (`listDelegates`, `messageWorker`), whatever it is called, `j1:once`.
- **j1** (a team that hands out work): `j1:routed` (structural) launch routed Alice's message to editor, `j1:files` (judgment) editor filed for researcher, `j1:waits-in-request` editor reads the research's ending with `getTask` in the same request, `j1:read-once` and so no notice turn runs for it (an `onTaskSettled` request that finds the notice no longer owed, output `{ owed: false }`, runs no turn and isn't counted), `j1:heard-once` the ending is heard exactly once, by that read, `j1:answer`, `j1:tools` no task turn is offered a tool beyond the allow list and the roster's own two (`listDelegates`, `sendMessage`), whatever it is called, `j1:once`.
- **j2** (a team that runs a coordinator): `j2:steered` Alice's steer of an open routed task is taken, `j2:steer-shows` the draft carries the steer word, `j2:cancelled` her cancel of another ends it, `j2:cancel-heard-once` launch's session hears it once and no line lands.
- **b**: `b:routed` (structural), `b:files-research` (judgment) writer filed research before the kill; `b:killed` the server dies after researcher's ending is written and before it is sent (FIX-2078's kill point, reused); `b:hears-in-due-time` after a restart with no touch, writer hears it within its window; `b:once`. The window depends on where the kill caught writer's filing request, read from that request's record in the store the dead server left (the research row's `filer.requestId`), never from timing. If the request had ended or parked, the window is the due time plus 2 s, the common case. If it still read `in_progress` (killed mid-turn), the notice is held until the request is known gone: its heartbeat stale past the stale threshold, or the stale or startup sweep marking it interrupted (FIX-2166). With the defaults (10 s heartbeat, 60 s threshold, 30 s sweep) that is about 50 to 92 s after the kill, so the window is the due time plus 100 s. This minute-scale bound is the owner's decision of 2026-10-24; a seconds-scale one is FIX-2169's. A hearing outside either window still fails, structurally. The run prints which case each attempt hit.
- **c**: researcher's model refuses every call. `c:routed` (structural), `c:files-dependent` (judgment), `c:fails-out`, `c:dependent-cancelled`, `c:one-failure-notice` writer hears one failure notice naming the dependent it cancelled, and none for the dependent; `c:writer-ends` (structural) writer's task ends, not left open; `c:once` its one line lands.
Expand Down
6 changes: 3 additions & 3 deletions packages/workforce/src/messages/message-received-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ export function messageHearingOf(flow: unknown): MessageHearing | "anywhere" | u
* takes `{ messageId }`. The hire's check, beside `respond`'s.
*
* @param name The worker flow's name, for the sentence.
* @param internal The flow's internal actions.
* @param flow The worker flow's definition.
*/
export function messageReceivedProblem(name: string, internal: Readonly<Record<string, unknown>> | undefined): string | undefined {
const entry = internal?.[MESSAGE_RECEIVED_ENTRY] as { inputSchema?: { safeParse?: (v: unknown) => { success: boolean } } } | undefined;
export function messageReceivedProblem(name: string, flow: unknown): string | undefined {
const entry = internalActionsOf(flow)?.[MESSAGE_RECEIVED_ENTRY] as { inputSchema?: { safeParse?: (v: unknown) => { success: boolean } } } | undefined;
const fix =
`Build it with \`messageReceivedEntry\`: \`internal: { actions: { ${MESSAGE_RECEIVED_ENTRY}: messageReceivedEntry({ installation, flowKind }) } }\`, ` +
"or spread the session kit's `board.entries(turn)`.";
Expand Down
10 changes: 5 additions & 5 deletions packages/workforce/src/messages/send-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ export async function sendMessage(
`budget: this would be message ${hop} since the user's last line, and the budget is ${limits.hopLimit}. ` +
"Nothing was sent. Stop passing messages on, and say that you stopped; the next line from the user lets the workers go on."
);
/** The place a send takes in a chain that already holds `sent`. */
const placeAfter = (sent: number) => Math.max(floor, sent + 1);
const known = turnChainOf(ctx);
const counted = known === undefined ? 0 : ((await chains.getOptional(known))?.state.sent.length ?? 0);
if (Math.max(floor, counted + 1) > limits.hopLimit) return budgetRefusal(Math.max(floor, counted + 1));
const atomicRequest = (mutator: (s: Readonly<Record<string, unknown>>) => Record<string, unknown>) => ctx.request.atomicState(mutator as never);
const reserved = await withOutcome(atomicRequest, (current: Readonly<Record<string, unknown>>) => {
const sent = typeof current[TURN_SENT_STATE] === "number" ? (current[TURN_SENT_STATE] as number) : 0;
Expand All @@ -200,17 +200,17 @@ export async function sendMessage(
const id = newMessageId();
const chainRow = await chains.getOrCreate(chain, { sent: [] });
await chainRow.updateState((row) =>
Math.max(floor, row.sent.length + 1) > limits.hopLimit ? row : { ...row, sent: [...row.sent, id] }
placeAfter(row.sent.length) > limits.hopLimit ? row : { ...row, sent: [...row.sent, id] }
);
const place = chainRow.state.sent.indexOf(id);
if (place < 0) {
await atomicRequest((current) => {
const sent = typeof current[TURN_SENT_STATE] === "number" ? (current[TURN_SENT_STATE] as number) : 1;
return { [TURN_SENT_STATE]: Math.max(0, sent - 1) };
});
return budgetRefusal(Math.max(floor, chainRow.state.sent.length + 1));
return budgetRefusal(placeAfter(chainRow.state.sent.length));
}
const hop = Math.max(floor, place + 1);
const hop = placeAfter(place);
await atomicRequest((current) => {
const messaged = Array.isArray(current[TURN_MESSAGED_STATE]) ? (current[TURN_MESSAGED_STATE] as string[]) : [];
return { [TURN_MESSAGED_STATE]: [...messaged, input.to] };
Expand Down
2 changes: 1 addition & 1 deletion packages/workforce/src/workers/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function hireWorkforce(installation: WorkerInstallation, options: HireWor
// hears one (FIX-2238): checked as the door is, before anything registers.
const deaf = Object.entries(installation.workerFlows())
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
.map(([flowName, { flow }]) => messageReceivedProblem(flowName, (flow as { internal?: { actions?: Readonly<Record<string, unknown>> } }).internal?.actions))
.map(([flowName, { flow }]) => messageReceivedProblem(flowName, flow))
.filter((problem): problem is string => problem !== undefined);
if (deaf.length > 0) {
throw new Error(`hireWorkforce refused ${deaf.length} worker flow(s); nothing was registered:\n` + deaf.map((problem) => ` - ${problem}`).join("\n"));
Expand Down
2 changes: 1 addition & 1 deletion specs/epics/FIX-2070/DECISIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ A *uses* cell is a place a child must not re-decide.
| Seam | Owner, then who else touches it |
|---|---|
| The send path (`workforce/src/messages/send-message.ts`) | FIX-2238 rebuilds it for `sendMessage` and the landing rules. FIX-2160 adds target resolution before the limits; FIX-2239 adds the wait after the dispatch; FIX-2240 replaces the two tries with the wake. FIX-2238 moves the hop count onto the budget. Their specs run in parallel on FIX-2238's merge; their implementation PRs land in a fixed order, FIX-2238, then FIX-2160, then FIX-2240, then FIX-2239, then FIX-2241's Workforce send, each stacked on the one before (GitHub stacks), so no two rebase over each other |
| The message row (`workforce/src/messages/log-row.ts`, pinned pattern `workforce/messages/*`) | FIX-2238 renames `replyTo` to `inReplyTo` on the row and drops `answerTo`. FIX-2160 adds the target kind as `addressedBy` (`task` or `session`; absent for a worker's name) and the task id `toTask`. Stores are reset between the refactor epics, so no old row is read (as FIX-2058's ER-5). FIX-2240 adds the wake's due state and the id of the request a delivery became (`deliveredAs`); FIX-2239 reads that id to find a late result, and adds `queuedBehind` for a message waiting behind a person |
| The message row (`workforce/src/messages/log-row.ts`, pinned pattern `workforce/messages/*`) | FIX-2238 renames `replyTo` to `inReplyTo` on the row and drops `answerTo`. FIX-2160 adds the target kind as `addressedBy` (`task` or `session`; absent for a worker's name) and the task id `toTask`. Stores are reset between the refactor epics, so no old row is read (as FIX-2058's ER-5). FIX-2240 adds the delivery's take and resend record (`takenBy`, `deliveredAs`, `resent`, `toldAt`, `toState`; the owed ids live in the sending session's state and the next send in the pass's request state, [FIX-2240](../../issues/FIX-2240/DECISIONS.md#decided-not-asked)); FIX-2239 reads `deliveredAs` to find a late result |
| The session factory (`workforce/src/conversation-board/session-board.ts`) and the roles table (`workforce/src/worker-roles.ts`) | FIX-2238 spreads `onMessageReceived` into every worker flow and adds it to every worker's entries. No other child adds an entry |
| The question message (`orchestration`'s midway ask, FIX-2133's hold write) | FIX-2241 sends from the task's session after the hold is written, through `sendMessage`'s server path, never the model tool. The hold stays the record and the Inbox stays the answer's home (PR-3) |
| Shift Manager's conversation and Messages view (`shift-manager/src/`) | FIX-2238 draws a received message as its own item; FIX-2240 changes the Messages view's statuses (its fourth, `undeliverable`); FIX-2239 shows a call waiting; nothing else changes the view |
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.