Uh oh!
There was an error while loading. Please reload this page.
fix: persist npm-global PATH to .profile/.bash_profile for SSH reconnect - #2399
Merged
Conversation
…H reconnect After SSH reconnect, agent commands (openclaw, codex, kilocode, junie) were not found because PATH was only written to ~/.bashrc, which is not sourced by login shells. Login shells (used by SSH) source ~/.profile or ~/.bash_profile instead. Changes: - Write .spawnrc sourcing to ~/.profile and ~/.bash_profile in addition to ~/.bashrc and ~/.zshrc (orchestrate.ts) - Write npm-global PATH export to ~/.profile and ~/.bash_profile for all npm-installed agents: OpenClaw, Codex, Kilo Code, Junie (agent-setup.ts) - Write Claude Code PATH to ~/.profile and ~/.bash_profile (agent-setup.ts) - Write OpenCode PATH to ~/.profile and ~/.bash_profile (agent-setup.ts) - Extract NPM_GLOBAL_PATH_PERSIST constant to DRY up repeated shell snippets - Fix e2e provision.sh to also write .spawnrc sourcing to login shell configs - Bump CLI version to 0.15.32 Fixes#2394 Agent: code-health Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
la14-1
marked this pull request as ready for review
March 9, 2026 22:21
louisgv
approved these changes
Mar 9, 2026
louisgv
left a comment
Collaborator
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: 5db5d00
Findings
NONE - All changes are security-clean.
Changes Summary
Extends PATH persistence to cover login shell config files (~/.profile, ~/.bash_profile) in addition to interactive shell configs (~/.bashrc, ~/.zshrc). This fixes npm-global binary availability after SSH reconnect.
Security Analysis
- ✅ All file path variables properly quoted (
"$_rc","$HOME/.zshrc") - ✅ Uses
grep -qF(fixed string matching) - prevents injection - ✅ No user input interpolation in shell commands
- ✅ Base64 env data validated before use (regex check on line 220 of provision.sh)
- ✅ Bash 3.x compatible (
printfinstead ofecho -e, proper quoting) - ✅ curl|bash safe (absolute paths, no
$0/dirnamereliance)
Tests
- ✅ bash -n: PASS (provision.sh syntax check)
- ✅ bun test: PASS (1461/1461 tests, 0 failures)
- ✅ curl|bash: OK (no relative paths, proper escaping)
- ✅ macOS compat: OK (no bash 4+ features, proper
printfusage)
Code Quality
- Consolidates duplicated PATH persistence logic into
NPM_GLOBAL_PATH_PERSISTconstant - Reduces code repetition across 4 agent install functions
- Version appropriately bumped (0.15.31 → 0.15.32)
-- security/pr-reviewer
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Summary
After SSH reconnect, agent commands (
openclaw,codex,kilocode,junie) were not found because PATH exports were only written to~/.bashrc, which is not sourced by login shells. SSH sessions use login shells which source~/.profileor~/.bash_profileinstead.Changes
.spawnrcsourcing to~/.profileand~/.bash_profilein addition to~/.bashrcand~/.zshrc~/.npm-global/binPATH export to~/.profileand~/.bash_profilefor all npm-installed agents (OpenClaw, Codex, Kilo Code, Junie)~/.profileand~/.bash_profileNPM_GLOBAL_PATH_PERSISTconstant to DRY up the repeated shell snippet across 4 agents.spawnrcsourcing to login shell configsFixes#2394
-- refactor/code-health