Skip to content

fix(gcp): add /usr/local/bin to .spawnrc PATH for npm-global agents#2681

Merged
louisgv merged 1 commit intomainfrom
fix/gcp-kilocode-path
Mar 16, 2026
Merged

fix(gcp): add /usr/local/bin to .spawnrc PATH for npm-global agents#2681
louisgv merged 1 commit intomainfrom
fix/gcp-kilocode-path

Conversation

@la14-1
Copy link
Member

@la14-1 la14-1 commented Mar 16, 2026

Why: GCP VMs install kilocode (and other npm-global agents) to /usr/local/bin via npm install -g. The .spawnrc PATH export relied on $PATH inheriting /usr/local/bin from the SSH/login shell chain, but on GCP VMs the PATH can be minimal depending on how the session is initiated. This causes kilocode: command not found on agent start (issue #2679).

Hetzner works because its VMs have a more standard login shell PATH that includes /usr/local/bin by default.

Summary

  • Add /usr/local/bin explicitly to the .spawnrc PATH export in generateEnvConfig() (shared/agents.ts)
  • Update the mirror PATH in fix.ts to stay in sync with generateEnvConfig()
  • Bump CLI version to 0.19.8

Test plan

  • bash -n sh/gcp/kilocode.sh - syntax check passes
  • bunx @biomejs/biome check src/ - 0 errors
  • bun test - all 1411 tests pass (0 failures)

Fixes #2679

-- refactor/code-health

@la14-1 la14-1 marked this pull request as ready for review March 16, 2026 06:13
GCP VMs install kilocode (and other npm-global agents) to /usr/local/bin
via `npm install -g`. The .spawnrc PATH export relied on $PATH inheriting
/usr/local/bin from the SSH/login shell chain, but on GCP VMs the PATH
can be minimal depending on how the session is initiated (login shell
sourcing order, /etc/profile.d availability). Explicitly include
/usr/local/bin to ensure npm globally-installed binaries are always
findable regardless of base PATH.

Also updates fix.ts to keep its PATH in sync with generateEnvConfig().

Fixes #2679

Agent: code-health
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@la14-1 la14-1 force-pushed the fix/gcp-kilocode-path branch from 5c38ad8 to 28c5988 Compare March 16, 2026 06:50
@la14-1
Copy link
Member Author

la14-1 commented Mar 16, 2026

Resolved merge conflicts via rebase on main. The only conflict was in packages/cli/package.json (version field) — resolved by bumping to 0.20.2 (main is at 0.20.1). Code changes in agents.ts and fix.ts merged cleanly. All 1420 tests pass, lint is clean.

-- refactor/pr-maintainer

Copy link
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: 28c5988

Findings

No security issues identified. The change adds /usr/local/bin to PATH for GCP VMs where npm-global agents (kilocode, windsurf) are installed.

Analysis

  • PATH injection: NONE - hardcoded system directory, properly escaped
  • Command injection: NONE - no user input or dynamic values
  • Shell escaping: CORRECT - proper quoting in generated scripts
  • Credential handling: N/A - no credential changes

Tests

  • bash -n: N/A (TypeScript files)
  • bun test: PASS (1420/1420)
  • biome lint: PASS (0 errors)
  • macOS compat: OK (uses printf/export)

-- security/pr-reviewer

@louisgv louisgv added the security-approved Security review approved label Mar 16, 2026
@louisgv louisgv merged commit e5725b9 into main Mar 16, 2026
5 checks passed
@louisgv louisgv deleted the fix/gcp-kilocode-path branch March 16, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-approved Security review approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(e2e): gcp-kilocode fails with 'kilocode: command not found'

2 participants