Skip to content

Commit 2ffa64f

Browse files
fix(server): the Claude trampoline enters its cwd the way chdir does
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8ef1942 commit 2ffa64f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ const CLAUDE_ROOT_REFUSAL =
349349

350350
// The shell enters the cwd: a native cwd blocks the server while a hung mount stalls chdir.
351351
const CLAUDE_GROUP_WATCH_SCRIPT = [
352-
'cd -- "$1" || exit 125',
352+
'cd -P -- "$1" || exit 125',
353353
"shift",
354354
"{ trap '' TERM; read -r _ <&3; kill -TERM 0; sleep 5; kill -KILL 0; } </dev/null >/dev/null 2>&1 &",
355355
'exec "$@" 3<&-',

‎apps/server/src/orchestration-v2/Adapters/ClaudeAgentSdkQueryRunner.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,10 @@ describe.skipIf(HostProcess.Platform.defaultValue() === "win32")("Claude CLI pro
613613
});
614614
assert.deepEqual(yield* run(dir), { code: 0, stdout: `${dir}\n` });
615615
assert.equal((yield* run(NodePath.join(dir, "missing"))).code, 125);
616+
// `..` after a symlink leaves the link's target, as the kernel's chdir does.
617+
NodeFS.mkdirSync(NodePath.join(dir, "target", "sub"), { recursive: true });
618+
NodeFS.symlinkSync(NodePath.join(dir, "target", "sub"), NodePath.join(dir, "link"));
619+
assert.deepEqual(yield* run(`${dir}/link/..`), { code: 0, stdout: `${dir}/target\n` });
616620
}),
617621
);
618622

0 commit comments

Comments
 (0)