Skip to content

fix(goals): it-groups-workstreams reads the EM and accepts either lead (FIX-1977) - #3349

Merged
jhoffner merged 1 commit into
mainfrom
claude/project-thread-af3oct
Oct 14, 2026
Merged

jhoffner merged 1 commit into
mainfrom
claude/project-thread-af3oct

Conversation

@jhoffner

@jhoffner jhoffner commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jake · project thread

Before: goals/shift-manager/it-groups-workstreams-under-their-projects stopped in setup on main (7739ad25), in green and in every control: "the tree declares 2 workers that can lead a workstream (general-lead, eng.em), not one". The goal assumed the DevTeam tree has exactly one lead.

After: green passes and every control fails at its own signal again.

The product change was intended: #3263 (FIX-1920) added a general lead and lets the coordinator pick a lead by fit. So the goal was stale, not the product. It now reads two things from the tree: every worker that can lead (on agent or em, listing delegates), and the EM (the one on em, as the profile's boot finds it).

How:

  • The outsider and race legs open under the EM, as before.
  • The entries leg, where a person asks their project coordinator, accepts a workstream led by any declared lead, since the coordinator now picks one. That check never meant to grade lead routing; FIX-1920's own goal does.
  • goal.md's Input and entries leg say the same, plus a run-log row.

Evidence (on 7739ad25 + this change; local, real model for entries and cos):

  • green, full run: PASS (both asks led by a declared lead; 72/72 opens and 108/108 updates landed; restart held; cos passed)
  • unread: FAIL at "PROJECTS equals the store's rows" and the four tabs
  • gap-tabs: FAIL at the four tabs
  • no-gate: FAIL at "the outsider's open is refused"
  • no-retry: FAIL at "a write race lands whole"
  • in-memory: FAIL at "a restart keeps the projects and their entries"
  • no-tool, drop-solo (GOAL_LEG=cos): FAIL at cos

pnpm --filter @flow-state-dev/goals typecheck and guard:control-shape pass. No changeset: goals is private.

Fixes FIX-1977. Unblocks FIX-1797.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J5pp7HBcj3QV34at1z7H1n


Generated by Claude Code


Note

Low Risk
Changes are limited to private goal test scripts and documentation; no production Shift Manager or workforce behavior is modified.

Overview
Updates the it-groups-workstreams-under-their-projects goal so it matches DevTeam after FIX-1920 added a second lead-capable worker (general lead plus EM). Setup no longer errors when the tree reports two leads instead of one.

run.mts replaces the single-lead leadOf() helper with leadsOf(), which returns every delegate-listing worker on agent/em flows and still pins the EM (em flow) as setup.lead for boot-style HTTP opens (outsider and race legs). The entries leg now asserts each opened workstream is led by any declared lead, not only the EM, since the project coordinator may choose either. Evidence strings and comments follow the same wording.

goal.md documents multiple leads, coordinator-chosen assignment for Stream asks, EM for boot/HTTP legs, and adds a 2026-10-14 verdict log row for FIX-1977.

Reviewed by Cursor Bugbot for commit 7574626. Configure here.

RetriggerConfidence Score: 5/5

This PR appears safe to merge.

Summary

This fixes a goal that stopped during setup after the DevTeam gained a second lead.

  • The Shift Manager goal check accepts workstreams led by either declared lead.

Reviews (1) · Last reviewed commit: "fix(goals): it-groups-workstreams reads ..." · Reviewed by Greptile

…d for asks (FIX-1977)

FIX-1920 added a general lead to the DevTeam tree, so the goal's setup,
which wanted exactly one worker on a lead flow, threw before any leg ran.
The HTTP legs now open under the EM (the one lead on the em flow, as the
boot picks it), and a workstream opened by asking the project coordinator
may be led by any lead the tree declares, since the coordinator picks one
by fit.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J5pp7HBcj3QV34at1z7H1n
@jhoffner jhoffner self-assigned this Oct 14, 2026
@vercel

vercel Bot commented Oct 14, 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 14, 2026 1:36pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Oct 14, 2026 1:36pm UTC
flow-state-dev-ui Ignored Ignored Oct 14, 2026 1:36pm UTC

Request Review

@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

FIX-1977

@cursor

cursor Bot commented Oct 14, 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: 1e17061a-af98-412a-ad41-87dd7eca17bd)

Copy link
Copy Markdown
Collaborator Author

