fix(bin): forward PI_CODING_AGENT_DIR to Pi crewmates - #3494
Open
pperanich wants to merge 1 commit into
Open
Conversation
Crewmate panes are created by the long-lived tmux/herdr daemon and do not inherit firstmate's environment. A primary running under an alternate Pi profile (PI_CODING_AGENT_DIR) therefore spawned pi and pi-signed crewmates on the default ~/.pi/agent, with whatever model, packages, and extensions live there instead of the profile the primary was launched with. Forward PI_CODING_AGENT_DIR onto pi and pi-signed launches only when it is set, mirroring the CLAUDE_CONFIG_DIR forwarding for claude crewmates. Pin the variable empty in the dispatch-profile test harness so launch assertions cannot depend on the developer's shell, and add the set, unset, and non-pi-harness cases beside the claude ones.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or repository-policy issues identified. The new assignment is safely quoted, reaches both supported Pi harnesses through their shared launch path, remains a direct interactive command, and leaves unset and non-Pi launches unchanged. Reviews (1): Last reviewed commit: "fix(spawn): forward PI_CODING_AGENT_DIR ..." | Re-trigger Greptile |
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
Forward PI_CODING_AGENT_DIR onto pi and pi-signed crewmate launches in bin/fm-spawn.sh, only when it is set, exactly mirroring how PR #1195 forwards CLAUDE_CONFIG_DIR for claude crewmates. Motivation: crewmate panes come from the long-lived tmux/herdr daemon and do not inherit the primary's environment, so a firstmate primary started under an alternate Pi profile (PI_CODING_AGENT_DIR pointing at a profile with different settings, packages, extensions, auth) spawned crewmates on the default ~/.pi/agent profile. Verified by reading fm-spawn.sh and backends/tmux.sh (send-keys into a new window of the firstmate session) and by launching a pi worker in a fresh tmux shell. Deliberate decisions: keep the change minimal (no new profile concept, no pinning, unlike the stale PRs #877/#966); apply to both pi and pi-signed since both share the Pi launch template; place the block directly after the CLAUDE_CONFIG_DIR block with a matching comment; never prefix when the variable is unset so the default single-profile path is byte-identical to before. Tests: in tests/fm-spawn-dispatch-profile.test.sh pin PI_CODING_AGENT_DIR empty in run_spawn (opt-in via FM_TEST_PI_CODING_AGENT_DIR) and in the four ad-hoc spawn invocations that already pin CLAUDE_CONFIG_DIR, so assertions never depend on the developer's shell; add three cases mirroring the claude ones: pi forwards when set, pi omits the prefix when unset, a non-pi harness (claude) ignores it. No docs changed, matching PR #1195's file set. Commit follows Conventional Commits with no AI attribution.
What Changed
PI_CODING_AGENT_DIRin spawn fixtures and cover forwarding, omission, and non-Pi behavior.PI_CODING_AGENT_DIRtopiandpi-signedcrewmates while leaving other launches unchanged.Risk Assessment
✅ Low: The change is narrowly scoped, matches the CLAUDE_CONFIG_DIR precedent, safely quotes the value, covers both Pi harnesses, preserves the unset path, and adds behavior-level spawn tests.
Testing
After repository bootstrap, the targeted suite and focused cases passed. The base source failed the new forwarding test as expected, while the end-to-end CLI transcript showed the profile prefix on
piandpi-signedlaunches and nowhere else. The worktree remained clean.Evidence: End-to-end Pi spawn transcript
Source: End-to-end Pi spawn transcript
Evidence: Baseline regression reproduction
Source: Baseline regression reproduction
Evidence: Dispatch-profile test log
Source: Dispatch-profile test log
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.
Repository bootstrap:bin/fm-session-start.shAutomated behavior suite:bash tests/fm-spawn-dispatch-profile.test.shFocused selectors:test_pi_forwards_firstmate_coding_agent_dir_when_set,test_pi_omits_coding_agent_dir_prefix_when_unset, andtest_non_pi_harness_ignores_coding_agent_dirFocusedpi-signedspawn assertion through the shared Pi launch pathRegression reproduction: targettest_pi_forwards_firstmate_coding_agent_dir_when_setexecuted against54663948647a41e21b289d9992159b1bdc3bb6ca:bin/fm-spawn.shEvidence-producing executable check throughfm-spawn.shand captured tmux payloads for set Pi, set Pi Signed, unset Pi, and Claude✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.