Repository navigation
Conversation
Contributor
|
A design question affecting this PR's account-file inheritance has been opened: #5481 |
Closed
2 of 3 tasks
MLA82
added a commit
to MLA82/firstmate
that referenced
this pull request
Sep 28, 2026
…nt profiles # Conflicts: # AGENTS.md # bin/fm-config-inherit-lib.sh # bin/fm-remote-secondmate-control.sh # bin/fm-spawn.sh # docs/architecture.md # docs/configuration.md
MLA82
added a commit
to MLA82/firstmate
that referenced
this pull request
Sep 28, 2026
…guid#4366 and PR kunchenguid#4683 - tests/fm-control-relaunch.test.sh: read the whole recorded launch command instead of the retired inline 'encode launch-brief' grep shape (needed by PR kunchenguid#5288's own new test). - tests/fm-backend-herdr-launcher-workspace-e2e.test.sh: pass FM_HOME to the teardown call explicitly, kept as a precaution. Dropped: the 10s->20s Herdr server poll-budget widening in bin/backends/herdr.sh. It was PR kunchenguid#4683's own fix for its own setsid-wrapped server launch; without kunchenguid#4683, bin/backends/herdr.sh reverts to the original, unmodified 10s poll and needs no widening.
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
Den zweiten Claude-Account
[email protected]dauerhaft und parallel zum bestehenden Claude-Account in Firstmate integrieren, ohne wiederholtes Ab- und Anmelden. Die ganze Flotte soll beide Accounts kennen, bei jedem neuen Claude-Arbeiter beide Kontingente sauber in die Auswahl einbeziehen und den Account mit der besseren tatsächlichen Restkapazität so wählen, dass beide Kontingente sinnvoll und möglichst gleichmäßig genutzt werden. Ein laufender Auftrag darf niemals still auf den anderen Account wechseln. Keine Tokens kopieren oder bestehende Profile überschreiben.What Changed
bin/fm-claude-profile-lib.sh, a new library that validatesconfig/claude-profiles.json, measures each declared Claude account directory in isolation viaquota-axi --provider claude --profile-only --json, and selects the profile with the best applicablespendPriority(ties broken lexically by name); exhausted profiles are excluded and a single invalid/unreachable/unauthenticated profile refuses the whole selection rather than being skipped.bin/fm-spawn.sh: fresh Claude launches select a profile from current isolated quota, relaunches and secondmate recoveries instead re-validate and reuse the previously boundclaude_profile/claude_config_dirfrom task metadata (never reselecting), a legacy task with no prior binding keeps the historical ambientCLAUDE_CONFIG_DIRbehavior, and switching harness away from and back to Claude clears the binding and reselects fresh. The chosen store is exported asCLAUDE_CONFIG_DIRfor both trust registration and the launched worker.bin/fm-remote-secondmate-control.shnow reportsclaude_profile=/claude_config_dir=inprint_route) and through local config inheritance (bin/fm-config-inherit-lib.shaddsclaude-profiles.jsontoFM_INHERITABLE_CONFIGso secondmate homes inherit the same account references without copying credentials).docs/configuration.md("Claude account profiles"), cross-referenced it fromdocs/architecture.md,AGENTS.md, and.agents/skills/harness-adapters/references/harness/claude.md, and recorded isolated-measurement verification evidence indocs/verification/dispatch-auth.md.tests/fm-spawn-dispatch-profile.test.sh(new, covers per-profile quota calls, best-capacity selection, deterministic ties, durable metadata, trust registration, unknown-quota handling, and absent-config backward compatibility),tests/fm-control-relaunch.test.sh(new, proves a bound assignment is not reconsidered on relaunch even if another account later has more capacity), andtests/fm-secondmate-harness.test.sh(updated for the inherited reference-only profile declaration).🤖 Generated with Claude Code
Risk Assessment
✅ Low: The fix round's change is a minimal, well-targeted one-line gate (bin/fm-spawn.sh:3185) plus a matching doc update and a genuine behavioral regression test; it fully closes the previously flagged stale-binding gap (verified against the meta-write path at bin/fm-spawn.sh:4545-4546 and preserve_relaunch_meta at bin/fm-spawn.sh:4524-4531, which now omit/clear claude_profile and claude_config_dir when HARNESS != claude) without introducing new scope or defects.
Testing
Ran the three test suites that exercise this change's product surface (fm-spawn.sh's Claude account-profile selection/binding and fm-control.sh's relaunch/harness-switch handling) as real subprocesses against an isolated FM_HOME with faked external binaries (tmux, quota-axi) — the standard and only practical way to drive this bash CLI orchestrator end-to-end; all passed. To confirm the review-fix commit (a288f15) genuinely fixes the flagged stale-binding defect rather than the test being coincidentally green, I temporarily reverted bin/fm-spawn.sh's one-line guard to its pre-fix form and reran the suite: the new regression test failed exactly as the review finding predicted (binding carried into a non-Claude harness), then restored the fix and confirmed all tests pass again with a clean worktree. No live Herdr-lab session was needed since this change's logic is entirely in meta-file bookkeeping and quota-selection bash logic, not Herdr pane/TUI rendering, and the existing tests already drive the real fm-spawn.sh/fm-control.sh binaries as an end user would invoke them.
quota_loghas 2 entries, one per…Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-spawn.sh:3177- Per docs/configuration.md ("Claude account profiles") this is documented as deliberate: 'Switching an existing non-Claude task to Claude selects and records an account once; switching away preserves the binding so a later switch back returns to the same account.' Concretely: task T spawns fresh on Claude, config/claude-profiles.json has two accounts, quota-based selection binds T to profile 'work' (meta: harness=claude, claude_profile=work). User runsfm-control.sh T relaunch --harness codex(fm-control.sh:913 always passes --harness explicitly on relaunch, and its own comment at line 51 calls harness-switching 'one ordinary use' of relaunch) — this is a fully supported, reachable, ordinary path. At bin/fm-spawn.sh:3186 CLAUDE_PROFILE_NAME is read unconditionally from the pre-relaunch meta (still 'work') before the HARNESS gate at line 3194; because HARNESS is now 'codex', that gate is skipped and CLAUDE_PROFILE_NAME is never cleared, so it is written back into the new meta record (line 4545) even though this task is not running Claude at all. Later,fm-control.sh T relaunch --harness claudereads RELAUNCH_PRIOR_HARNESS='codex' (not 'claude'), but CLAUDE_PROFILE_NAME is still 'work' from the carried-over field, so bin/fm-claude-profile-lib.sh's fm_claude_profile_validate_binding is used instead of fm_claude_profile_select — this brand-new Claude worker reuses whatever account was bound before the codex interlude with NO fresh quota comparison, even though the other account's quota may now be far better. This is reachable during the change's own documented ordinary usage (not a hypothetical path), and it works against the required criterion 'bei jedem neuen Claude-Arbeiter beide Kontingente sauber in die Auswahl einbeziehen und den Account mit der besseren tatsächlichen Restkapazität so wählen ... möglichst gleichmäßig genutzt' — this relaunch is starting a new Claude worker process (the prior Claude worker for this task already exited when it was relaunched onto codex), yet it does not get the quota-based reselection the intent requires for every new Claude worker. The same code path (bin/fm-spawn.sh:3180-3183) is also reachable via non-relaunch secondmate recovery spawns that pass a different explicit harness than the one recorded. Whether task-id identity should durably pin the Claude account across an intervening non-Claude harness leg, or whether that counts as a fresh Claude-worker assignment requiring reselection, is a product-behavior decision already made and documented by the author one way; flagging so the author can confirm it against the stated intent rather than resolving it unilaterally, since the fix (clearing the binding fields when this launch's HARNESS != claude) would remove the currently-documented 'switching away preserves the binding' behavior.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
quota_loghas 2 entries, one per…bash tests/fm-control-relaunch.test.shbash tests/fm-spawn-dispatch-profile.test.shbash tests/fm-secondmate-harness.test.shmanual regression proof: reverted bin/fm-spawn.sh:3185 to the pre-fix unconditional guard, reran tests/fm-control-relaunch.test.sh, confirmed the new test fails, then restored the fixed file and confirmed the full suite passes again✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.