Second look + architecture pass

Verdict: the approach is right. No competing shape worth the cost, and nothing here needs a refactor. Two small optional nits.

Is there a better approach? I considered three alternatives and none beats this one.

  • Pin the entries leg to one named lead (e.g. the EM). This would restore the old strictness. But Check a coordinator's pick of lead against the work, and give the DevTeam a general lead (FIX-1920) #3263 deliberately lets the coordinator choose by fit, so the leg would flake or fail on correct behavior. Accepting any declared lead is the leaner call. The PR also rightly leaves lead-routing grading to FIX-1920's own goal.
  • Make the goal say nothing about leads. The current check still catches the failure it should: an entry led by a worker that isn't in the tree. Keep it.
  • Move the leads/EM discovery into a shared helper. leadsOf is single-use in this goal, and readDeclaredRoster already is the shared part. Extracting it would be speculative.

Architecture / refactor opportunity: none to take here. The change is small and reads the tree at run time instead of hardcoding names, which is the right direction. Pulling anything wider into this fix would break the "every changed line traces to the issue" rule.

Optional nits (not blocking):

  1. Setup.lead now means "the EM", while leads is the full set. The docstring explains it, but at the call sites (run.mts:880, :906) lead: setup.lead reads as if it were any lead. Renaming the field to em would make the two uses self-describing. Only worth it if you're touching those lines anyway, since it widens the diff.
  2. run.mts header comment (~line 27-28): the rewrapped lines are uneven ((the EM or the general lead), with the ask in its session and nothing added to the is much longer than its neighbors). Cosmetic.

Check on the evidence: the controls each fail at their own signal, which is what shows the leg still bites. One gap: the green run only shows the entries were led by a declared lead. If the coordinator happens to pick the EM every time, the "either lead" path is never exercised. That's fine for this fix, because the check is membership, not distribution. It's worth knowing the new branch is covered by logic rather than by an observed general-lead run.

Nothing blocking from me.


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 7574626ba. No POC.

Read goals/shift-manager/it-groups-workstreams-under-their-projects/run.mts (leadsOf, readSetup, the entries check, the outsider and race opens) and goal.md (Input, the entries bullet, the 2026-10-14 log row). Compared the EM read in packages/shift-manager/teams/devteam/fsdev.config.mts and host.mts, and listLeads / leadsWorkstreams in packages/workforce/src/projects/.

leadsOf is the filter this goal already had, plus the count of leads on em. That count is what the outsider and race legs open under (setup.lead at the two openWorkstream calls). The entries leg checks setup.leads. Those are two values, and the return is both of them. A loop that pushes ids and counts EMs in one pass is longer than the two filters. setup.leads.join appears in the failure and the evidence line; a local for that string is an extra line.

The function comment repeats the Setup comment. Putting it back to one line leaves the check, the error, the evidence string, and the goal.md bullets the same size. The file-header wrap is the same two sentences.

Left as recorded on the PR: the entries leg still requires a declared lead, leadsOf stays in this goal, and Setup.lead stays the field name.

Open in Web View Automation 

Sent by Cursor Automation: Code Snob

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

The goal broke because FIX-1920 added a second declared lead while this harness still required exactly one. The fix is appropriately small: keep the EM as the oracle for boot-aligned HTTP opens (race, outsider) and only relax the entries leg so coordinator-chosen leads are allowed.

Simpler paths considered

Approach Verdict
Re-tighten DevTeam to one lead Fights FIX-1920; wrong product direction
Force the coordinator to always pick the EM in the goal Hides the real listLeads → pick → openWorkstream behavior the entries leg is meant to grade
Derive allowed lead ids from a runtime listLeads call in readSetup Closer to production truth and avoids duplicating eligibility rules, but needs a coordinator session and more wiring than this ~25-line fix
Export a shared declared-roster / leadProblem helper from @flow-state-dev/workforce Best long-term DRY; out of scope for a goal-only unblock

I don't see a materially cleaner fix without widening scope. Inline notes are naming and drift hygiene, not blockers.

Open in Web View Automation 

Sent by Cursor Automation: Review For Best Approach

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 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-14T13:44:00.115090Z 7574626 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. Another round soon, please!

Reviewed commit: 7574626ba1

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

@jhoffner
jhoffner merged commit 36683f3 into main Oct 14, 2026
23 of 25 checks passed
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