Skip to content

fix(workforce): a project coordinator hands a named workstream's ask on (FIX-2005) - #3450

Merged
jhoffner merged 3 commits into
mainfrom
claude/project-thread-it1nad
Oct 15, 2026
Merged

jhoffner merged 3 commits into
mainfrom
claude/project-thread-it1nad

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

Before: a user who asks their project coordinator to hand more work to one of their own workstreams sometimes gets a reply and nothing else. In the FIX-1797 closure goal, b3 failed 7 of 20 runs on main e2ee2c18.

After: the ask reaches that workstream. b3 passed 19 of 19 runs with this change, and every one of the 38 hand-offs was a single dispatchTask call with post: true.

The coordinator never refused a dispatch. It just didn't make one. Each failing turn began by reading the project, because the ask named a workstream. The read lists owners as bare user ids, so the coordinator couldn't tell its user's workstream from another member's. From there it went one of five ways: it called the workstream someone else's, said "routed" without routing, added the ask to the objectives, asked what the ask meant, or gave up after a dispatchTask that sent goal/title was refused.

How

  • readProject, the project coordinator's tool (projectCoordinatorTools), marks each workstream yours: true/false for the session's user. There's a unit test.
  • The DevTeam project coordinator's WORKER.md now puts the hand-off rule first. A named workstream's ask goes on with dispatchTask in the same turn, however short it is, and the project isn't read first. Only a dispatch that answered ok counts as a hand-off. A refused call is fixed and sent again. An ask to handle work is never folded into the objectives. The readProject rule is narrowed to questions.
  • README, docs page and a changeset cover the new yours field.

Evidence (/mnt/project-files/FIX-2005/measurements.md, with logs)

  • The five leg-b/c controls still fail at their own steps on the final version: unpartitioned b4, no-follow-up b5, no-delegate-check b6, no-roster-check c4, org-scoped-workers c2.
  • goals/projects/a-shared-project-has-one-owner-per-workstream passes legs a to c. Its status question still goes to readProject.
  • pnpm --filter @flow-state-dev/workforce test (1342) and @flow-state-dev/shift-manager test pass.
  • A Haiku-model variant also fixed b3, but it made b2 worse, so this PR doesn't change the model.

Not in this PR: on both main and this branch, b2 still fails about 1 run in 10. In those runs the lead-fit judge refuses general-lead for the goal's unspecified ask, which is FIX-1987's class.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGrSpvKPW4xoKddwpB3doh


Generated by Claude Code


Note

Medium Risk
Changes coordinator tool output and agent instructions that drive dispatch to workstream leads; behavior is covered by new tests but affects production routing for named workstream asks.

Overview
Fixes project coordinators failing to hand work to a user's own workstream when the ask names that workstream (FIX-2005). Owner ids alone did not let the model distinguish the session user's streams from teammates'.

readProject (projectCoordinatorTools) now adds yours: true/false on each workstream by comparing owner to the session user. Tool description and output schema are updated; a unit test asserts checkout vs billing marks.

DevTeam project coordinator WORKER.md is restructured: hand-off via dispatchTask (post: true, no extra goal/title) comes first, including same-turn dispatch when the user names a workstream (match delegate target first; readProject only to resolve a title). Status questions stay on readProject, which documents yours. Work asks must not become objectives or clarifying questions without dispatch.

Docs (projects.md, workforce README) and a patch changeset describe the new field.

Reviewed by Cursor Bugbot for commit 7631248. Configure here.

RetriggerView in GreptileConfidence Score: 4/5

Resolve the title-to-target gap before merging so named asks reach the right workstream.

Fix All in CursorFindings

  1. P1 Named asks lose their target ▶

Summary

Adds yours to the coordinator's readProject output and strengthens the rules for handing asks to workstream leads.

  • Named workstream asks go to their lead in the same turn.
  • Project reads show which workstreams belong to the user.

Reviews (1) · Last reviewed commit: "fix(workforce): a project coordinator ha..." · Reviewed by Greptile

…on (FIX-2005)

A user's hand-off to their own workstream sometimes never reached it: the
project coordinator's turn made no dispatch. It read the project first,
couldn't tell its user's workstream from another member's (owners are bare
user ids), and then said it was someone else's, said "routed" without
routing, folded the ask into objectives, or asked what it meant.

- readProject, the project coordinator's tool, marks each workstream
  `yours` when the session's user owns it.
- The DevTeam project coordinator's file puts the hand-off rule first: a
  named workstream's ask goes on with dispatchTask in this turn, however
  short, with no project read before it; a hand-off is only a dispatch that
  answered ok; the readProject rule is for questions.

The closure goal's b3 failed 7 of 20 runs on main and 0 of 19 with this.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGrSpvKPW4xoKddwpB3doh
@linear-code

linear-code Bot commented Oct 15, 2026

Copy link
Copy Markdown

FIX-2005

@jhoffner jhoffner self-assigned this Oct 15, 2026
@vercel

vercel Bot commented Oct 15, 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 15, 2026 12:13am UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 15, 2026 12:13am UTC
flow-state-dev-ui Ignored Ignored Preview Oct 15, 2026 12:13am UTC

Request Review

@cursor

cursor Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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: 99d02646-e725-475b-8008-b5f53bf4518d)

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass (for the follow-up agent)

The change is small and the shape is sound: the fix is mostly prompt, plus one data affordance. Nothing blocking. Items in priority order.

1. The yours mark and the "don't read the project first" rule do different jobs, and only one is evidenced

The PR body says every b3 failure began by reading the project. The new WORKER.md rule ("dispatch first, don't read the project for it") removes that read from the hand-off path entirely, so on the path b3 exercises, yours is never seen. The 19/19 is therefore evidence for the prompt change, not for the field. yours only matters on question turns ("which of these is mine?") and on the edit path ("find the id with readProject first"). That's still a legitimate gap (owners are bare user ids, and the model never knows its own), so I'd keep it, but:

  • Say so in the PR description, so nobody later reads the field as the b3 fix.
  • If there's a cheap way, run b3 with the prompt change only and yours only separately. That tells us whether the field is load-bearing or insurance. If it's insurance, that's fine, just name it.

2. Alternative worth a sentence: filter instead of mark

listDelegates already gives the coordinator exactly its user's open workstreams (workstreamDelegateSeed filters entry.owner === user && status !== done). The new prompt text leans on this ("Every workstream on your list is the user's own"). readProject is the only place the "whose is it" question is answered a second way. Marking is the right call over filtering, because the tool's contract is "every member reads every workstream", but note the ownership predicate now lives in two places (workstreamDelegateSeed and the new .map). A small ownedBy(user) helper next to userOf is optional; I would only do it if a third caller appears.

3. Where the yours projection lives (small refactor opportunity, in the lines you're already touching)

readLinkedProjectOutputSchema and the inline .map sit inside project-coordinator.ts, while readProjectAt and readProjectOutputSchema are in project-read.ts. Consider a tiny exported pure function in project-read.ts, e.g. markOwnedBy(read, user), and the extended schema beside readProjectOutputSchema. That makes the mark unit-testable without booting the coordinator harness (the current test needs a scripted judgment, two opened workstreams and a request-store scan just to check a boolean map), and keeps all "what a read returns" shapes in one file. Not required; the current placement is defensible since only the coordinator tool uses it. I'd skip the refactor if the PR is already tight.

4. Test

  • The comment "Without the mark, Bob's coordinator read his own workstream as another member's and handed it nothing" describes the incident, and it's also a bit garbled (Bob isn't the session user here; alice is). Replace with the intent: the model sees owners only as user ids, so the mark is how it learns which workstreams are its user's (BP-006: keep history out of tests).
  • (request as { items?: any[] }) / read.output... casts are noisy; if an existing helper in this test file already extracts a tool output, use it.
  • Consider also asserting the mark follows the session user (read as bob, expect { checkout: false, billing: true }), since that's the property that would regress if someone hard-coded or cached the user.

5. WORKER.md

  • The block order is now hand-off, then say-how-it's-going, then keep-the-project. Good, since it puts the rule the failure turned on first. But the diff also moves the whole "Hand work" paragraph, which makes review noisy; fine, just worth knowing the content change there is only the added rules.
  • The hand-off section now says the same thing three ways: "Never hand work to a workstream that is not on your list", "Every workstream on your list is the user's own", and the yours: true note further down. The edit section also gets its own "An ask to handle or do something ... is work for its lead" restatement. Prompt rules that repeat are what cause drift when one copy is edited later. I'd keep the dispatch-first rule and the "only an ok counts" rule, and trim one of the ownership restatements.
  • One overlong line in the readProject paragraph (reflowed unevenly); cosmetic.

6. Docs / README / changeset

  • projects.md: "It returns what readProject returns, with yours: true..." is circular. Suggest: "readProject marks each workstream yours: true when the user owns it, so the coordinator can tell that user's workstreams from everyone else's." (Also the README says the same thing twice in adjacent sentences/rows; the table row is enough.)
  • Changeset references (FIX-2005). Release-note fragments are fine for that, but keep it out of the docs page and README (it is not there, good).
  • Per BP-030, yours is a new required field on the tool output; there's no persisted shape here, so no legacy-read concern. Noted as checked.

7. Out of scope, noted

b2's ~1-in-10 failure (lead-fit judge, FIX-1987) is correctly left alone. The Haiku variant being rejected because it regressed b2 is a good reason not to touch the model here.

