Repository navigation
feat(bin): add named Claude profile pools with auth preflight before spawn - #3
Merged
Merged
Conversation
…ult-preflight fixtures
…configuration docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
we wanted to a local fork..... slim changes
What Changed
--claude-profile <id>flag tofm-spawn.shfor local crewmate and scout spawns. The flag is refused on secondmate spawns and on any spawn that resolves to a non-claude harness. A named profile maps to aconfig_dirin the new per-homeconfig/claude-profiles.json. The spawn checks that profile first with the newbin/fm-claude-auth.sh check --profile <id>, which uses a newclaude auth statusprobe infm-vendor-auth-probe.shand confirms first-run onboarding is complete. It refuses to launch if the profile is unconfigured, unauthenticated, indeterminate, or not onboarded, or if a raw launch command sets its ownCLAUDE_CONFIG_DIR. When the check passes, the checked store is used for workspace-trust registration and as the worker'sCLAUDE_CONFIG_DIR. The default profile is not checked and keeps the current behavior of reusing the caller'sCLAUDE_CONFIG_DIR.claude_profile.fm-control.sh relaunchkeeps that profile when the harness stays claude, and it runs the auth check before stopping the running agent, so a failed check leaves the agent running. The relaunch journal and output now show the profile.fm-dispatch-resolve.shacceptclaude_profileon claude-harness profiles only, count it when checking for duplicate profiles, and include it in candidate lines and in the resolvedprofile:line as--claude-profile.config/claude-profiles.jsonis deliberately left out of config inheritance. The change also updates the configuration, agent-control, architecture, dispatch-auth verification and Claude harness docs, and adds tests for the new helper, spawn, relaunch, dispatch resolution and the probe.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The fix round reverted grok version parsing to the base sed line and removed the stale default-preflight fixtures. The remaining change is a narrow opt-in preflight for named Claude pools. Default Claude launches stay ambient as before, and tracing the relaunch, trust-store and dispatch paths found no wrong-result case.
Testing
I drove the real bin/fm-spawn.sh and bin/fm-control.sh inside a throwaway fm-lab-* Herdr session, provisioned and torn down through bin/fm-herdr-lab.sh; the default session was untouched and its tripwire held. The real Claude CLI launched in the lab panes. I read each running claude process's environment from /proc to see which CLAUDE_CONFIG_DIR store it got. Results: - A default spawn keeps the ambient store, makes no auth-status call, and records no claude_profile. - A--claude-profile claude-max-aspawn launches claude on the pool's store, writes workspace trust into that store, and records claude_profile=claude-max-a. - A pool whose store the real CLI reports as logged out is refused before any pane or task record is created. - An unconfigured pool id, the flag on a non-claude harness, and a raw launch command that sets its own CLAUDE_CONFIG_DIR are each refused before launch. - fm-control relaunch onto a recorded pool that is now logged out is refused before the stop step: the old claude process and pane stay alive and no relaunch journal is written. I also ran the real probe and check directly against the real logged-in store and an empty store. The five targeted suites (fm-claude-auth, fm-vendor-auth-probe including grok, fm-dispatch-resolve, fm-control-relaunch, fm-spawn-dispatch-profile) all pass. Everything I could drive passed. I did not drive a successful relaunch onto a pool live, because that needs a second logged-in, onboarded Claude account. This is CLI and TUI routing, not a visual UI change, so the evidence is transcripts and process-environment captures rather than screenshots. Afterwards I removed the lab's orphaned treehouse pool dirs.Evidence: Live Herdr lab transcript (S1-S4, S6)
Source: Live Herdr lab transcript (S1-S4, S6)
Evidence: Live Herdr lab driver script
Source: Live Herdr lab driver script
Evidence: Real claude probe and fm-claude-auth check transcript
Source: Real claude probe and fm-claude-auth check transcript
Evidence: Live claude process pinned to the named pool store
Evidence: Targeted suite logs
Source: Targeted suite logs
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 2 issues found → auto-fixed ✅
bin/fm-vendor-auth-probe.sh:186- In round 1 the user chose to fix 'grok-version-refactor', which asked to leave the grok path unchanged. The grok version path still changed. grok_version no longer uses the originalsed -nE 's/.*[^0-9]([0-9]+\.[0-9]+\.[0-9]+).*/\1/p', which takes the last semver on the line and needs a non-digit before it. It now usesgrep -oE ... | head -n 1, which takes the first semver. Example: agrok --versionline that contains two version strings now gives a different VERSION, and so possibly a different versionVerified. The Claude preflight does not need this change. Fix: restore the original sed line in grok_version so the grok probe matches the base.tests/fm-backend.test.sh:47- In round 1 the user chose to fix 'stale-default-preflight-fixtures', but most of those leftovers from the dropped default-profile preflight are still here. (1) tests/fm-backend.test.sh:47-49 says 'A claude spawn is refused unless the default profile's ambient store probes logged in and has finished first-run onboarding' and onboards SPAWN_HOME. The same fm_test_onboard_claude_store setup appears in fm-backend-orca.test.sh:19 and fm-trace-context-spawn.test.sh. (2) fm-secondmate-harness.test.sh:444-457 and 700-713 add fake claude CLIs with the comment 'The Claude profile preflight runs the bounded vendor probe before every claude launch'. Lines 481-482 and 725-726 onboard stores with the comment 'A claude secondmate is refused until its store finished first-run onboarding'. Both claims are false now: default launches are not preflighted, and secondmates refuse --claude-profile. (3) fm-dispatch-resolve.test.sh:26-31 writes a claude-profiles.json with id 'default' (which the helper rejects), a .credentials.json holding a fake refresh token, and an onboarded store. Lines 158-176 add a fake claude CLI that dispatch never calls. (4) tests/fixtures.sh adds FM_FAKE_CLAUDE_LOGGED_IN / FM_TEST_NO_CLAUDE_AUTH plumbing for the removed default probe. Fix: revert these fixture and comment edits in the non-profile suites and keep only what the named-pool tests use.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bin/fm-vendor-auth-probe.sh claudeagainst the real logged-in ambient store and against an empty temp CLAUDE_CONFIG_DIR (real claude 2.1.276)bin/fm-claude-auth.sh check --profile <id>for four profiles: the real ~/.claude store, an empty store, an unconfigured id, anddefaultLive Herdr labclaude-profile-herdr-lab.sh(evidence dir) viabin/fm-herdr-lab.sh provision/run/teardownon session fm-lab-claudeprof-*: S1 default spawn, S2 named pool spawn, S3 logged-out pool refusal, S4 unconfigured/non-claude/raw-CLAUDE_CONFIG_DIR refusals, S6 fm-control relaunch refusal before stopbash tests/fm-claude-auth.test.shbash tests/fm-vendor-auth-probe.test.shbash tests/fm-dispatch-resolve.test.shbash tests/fm-control-relaunch.test.shbash tests/fm-spawn-dispatch-profile.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.