fix: preserve callback bridge runtime PATH#9764
Conversation
Forward the prepared Claude runtime PATH when starting the sandbox callback bridge so version-managed Node installations remain resolvable. Co-Authored-By: Paperclip <noreply@paperclip.ing> Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hey @jodylarsen! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
Greptile SummaryThis PR fixes callback-bridge startup failures in remote
Confidence Score: 4/5Safe to merge; the change is additive and isolated to the Claude remote bridge startup path, with a solid regression test and no schema changes. The change is additive and isolated to the Claude remote bridge startup path, with a solid regression test and no schema changes. One minor spread-ordering concern in sandbox-callback-bridge.ts where the custom PATH is placed before ...env rather than after — harmless today because the bridge-env builder never emits a PATH key, but fragile if that changes. The env spread order in packages/adapter-utils/src/sandbox-callback-bridge.ts around line 931 is worth a second look. Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/adapter-utils/src/sandbox-callback-bridge.ts:931-935
The explicit `runtimePath` is spread before `...env`, so if `buildSandboxCallbackBridgeEnv` ever gains a `PATH` key the bridge env would silently shadow the versioned-node path — defeating the entire fix. Moving the `PATH` spread after `...env` ensures the caller-supplied path always wins, regardless of what the bridge-env builder returns.
```suggestion
env: {
[SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE,
...env,
...(input.runtimePath?.trim() ? { PATH: input.runtimePath } : {}),
},
```
Reviews (1): Last reviewed commit: "fix: preserve callback bridge runtime PA..." | Re-trigger Greptile |
| env: { | ||
| [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE, | ||
| ...(input.runtimePath?.trim() ? { PATH: input.runtimePath } : {}), | ||
| ...env, | ||
| }, |
There was a problem hiding this comment.
The explicit
runtimePath is spread before ...env, so if buildSandboxCallbackBridgeEnv ever gains a PATH key the bridge env would silently shadow the versioned-node path — defeating the entire fix. Moving the PATH spread after ...env ensures the caller-supplied path always wins, regardless of what the bridge-env builder returns.
| env: { | |
| [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE, | |
| ...(input.runtimePath?.trim() ? { PATH: input.runtimePath } : {}), | |
| ...env, | |
| }, | |
| env: { | |
| [SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE, | |
| ...env, | |
| ...(input.runtimePath?.trim() ? { PATH: input.runtimePath } : {}), | |
| }, |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/adapter-utils/src/sandbox-callback-bridge.ts
Line: 931-935
Comment:
The explicit `runtimePath` is spread before `...env`, so if `buildSandboxCallbackBridgeEnv` ever gains a `PATH` key the bridge env would silently shadow the versioned-node path — defeating the entire fix. Moving the `PATH` spread after `...env` ensures the caller-supplied path always wins, regardless of what the bridge-env builder returns.
```suggestion
env: {
[SANDBOX_EXEC_CHANNEL_ENV]: SANDBOX_EXEC_CHANNEL_BRIDGE,
...env,
...(input.runtimePath?.trim() ? { PATH: input.runtimePath } : {}),
},
```
How can I resolve this? If you propose a fix, please make it concise.
Thinking Path
Linked Issues or Issue Description
claude_localsandbox can successfully install and resolve a versioned Node runtime for the adapter process, while callback-bridge startup still fails withnohup: failed to run command nodebecause bridge startup does not receive the adapter runtimePATH.What Changed
PATHinto the remote callback bridge.Verification
pnpm exec vitest run packages/adapter-utils/src/sandbox-callback-bridge.test.ts packages/adapter-utils/src/execution-target-sandbox.test.ts— 40/40 passed.pnpm --filter @paperclipai/adapter-utils typecheck— passed.pnpm --filter @paperclipai/adapter-claude-local typecheck— passed.Risks
PATHcould still prevent Node resolution; rollback is reverting commit38874536and redeploying the previous artifact.Model Used
gpt-5.6-sol), reasoning and tool-use mode with repository editing, shell execution, and test verification.Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template#NNN/github.com/paperclipai/paperclipURLs)Made with Cursor