Skip to content

fix(fm-spawn): forward Anthropic API env vars to crewmate panes for Pioneer/TokenRouter lanes - #1433

Open
jwalin-shah wants to merge 3 commits into
kunchenguid:mainfrom
jwalin-shah:fm/fm-spawn-env-forwarding
Open

fix(fm-spawn): forward Anthropic API env vars to crewmate panes for Pioneer/TokenRouter lanes#1433
jwalin-shah wants to merge 3 commits into
kunchenguid:mainfrom
jwalin-shah:fm/fm-spawn-env-forwarding

Conversation

@jwalin-shah

Copy link
Copy Markdown

Intent

Forward ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, and model discovery env vars (ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL) from firstmate's environment into the crewmate launch command in bin/fm-spawn.sh, so crewmates authenticate against the correct provider for Pioneer/TokenRouter lanes. The existing CLAUDE_CONFIG_DIR forwarding for the claude harness is preserved unchanged.

What Changed

  • bin/fm-spawn.sh: Forward ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL from firstmate's environment into the crewmate launch command, so crewmates authenticate against the correct provider for Pioneer/TokenRouter lanes. Only prepended when the corresponding env var is set; unset values are skipped. The existing CLAUDE_CONFIG_DIR forwarding for the claude harness is preserved unchanged.
  • tests/fm-spawn-dispatch-profile.test.sh: Pin all five ANTHROPIC_* env vars to empty in run_spawn() to prevent env-leak flakiness from the developer's shell. Add three new tests covering the forwarding behavior: when vars are set (all harnesses), when vars are unset (no prefix emitted), and verification that forwarding applies to all harnesses, not only claude.

Risk Assessment

✅ Low: Change is well-bounded, follows existing patterns, has good test coverage, and fully conforms to the stated user intent.

Testing

Ran the full fm-spawn-dispatch-profile test suite (28 tests). All passed, including the 3 new tests for ANTHROPIC_* env var forwarding (set, unset, and all-harnesses cases) and the 3 existing CLAUDE_CONFIG_DIR tests confirming the existing behavior is preserved. The evidence file is at /var/folders/sj/b3pb98ls4mx03dx50srzyq380000gn/T/no-mistakes-evidence/01KYX34J92A4GH76FWE1M1HTAB/fm-spawn-dispatch-profile-test-output.txt.

Evidence: Full test suite run
ok - no --model/--effort records defaults and types the claude launch instructions
ok - relative home overrides ignore CDPATH and become absolute before spawn launch construction
ok - FM_HOME defaults resolve relative paths and preserve absolute spellings
ok - absolute override spellings are preserved in spawn launch paths
ok - unresolvable relative spawn overrides fail with named diagnostics
ok - active crew-dispatch profile requires an explicit harness for ship spawns
ok - active crew-dispatch profile requires an explicit harness for scout spawns
ok - active crew-dispatch profile allows an explicit resolved harness
ok - active crew-dispatch profile allows the legacy positional harness form
ok - active crew-dispatch profile allows the raw launch-command escape hatch
ok - claude receives --model and --effort profile flags
ok - codex receives --model and model_reasoning_effort profile flags
ok - codex omits unsupported max effort instead of passing a bad config value
ok - grok receives --model and --reasoning-effort profile flags
ok - grok omits unsupported max reasoning effort
ok - grok omits unsupported xhigh reasoning effort
ok - opencode receives --model and omits the unsupported effort axis
ok - pi receives --model and --thinking max profile flags
ok - pi-signed shares Pi launch semantics while preserving its configured and recorded identity
ok - pi-signed refuses safely and actionably when the selected executable is unavailable
ok - pi-signed is a distinct persistent secondmate runtime with shared Pi supervision semantics
ok - batch dispatch forwards shared --harness, --model, and --effort to every pair
ok - claude forwards firstmate's CLAUDE_CONFIG_DIR so the crewmate uses the same credential store
ok - claude omits the config-dir prefix when firstmate runs with the single-store default
ok - non-claude harnesses do not receive the claude CLAUDE_CONFIG_DIR prefix
ok - active crew-dispatch profile does not block secondmate launches
ok - claude forwards firstmate's ANTHROPIC_* env vars so the crewmate authenticates against the same provider
ok - claude omits the ANTHROPIC_* env prefix when firstmate runs with default credentials
ok - ANTHROPIC_* env vars are forwarded for all harnesses, not just claude
# all fm-spawn-dispatch-profile tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-spawn-dispatch-profile.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Bridge CI and others added 3 commits July 31, 2026 14:45
…ioneer/TokenRouter lanes

Forward ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, and model discovery env vars
(ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL,
ANTHROPIC_DEFAULT_HAIKU_MODEL) from firstmate's environment into the crewmate
launch command. The pane daemon does not inherit firstmate's environment, so
these must be prefixed onto the launch command for the crewmate to authenticate
against the correct provider.

The existing CLAUDE_CONFIG_DIR forwarding for the claude harness is preserved
unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant