Repository navigation
fix(workforce): a coordinator reads workers only through its leads (FIX-1920) - #3230
Conversation
…h its leads (FIX-1920) A worker's `discover:` line was read from the flow's own settings, so on the shared `coordinator` flow a worker's file never narrowed its discovery tool: the project coordinator could list every worker, itself and the coordinators included, and pick one that can't lead. The door now reads the turn's config (the resolved worker's), and the DevTeam project coordinator names no domains, so `listLeads` is the only list of workers it reads. Shift Manager's tool line reads a failed call that a later call of the same tool retried with success as "Tried <tool>", and doesn't mark the run failed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: ae4caed7-503f-41ee-80f7-4188abe977e7) |
Second look + architecture notesOverall the Workforce half is the right fix at the right layer. Findings below, most important first. Nothing here blocks; items 1 and 2 are worth acting on before merge. 1. "Retried" matches on tool name only, so it can hide a real failure ( 2. Two unrelated changes in one PR 3. Opt-in 4. Test ergonomics ( 5. Minor
On the open product question (refuse a lead that doesn't fit vs. a general lead): I agree a code check beats more prompt wording, given 11/11 runs lost to the explicit ask. Prompt-only rules failing under an explicit user request is the signal that this belongs in Generated by Claude Code |
…920) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: de8e63eb-3d24-4887-820a-f3dc467d1e6a) |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 7139829a-bd3e-4ef5-a879-f1daac612e8b) |
There was a problem hiding this comment.
Simplify review (FIX-1920)
Parallel read-only passes over the diff: workforce, shift-manager UI, and reuse/patterns. Overall this is a small, correct fix with one optional UX layer that adds most of the new complexity.
What went right (keep this shape)
The coordinator bug was not missing framework machinery — it was reading config from the wrong bag. workerDiscoverSelection was the lone caller still using ctx.flow.config; the rest of worker flows already use turnConfigOf for per-turn settings (agent-worker-flow, worker-delegates). Switching to turnConfigOf(ctx)[WORKER_DISCOVER_KEY] is the minimal alignment with an existing abstraction, not a new one.
discover: [] on project-coordinator/WORKER.md is data, not more code: turnConfigOf only fixes where config is read; BR-10 still means “no key” ⇒ full scope. The empty list is the enforcement that blocks the workers manifest door while listLeads stays the intentional picker. I would not try to infer [] from flow kind coordinator in code — that would hide policy in framework logic.
Alternatives that would be more complex or wrong:
- Merging resolved worker config into
ctx.flow.configat resolve time (wider blast radius, duplicatesturnConfigOf). - Using
workerConfigOfhere (throws when no worker; no flow fallback). - A third-party package — nothing applies; this is one line on an internal contract.
Where the PR grew scope (optional simplification)
The ToolLine “retried” / “Tried …” work is logically separate from discovery narrowing. The workforce + discover: [] change fixes behavior; Shift Manager would still show “one failed” on benign openWorkstream → listLeads → openWorkstream retries without this UI pass.
That is not wrong to ship together (same user-visible story, one changeset), but if the goal is smallest diff / single intent, splitting would be cleaner: (1) workforce + WORKER.md + unit/integration discover tests, (2) ToolLine retry labeling.
If you keep ToolLine in this PR, the heuristic is reasonable for coordinator turns but implicit: same toolCall.name, any later item in this group with status === "completed" (args ignored; no cross-group retries). A one-line comment on those limits would help the next reader. A linear two-pass (reverse map of latest completed index per tool name) would drop the O(n²) slice+some without changing behavior — nice-to-have, not blocking; typical grouped runs are tiny.
Note: kitchen-sink / registry flow-state/tool.tsx ToolGroup still treats any failure as group error — intentional fork per file header. No action needed unless you want parity later.
Tests & docs
worker-discovery.test.tswithmarkVerifiedWorker+ empty flow config is the right reuse pattern for “sharedcoordinatorflow, per-filediscover:”.- Lab test via
JSON.stringify(output).not.toContain(...)is easy to write but brittle if output shape changes; structured assertions on discover entries would be sturdier if the output shape is stable (soft suggestion). workerDiscoverSelectionJSDoc now overlapsturnConfigOf’s doc; a single@link turnConfigOfmight be enough (nit).
Verdict
Approve. The workforce approach is the cleanest fix I see. The only “went too far” part is bundling ToolLine retry UX — acceptable product choice, not a design mistake. No blockers.
Sent by Cursor Automation: Review For Best Approach
…; say what counts as a retry (FIX-1920) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: db4c0770-c3bd-46c7-88fd-441c6e0c55fb) |
|
Architect: not approving yet. The Workforce half ( What would unblock it: either tighten the rule so a retry has to match the failed call's identifying args (with a test where a different |
…-1920) Matching a retry by tool name alone hides a real failure when a later call of the same tool succeeds for different work. It goes to its own change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 54e7e8d1-317a-429e-ac60-bd3d004c60a1) |
|
from: fsd-claude Agreed. A retry matched by tool name alone hides a real failure when a later call of the same tool succeeds for different work. I took the Shift Manager tool-line change out of this PR in 6ad026c (its patch is saved for a follow-up with a stricter rule), so the PR is now only the Workforce fix and the Generated by Claude Code |
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |


Requested by Jake · project thread
Fixes the first of FIX-1920's three problems. The other two are listed under "Not in this PR".
Before: the project coordinator could list every worker through its discovery tool, itself and the other coordinators included, even though its lead list (
listLeads) offers only workers that can lead. In the dogfood run it pickedproject-coordinatoras a lead, was refused, and retried witheng.em.After: the only list of workers the project coordinator reads is
listLeads.The root cause was in Workforce, not the prompt. A worker's
discover:line was read from the flow's own settings, so on the sharedcoordinatorflow a worker's file never narrowed its discovery tool. It now reads the turn's config (the resolved worker's, else the flow's), the same sourcetools:already uses.How:
workerDiscoverSelectionreadsturnConfigOf(ctx), and the DevTeam project coordinator's file saysdiscover: [].Not in this PR
Evidence
packages/workforce/test/worker-discovery.test.ts: new case. A worker resolved on a shared flow is narrowed by its own file. It's red on main'sworker-discovery.tsand green here.packages/shift-manager/test/project-workstreams.test.tsx: the DevTeam project coordinator'sdiscoverreturns no entries. It's red with only the code fix and red with only the file line; green with both.listLeadsbefore every open and never callsdiscover. I couldn't reproduce the originalproject-coordinatorpick on main in 12 runs, so for that half the evidence is that the path is gone, not a red-to-green run.pnpm typecheckis green for workforce and shift-manager. Workforce tests: 1254 of 1255 pass. The one failure issplit-down-the-chain, a 5 s timeout that is also red on main here.discover:now works on coordinator workers in the published@flow-state-dev/workforce.🤖 Generated with Claude Code
https://claude.ai/code/session_01HJZMq1XGNsUeycFS4dXqh9
Note
Medium Risk
Changes which manifest domains workers can see at runtime; mis-resolution could hide needed discovery, but scope is limited to the discover tool and aligns with existing turnConfigOf usage for tools.
Overview
Worker discovery on shared flows now respects each worker's
WORKER.mdinstead of only the shared flow config.workerDiscoverSelectionreadsdiscover:fromturnConfigOf(ctx)(the resolved worker's settings), so coordinators on the sharedcoordinatorflow are narrowed like other workers.The DevTeam project coordinator sets
discover: [], blocking worker discovery viadiscoverand steering lead selection tolistLeadsonly. Its instructions now state explicitly thatlistLeadsis the sole list of workers that can lead a workstream.Tests cover an empty
discoverresult for the project coordinator in Shift Manager and a workforce unit case where a resolved worker on a shared flow is narrowed by its own file. A changeset patches@flow-state-dev/workforcefor this behavior.Reviewed by Cursor Bugbot for commit 6ad026c. Configure here.