Repository navigation
FIX-1904 (1/2): fsd profile, Claude Code by default, start-time account probe - #3189
Conversation
…art-time account probe
- @flow-state-dev/claude-code/sdk: probeClaudeAccount({ env, timeoutMs }) asks
Claude Code for its credential source with a streaming-input query that
never sends a message; resolves account, none (with reason) or sdk-missing.
- shift-manager: startHarness(default) picks the coder per profile and, on
Claude Code, probes before the Lab listens; refuses on none/sdk-missing
naming ANTHROPIC_API_KEY and DEVFORCE_LAB_HARNESS=stub; never falls back.
A start line names the coder. DevTeam keeps stub as its default.
- teams/devteam/fsd.fsdev.config.mts: the fsd profile (FSD and Shift Manager,
shared, on this repository; no ask, no workstreams; its own store; no remote
allowed). checkout.mts opens it by default; under --dev it checks the coder
first so a refusal exits instead of waiting on the watcher.
- The checkout mapping (FIX-1906's option) is slice 2: until then a coding run
on either project is refused by its remote and nothing is cloned.
- Goal check goals/shift-manager/it-opens-on-fsd-and-shift-manager: legs a
and c, with the silent-stub control; leg b reports not-built.
- Docs: the fsd profile, the stale devteam project list, probeClaudeAccount.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JdyQCD5rESK6t4xABFzRZk
|
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: 0c9b0f21-0404-4293-97a8-1b74278e22ab) |
|
@codex review |
Second look + architecture pass (read-only; nothing here is a blocker)Reviewed the full diff at Is there a better approach?1. Ship the default flip now, or hold it for slice 2? I'd hold it.
2. The default is named in two places.
3. Timeout and spawn-error probes read as "sign in".
Architecture opportunities this PR touches4. Duplicated roster lookup (opportunity worth taking now).
5. The
Smaller items
Items 2 and 3 are the ones I'd act on in this PR. Item 4 is optional here. Items 1 and 5 are decisions for the author. Generated by Claude Code |
There was a problem hiding this comment.
Simplify review (FIX-1904 1/2)
Verdict: The core bet is sound — probeClaudeAccount via the Agent SDK (not env-only checks) is the right trade for OAuth/keychain parity, and startHarness as the single “pick coder + refuse early” door is clearer than scattering checks. I would not replace the probe with a third-party shortcut; there isn’t one that preserves D1.
Where the change over-built complexity
-
Double account probe on
pnpm shift-manager:dev(defaultfsd, no--config) —checkout.mtsrunsstartHarness("claude-code")before the supervisor, thenfsd.fsdev.config.mtsrunsstartHarness("claude-code")again on import. That’s two SDK subprocess probes (~0.5–1s+ each) and doubled hang latency on failure. The comment incheckout.mtsdocuments this as intentional; for simplify, it’s the biggest avoidable cost in the PR. Cleaner options (pick one):- Process-lifetime memo for a successful
probeClaudeAccountwith the sameenv(module cache inharness.mtsoraccount-probe.ts). - Narrow dev preflight:
checkout.mtscallsprobeClaudeAccountonly (orstartHarness({ probeOnly: true })) and config load remains the only place that builds the harness slot. - Supervisor UX fix so config refusal exits the dev command without a second probe (harder; only if you want zero probe duplication).
- Process-lifetime memo for a successful
-
Parallel
fsd.fsdev.config.mtsduplicates DevTeam wiring — roster → EM →coderWorkerIdblock is copy-pasted fromfsdev.config.mts. Reasonable for a two-profile epic, but it will drift. A smallresolveCoderWorkerId(LAB_TREE)oropenServedLab({ …deltas })shared helper would shrink both configs to declarative deltas (projects, harness default, workspace/remotes). Optional in this slice if FIX-1904 follow-up already plans it. -
teams/devteam/hosts both DevTeam fixture andfsdproduct profile — naming/mental-model smell, not a blocker. Longer termteams/fsd/orprofiles/fsd.fsdev.config.mtsmay read cleaner; I’d only move if the epic already contemplates it.
Smaller notes (non-blocking)
probeClaudeAccountreimplements SDK import/queryvalidation already insdk-client.ts— internalloadClaudeAgentQuerywould keep one “sdk-missing” path.refusalOf/CLAUDE_CODE_PASSwill likely duplicate kitchen-sink (FIX-1915); consider exporting refusal formatting or the allowlist from@flow-state-dev/claude-codebefore the second copy lands.- Goal
SILENT_STUBregex patch is brittle but acceptable for anti-game controls.
Performance: No hot-path concerns; startup probe cost is the story, and deduping fixes the main issue.
Tests/docs: Good use of DEVFORCE_LAB_HARNESS=stub in tests and the goal leg structure. The new goal is appropriate evidence for the product surface.
Recommendation: Merge after addressing (or explicitly ticketing with issue ref) the double probe — it’s the one simplification win that’s clearly in-scope for this PR. Config extraction can follow in the same epic if you prefer smaller diffs.
I’m not approving yet because of the double probe; happy to approve a follow-up commit that dedupes it.
Sent by Cursor Automation: Review For Best Approach
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f9b0bba8e
ℹ️ 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 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. |
There was a problem hiding this comment.
Code Snob. Already tight. No POC.
Head 9f9b0bba. I read packages/claude-code/src/sdk/account-probe.ts, sdk-client.ts, packages/shift-manager/teams/devteam/harness.mts, fsd.fsdev.config.mts, fsdev.config.mts, scripts/checkout.mts, test/harness-start.test.ts, test/fsd-profile.test.ts, test/goal-labs.test.ts, goals/shift-manager/it-opens-on-fsd-and-shift-manager/run.mts, and goals/lib/shift-manager.mts.
A rewrite would not shrink the contract:
- The held generator is the no-message probe.
messageOfis the two catches. The spreads leaveundefinedoff the objecttoEqualchecks. AsourceOfhelper is a new name for two lines. The header's last paragraph is why this asks Claude Code instead of reading variables, and why a rejected key still reads asaccount. selectHarnessstays synchronous (the five existing callers).claudeCodeEnvis the one environment the run and the probe share.refusalOfis the line thesilent-stubcontrol patches."value" in optionsis how a test passesundefinedwhilecheckout.mtsomits the key and reads the env.- The roster block in
fsd.fsdev.config.mtsis the copy this PR already left in place: move it when a third profile exists. - The
--devpre-check callsstartHarnessin the parent because the supervisor waits on a failed load. The re-run carries--configand probes again. The empty log is so the start line is printed once. startScriptis notstartShiftManager. That helper always passes--configtocli/bin.tsand throws if the process never serves. Leg c startscheckout.mtswith no--configand grades an exit before the banner, including--dev.- BR-12 is the named red state that
noneandsdk-missingnever return the script. Folding it into BR-7 drops that name. - The probe section is the same text in the package README and the docs page, which is how that README already tracks the page. The shift-manager README and overview repeat because the spec's docs draft says they get the same paragraphs.
Not re-litigating whether the new default ships in this slice, or the checkout mapping this PR filed as slice 2.
Sent by Cursor Automation: Code Snob
|
from: fsd-claude Packed release installs and imports failed on 9f9b0bb with npm Generated by Claude Code |
…ile opens with --config - checkout.mts opens DevTeam (teams/devteam/fsdev.config.mts) with no --config again; slice 2 makes fsd the default. Under --dev the parent now checks the coder of whichever repository profile will load (fsd: claude-code, devteam: stub, DEVFORCE_LAB_HARNESS overriding both) before the watcher starts, skipping only in the watched child, so `--dev --config <fsd>` with no credential exits 3 instead of hanging. - test/checkout.test.ts: the no-flag default is DevTeam, --config opens fsd (read from which store file each created), and three --dev refusals exit 3. - Goal check: legs pass --config naming fsd; GOAL_LEG must be a non-empty subset of a,b,c; leg c re-run (PASS) with its silent-stub control (FAIL). - Docs: pnpm shift-manager:dev opens DevTeam's demo, fsd opens with --config from the repository root; "the scripted coder (`stub`)"; the Coder: line; probeClaudeAccount wording and "10 000 ms". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JdyQCD5rESK6t4xABFzRZk
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: dd747fd0-a654-414f-bc1d-8df4cccb41eb) |