Verdict: approve the direction. Worth doing before merge: #1 (accurate framing), #4 (test comment, session-user assertion), #6 (circular docs sentence). #3 and the WORKER.md trim in #5 are optional.


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.

Summary

This PR splits cleanly into a small API affordance (yours on coordinator readProject) and a large behavioral fix (project-coordinator WORKER.md). After reading the diff and running pnpm --filter @flow-state-dev/workforce test (all 1341 tests pass), I think the core approach is sound: coordinator-only output shape, derived yours from owner === session user, neutral readProject action unchanged. That matches how delegate listDelegates enrichment already works elsewhere.

I do not think the API layer over-engineered the problem. The risk is asymmetry: most of FIX-2005 lives in prompt prose, while the only new automated check pins the yours field—not the titular “name a workstream → dispatchTask this turn without treating it as Q&A” path.

Simpler alternatives considered

Alternative Why it’s tempting Why I’d still lean toward this PR
Prompt-only (reorder/strengthen hand-off rules; lean on listDelegates) Smallest diff; hand-off already has a delegate roster Fails when the model does call readProject for ownership/status—your test comment documents models mis-reading owner ids without a viewer-relative mark
Fold yours into readProjectAt One read helper Wrong boundary: app/MCP/browser readProject should stay membership-neutral
Top-level viewerUserId or { mine, others } split One field instead of N booleans Bigger contract churn for consumers; per-row yours is easy for the model next to each workstream
3rd-party “view model” lib Less hand-rolled mapping No real win here; Zod .extend is already the local pattern

What I’d simplify (non-blocking)

  1. Regression for the PR title behavior — scripted turn with dispatchTask only (no readProject) when the user names an owned workstream; assert the post lands on the right delegate. Optional follow-up if you want to keep this PR tiny.
  2. Trim duplicate rationale — schema + handler block comments repeat the same “why yours” story; keep the high-signal one on the schema.
  3. Test hygiene — expect(read).toBeDefined() before scraping; fix the Bob/Alice mismatch in the test comment.
  4. Doc drift — project-read.ts header still implies coordinator and app reads share the same output shape; worth a one-line note that the coordinator tool extends the view.

Verdict

No major architectural concerns. Directory layout stays fine (project-coordinator.ts is already the hub; this doesn’t worsen cross-package imports). I’m not requesting changes before merge—the items above are polish and coverage gaps I’d treat as follow-ups unless you want FIX-2005 fully pinned in this PR.

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. A smaller shape exists. Draft POC, does not merge: #3453 (poc/shorter-read-yours @ 29c892ebe).

Fold 29c892ebe onto 49c66ba47. Close the POC unmerged after this PR lands. Do not reset this branch onto the POC.

readLinkedProjectOutputSchema has one caller, and its comment repeats the handler. The test title already says the model sees owners as user ids. Inline the extend on outputSchema and keep the mark on the handler comment. Drop the test comment under the read; it retells the incident, and the title is the intent. In projects.md, the tool reads the linked project and marks each workstream yours: true when the user owns it.

Net −9 (6 insertions, 15 deletions). Same map: workstream.owner === user. Same expect: { checkout: true, billing: false }.

project-coordinator.test.ts 30 passed on 29c892ebe. Inverting the comparison received { checkout: false, billing: true }.

Left as recorded: WORKER.md (the prompt the 19/19 runs used, including the list sentence and the edit-section hand-off), the README section sentence and the catalog row, the changeset, and the harness test. A shared mark helper is more lines in front of the same map. The section and the catalog row are the two readers of the field.

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

View PR

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

…iew nits (FIX-2005)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGrSpvKPW4xoKddwpB3doh
@cursor

cursor Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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: 314206f9-74d1-48b1-a485-34b47c1fd80c)

… line (FIX-2005)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGrSpvKPW4xoKddwpB3doh

Copy link
Copy Markdown
Collaborator Author

Code Snob fold, partly taken in 7631248:

  • Taken: the marked schema is now inlined into outputSchema, and the projects.md sentence is shorter.
  • Kept: the reason for the mark stays on the handler comment, because the model only sees owners as user ids. The test's intent comment and toBeDefined() also stay, because the test should explain why the mark matters (CLAUDE.md §5).
  • Not taken: the WORKER.md hunk. POC: inline the coordinator read's yours schema #3453 branched from 49c66ba, so it would undo e35cc93's rule to read the project for a workstream named by title.

I'm closing #3453 without merging it.


Generated by Claude Code

@cursor

cursor Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot 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: 9f66108c-d472-4a17-a818-30ef49a481c4)

@jhoffner

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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-15T01:31:18.165185Z 7631248 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 763124895c

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants