Skip to content

FIX-2156: a delegate a worker can message still takes its tasks - #4262

Merged
jhoffner merged 5 commits into
mainfrom
claude/project-thread-ijok0y
Oct 30, 2026
Merged

jhoffner merged 5 commits into
mainfrom
claude/project-thread-ijok0y

Conversation

@jhoffner

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

What broke

FIX-2152's closure re-run on main 863a0e13 found a regression in the default prompt layer added by FIX-2334 (#4223). The layer lists a worker's messageable delegates only as teammates you can message, and it never says they take tasks.

  • Claude Code-style lab, session mode: the main session sent both research pieces to desk.researcher with sendMessage and filed no task. No row showed, so nothing could be stopped. It failed 0 of 6 attempts over two runs. With the layer patched out (the goal's module-patch hook), the same run passed on attempt 1.
  • Teammates lab, identity goal leg 2: on the lab's new default gpt-6-luna, Chief of Staff looked its teammates up with listDelegates in 3 of 3 runs (1 of 3 on gpt-5.4-mini).

The change

In packages/workforce/src/messages/worker-identity.ts:

  • A teammate that is also the worker's delegate is marked (your delegate: takes your tasks too).
  • When a worker has one, one line follows: a message to a delegate is for a quick question, and a piece of work goes as a task with createTask.
  • The teammates list now says it is current, so no tool call is needed.

The contract line in docs/architecture/workforce-default-worker-flow.md and the still-unreleased FIX-2334 changeset are updated to match.

Evidence

Check On main 863a0e1 With this change
worker-identity.test.ts (new test) red (delegate mark missing) green; workforce suite 1717/1717, tsc clean
CC-style session mode FAIL 0/6 (no task filed) PASS attempt 1, twice
↳ control answer-again-off nothing gradable FAIL signal 4 only, as required
CC-style threads mode PASS PASS attempt 1
Teammates identity (gpt-6-luna) FAIL leg 2, 3/3 PASS 5/5
↳ control no-identity FAIL as required FAIL as required
Teammates worker-talks steps 1–4 pass; step 5 tripped on wording, see below PASS steps 1–5

All of these ran with real models (gpt-5.4 / gpt-6-luna, plus Claude Code for the coding steps) in a headless browser. Verdict rows are added to the three goals' logs.

Note for review: on main, the worker-talks step 5 also failed once. Its "no project on the page" check matched Chief of Staff's own words "the current project", which is model wording and not a project the lab showed. The run on this change passed. If it flakes again, that check needs narrowing to the lab's project UI.

No Linear issue was filed for this finding yet, because the Linear write is blocked in this session. It is tracked under the closure issue FIX-2156 until one exists.


Generated by Claude Code

The closure re-run of FIX-2152 on main (863a0e1) found the default
prompt layer (FIX-2334) listing a worker's messageable delegates only as
teammates to message. The Claude Code-style lab's main session then sent
both research pieces to its researcher as messages and filed no task:
session mode failed 0 of 6 attempts, and passed on attempt 1 with the
layer patched out. The Teammates lab's Chief of Staff, on its new
default model, also looked its teammates up with listDelegates (3 of 3).

The layer now marks a messageable delegate as taking the worker's tasks,
adds one line that work for a delegate goes as a task, and says the
teammates list is current so no lookup is needed. Verdict rows for the
closure re-run go in the three goals it touched.

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

vercel Bot commented Oct 30, 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 30, 2026 9:28pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 30, 2026 9:28pm UTC
flow-state-dev-ui Ignored Ignored Preview Oct 30, 2026 9:28pm UTC

Request Review

@jhoffner jhoffner self-assigned this Oct 30, 2026
@linear-code

linear-code Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

FIX-2156

FIX-2334

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:30:14.372695Z 90b3d8b New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass (read-only review)

Verdict: the approach is right and small. Fixing the prompt (mark the delegate, say work goes as a task) is the leanest lever. Making sendMessage refuse work-shaped messages would be heavier and guess at intent. Two findings are worth acting on before merge. The rest are notes.

1. The "takes your tasks" mark can be false (worth fixing)

packages/workforce/src/messages/worker-identity.ts:54-58: isDelegate reads only me.delegates (the delegates: list). The framework's definition of a delegate is stricter. delegates/delegate-check.ts calls itself "the one delegate check" and requires the target's flow to declare contributor. flowTakes() and takesTasks() read that fact. worker-lookup.ts:102 rejects a non-contributor with "takes no tasks".

Failure case: a worker lists a messageable-only custom flow (no contributor) in delegates:.

  • The prompt marks it (your delegate: takes your tasks too) and the rule tells the model to createTask for it.
  • The board then refuses the filing.
  • Before this PR the wrong label only put a worker under "task only". Now it also sends a messageable worker down a path that errors.

The built-in agent flow is contributor, so the lab runs and the new test (default-flow eng.cy) all pass. None of them hit this case.

Suggested change: derive the mark from the existing fact, e.g. delegates includes id && flowTakes(installation, worker.flow) === "tasks". Add one test with a non-contributor flow listed in delegates:. This also stops the prompt from being a third hand-rolled copy of "is a delegate" (the prompt, delegate-check, worker-lookup). It is the one refactor this PR is a natural moment for. Don't go further and unify the check itself here.

2. Two behaviours in one change, only one has a unit test

The listDelegates fix ("it is current, so no tool call is needed", worker-identity.ts:70) is a separate model-behaviour change from the delegate mark and rule. The unit test pins only the mark and the rule. The wording that fixed gpt-6-luna leg 2 is guarded only by a live-model goal. Either pin it with one toContain on the "no tool call is needed" clause, or call out in the PR that it is covered by the goal only.

Related: the evidence table changes mark, rule and "current" wording together, so it can't show which one fixed the session-mode lab. That is fine for shipping. If the prompt grows again, run the lab with the rule alone to see whether the per-line mark earns its place.

3. Notes (no action needed)

  • With delegates: all, every teammate line gets the mark, so the mark is noise next to the rule. Acceptable for now. If it grows noisy, collapse to the rule only in that case.
  • DELEGATE_RULE hard-codes createTask. The existing comment covers the unsuffixed-name assumption, but it sits above isDelegate, not above the new constant. Move or copy it so the constant's caveat is next to it.
  • Test coupling: systemsOf(...)[0]!.split("Workers that take tasks only") depends on prompt copy that another change could reword. Splitting on the DELEGATE_RULE or TOOL_USE_RULE constant would be sturdier.
  • The answer-again-off control still fails on signal 4 only, as required. Good.
  • The worker-talks step 5 flake (the "no project on the page" check matching model wording) is correctly flagged. File the narrowing issue when Linear writes are available. Nothing to do in this PR.

No docs, changeset or BP-022/BP-034 gaps found. The changeset edit to the unreleased FIX-2334 fragment is the right call.


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: bfd90fabff

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

@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.

/simplify review (FIX-2156)

Verdict: approve. The failure mode is clear from the goal closure rows: a messageable delegate never appeared under "Workers that take tasks only," so models routed research-sized work through sendMessage and the board never got rows. Fixing that in the default identity layer matches FIX-2334 and workforce-default-worker-flow.md — this is "who you can reach and how," not a new board rule. The diff stays small (~25 lines of logic), tests are targeted, and I would expect a runtime-only or send-time heuristic fix to be more complex and brittle.

Did the approach go too far?

Mostly no. Two layers of prompt (inline DELEGATE_MARK + standalone DELEGATE_RULE) are slightly redundant with text that already exists elsewhere (createTask in the task-only block; sendMessage's BASE_DESCRIPTION already says work goes through createTask). For the lab failure you saw, that redundancy may be load-bearing — I would not strip it without re-running the closure goals. What does feel broader than FIX-2156 is the teammates intro rewrite (listDelegates / "it is current, so no tool call is needed"). That tracks teammates-lab leg 2 on gpt-6-luna, not the delegate→task bug. Worth calling out in the PR description so revert/blame stay honest; splitting would be cleaner if you expect churn on either line.

Simpler alternatives considered

Approach Tradeoff
Annotate delegates in sendMessage's recipientsLine only Hits the model at tool-choice time; duplicates formatting unless shared with identity (see recipients.ts header). Good follow-up if identity-only text drifts again.
Shared helper (isWorkerDelegate(me, worker) in delegates/ or recipients.ts) Removes duplicated delegates === "all" || includes and the (typeof taskOnly) typing quirk when isDelegate is applied to messageable. Small hygiene win.
Keep DELEGATE_* unexported Tests could assert substrings; only worth it if you want zero new public constants ( TOOL_USE_RULE is already exported the same way).
Runtime redirect/refuse sendMessage → delegate for "work-shaped" messages Stronger guarantee, much larger product/design surface; out of scope for a closure fix.

Skipped (not worth blocking)

  • Second pass messageable.some(isDelegate) before map — roster capped at 25; irrelevant.
  • teammate() one-liner — readability is fine either way.

Checks

pnpm --filter @flow-state-dev/workforce test -- worker-identity (full workforce suite) — 1717 tests passed on this branch.


Cursor automation — simplify pass

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

@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

The prompt is already the small shape. DELEGATE_MARK, DELEGATE_RULE, one line that appends the mark, and one line that adds the rule when a messageable delegate exists. I left that text, the changeset, the architecture sentence, and the goal logs alone. I also left the recorded delegate-check note alone: using flowTakes changes who gets the mark.

The extra size is two new tests that boot the board again for eng.ana and eng.bo. Those turns already exist in "lists who a message reaches" and "never tells a worker to file a task for a task-only worker that isn't its delegate". Fold the four expects into those turns: the cy line with the mark, the unmarked bo line, DELEGATE_RULE, and the absence of the mark and the rule on bo.

Draft POC, do not merge: #4264 (poc/shorter-delegate-identity-tests @ 7fc8c977795be4acc0ff5e3752e776b6bc7ddd9e).

packages/workforce vitest run test/worker-identity.test.ts: 6 passed. With the mark and the rule removed, the ana turn fails on - cy (eng.cy): Researches. (your delegate: takes your tasks too).

Agent on this PR: fold that subtraction, then close the POC unmerged after this PR lands.

Head bfd90fabff7cdd7dcea46f6343e2f13689e73577.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

Codex review: the mark read the worker's file, while the board takes a
task for the conversation's list once addDelegate or removeDelegate has
set it. The layer now reads that list when it is set, else the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH4wEhbNtsBnU8xobe
Review (Code Snob): the two new tests booted the board again for turns
the file already runs; their expects move into those turns.

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

Copy link
Copy Markdown
Collaborator Author

Code Snob's fold is applied in c6d6508: the delegate-mark expects now run in the existing ana and bo turns, and the two extra board boots are gone (8 tests pass). The POC #4264 can be closed unmerged once this lands.


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: c6d6508a1c

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

Codex review: with delegates: all (or an explicit default), a messageable
worker whose flow lacks the contributor role was marked as taking tasks,
and the board's delegate check refuses its task. The mark now reads
flowTakes, the same fact the check reads.

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

@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: c3d6b03193

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

Codex review: the lists stop at MAX_LISTED_RECIPIENTS, so past the cap a
delegate can be missing while the layer said no lookup was needed. A cut
list now sends the model to listDelegates for the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NczDiH4wEhbNtsBnU8xobe
@jhoffner
jhoffner merged commit 0775305 into main Oct 30, 2026
19 checks passed
@jhoffner
jhoffner deleted the claude/project-thread-ijok0y branch October 30, 2026 22:28
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