Requested by Jake · project thread
This is slice 1 of 2. The checkout mapping (PLAN S2, the
checkoutspart of S3) and goal leg b come in slice 2, after the FIX-1906 code merges. FIX-1906'sprojectWorkspace({ checkouts })option is not onmainyet.Before
pnpm shift-manager:devopens DevTeam: three demo projects on a scratch repository, a demo ask in Inbox, and the scripted coder. With no Claude credential, the Lab starts and every run is the script.After
pnpm shift-manager:devopens the newfsdprofile. It has exactly two shared projects, FSD and Shift Manager, on this repository. It has no ask, no workstreams, and its own store (.fsdev/fsd.sqliteorFSD_STORE).ANTHROPIC_API_KEYandDEVFORCE_LAB_HARNESS=stub. It never falls back to the script. The first output line names the coder.DEVFORCE_LAB_HARNESS=stubgives the same Lab on the script, with no credential check.--config teams/devteam/fsdev.config.mtsand keepsstubas its default.remote-not-allowed), and nothing is cloned. It does not go to a worktree of your checkout yet. D3 stays true: a run that the mapping misses is refused, not cloned.How
@flow-state-dev/claude-code/sdkaddsprobeClaudeAccount({ env, timeoutMs }). It opens one streaming-inputquery()that never sends a message, readsaccountInfo(), and closes. It returnsaccount(apiKeySource/tokenSource),nonewith a reason (no source, a timeout, or a spawn error), orsdk-missing. This PR builds the probe. No open or merged PR had it (search:probeClaudeAccount). FIX-1915 can import it.harness.mts:selectHarness(value, stepMs, defaultChoice = "stub")stays synchronous for the existing callers. The newstartHarness(defaultChoice)probes on Claude Code with the run's ownCLAUDE_CODE_PASSenvironment, then refuses or logs the start line. Both profile configs use it.scripts/checkout.mts: the default config is nowfsd. With--dev, it checks the coder before the watch supervisor starts. Without this check, a refusal under--devprinted and then waited for a file change, and did not exit.goals/shift-manager/it-opens-on-fsd-and-shift-manager/: legs a and c, and thesilent-stubcontrol (a module patch applied only in the process under test). Leg b reportsb:not-built, so the full goal cannot PASS in this slice.What's asked of you
Ship the new default now, or hold it for slice 2? The coordinator told me to switch the default in this slice, and I did. The result: until slice 2, the daily command needs a Claude credential to start, and it then refuses every coding run on the two projects (each time by name). Today the same command runs demo work on the script. Screen work and the chief of staff work as before. My recommendation: ship it. The refusal is loud and safe,
DEVFORCE_LAB_HARNESS=stubgives free screen work, and slice 2 follows directly after FIX-1906. What would change my mind: if people useshift-manager:devfor coding runs every day before slice 2 lands. In that case, keepcheckout.mtson DevTeam until then (a one-line change). If wrong: for some days, the dev command cannot do coding work.All other choices come from the approved spec.
Parts worth reviewing closely (for the code reviewer)
account-probe.ts: the input generator stays open untilaccountInfo()answers or the timeout ends, then it is released and the query is closed infinally. The installed-SDK spec cases spawn the real Claude Code with an emptyHOME(none) and a fake key (account).checkout.mts--devpre-check: the probe runs in the supervising parent only. The re-run carries--config, so it skips the pre-check, and the profile probes again when the Lab opens. Thus--devprobes once per start plus once per restart.HOME, no variable, reads asaccount, and a run on that environment succeeds) is still open. This container has no Claude sign-in (an empty home and this home both read asnone). Run it on a signed-in machine in slice 2 or by hand. If it fails, D1 needs an amendment.Fixes FIX-1904 (slice 1 of 2) · Spec:
specs/issues/FIX-1904/· Spec PR #3175 · Goal:GOAL_LEG=a,c pnpm tsx goals/shift-manager/it-opens-on-fsd-and-shift-manager/run.mts→ a PASS, c PASS;silent-stubcontrol FAIL on c; leg a FAIL against main's default.Implementation-PR contract (spec-backed)
Review this against the approved, retained decisions in
specs/issues/FIX-1904/onmain(spec PR #3175) and its EVOLUTION. If you find a real blind spot, it goes back through an amendment PR frommain. Do not edit the merged spec branch.Engineering calls
startHarnessis a new async function next toselectHarness. I did not makeselectHarnessitself async. Reason: it keeps the five synchronous DevTeam test callers the same (this follows Cursor's spec-review note). If wrong: there are two names for one choice.startHarness("stub"). Its default is the same. New: aCoder:start line, and an explicitDEVFORCE_LAB_HARNESS=claude-codenow refuses at start with no account (before, the first run failed). If wrong: DevTeam's stderr has one more line.fsdconfig also exportslab(theLabobject) next to the defaultFlowState, so CI can file a row in-process. If wrong: a second export on a config file.@anthropic-ai/claude-agent-sdkas a devDependency ofshift-manager. The probe loads the SDK throughclaude-code's own importer, and that resolves in the workspace (leg c's refusal is the real SDK's answer). If wrong: a strict install without the auto-installed peer reads assdk-missing, which is a loud refusal.goal-labs.test.tsnow runsfsdtoo. Its Jump-to check is skipped forfsd: Jump to finds documents only through sessions that the user has, andfsdopens no session at start. Thus a freshfsdopen shows an empty Jump to until the first conversation (a D2 consequence, noted for product).docs-writer/docs-editoragents. I published DOCS.md's approved prose, minus the worktree paragraph that is not true yet, plus the probe section in the claude-code page and README. The worktree paragraph comes in slice 2. Please read the prose with that in mind.shift-manager: only repository files and its README change. Changesetprobe-claude-account.mdis for@flow-state-dev/claude-code(patch).Verification
pnpm --filter @flow-state-dev/claude-code test: 291 passed (11 files), withaccount-probe.spec.ts(8). Red first: the module was missing. Blast radius: when I made the probe yield one message, only "sends no message" failed.pnpm --filter @flow-state-dev/shift-manager test: 421 passed, 6 skipped.command.test.tsfailed only until the pages were built locally (CI builds them), then 14/14 passed. New:harness-start.test.ts(11) andfsd-profile.test.ts(6). Red first: the files were missing. Blast radii:selectHarness("stub"): BR-7, BR-8, BR-10, BR-12 and DevTeam-claude-code went red. The other 6 stayed green.remotes.allow: ["github.com"]: both BR-14 cases went red (the run cloned and completed). BR-1/2/3/5 stayed green.claude-code,shift-manager,goalsare clean.guard:control-shapepasses.knip:ciexit 0.check-retired-terms,validate-spec-folder,validate-changeset-refs,validate-model-strings,validate-reserved-names,validate-no-nul-bytes,validate-publish-set,check-isolation-coordinateall pass. No "seat" in the changed prose. No machine path in the profile file.startand asdev(each exited 3 before it listened, naming both variables).GOAL_CONTROL=silent-stub: leg c FAIL onc:exit-before-listeningin both forms (each listened), and the patch reachedharness.mts. Leg a PASS with anANTHROPIC_API_KEY(sharedfsd,shift-manageron this repository, none private, "Coder: Claude Code…"). Leg a FAIL withcheckout.mtsset back to DevTeam (main's default).it-codes-in-the-projects-repository,it-keeps-its-rows-on-the-mailboxes-board,it-waits-for-a-person-before-it-files,it-wakes-the-seat-a-file-declared; shift-managerit-opens-a-lab,it-sends-a-turn-into-a-seat-session. Not rerun (model-backed):it-answers-a-conversations-task,it-commits-from-the-seats-own-file,it-names-the-project-a-coders-task-works-in,it-ships-an-artifact-a-person-can-open,it-groups-workstreams-under-their-projects,it-hands-a-run-the-work-it-approved,one-person-runs-a-labs-projects-and-people. These pass--configor callopenLabdirectly, andhost.mtsdoes not change.🤖 Generated with Claude Code
https://claude.ai/code/session_01JdyQCD5rESK6t4xABFzRZk
Generated by Claude Code
Note
Medium Risk
Changes Shift Manager startup and harness selection around Claude credentials and new profile defaults; failures are loud but
--devandfsdpaths now depend on probe behavior and the optional Agent SDK.Overview
Adds
probeClaudeAccountto@flow-state-dev/claude-code/sdk: a start-time check via the Agent SDK’saccountInfo()(no model turn) that returnsaccount,none, orsdk-missing, with docs and tests.Introduces the
fsdteam profile (fsd.fsdev.config.mts): two shared projects (FSD and Shift Manager) on this repo, empty inbox, separate SQLite store, no git remotes (coding runs fail withremote-not-alloweduntil slice 2’s checkout mapping). Default coder is Claude Code;startHarnesspicks the profile default, probes when Claude Code is selected, refuses startup with guidance (ANTHROPIC_API_KEY/DEVFORCE_LAB_HARNESS=stub) instead of falling back to the scripted coder, and logs aCoder:line.DevTeam stays the no-
--configdefault (stub); choosingclaude-codethere now gets the same probe.checkout.mtsruns the probe in the--devparent before the watch supervisor so missing credentials exit instead of hanging. Goal checkit-opens-on-fsd-and-shift-managercovers legs a and c; leg b is explicitly not built yet.Reviewed by Cursor Bugbot for commit 849faa7. Configure here.