Skip to content

Commit 0893a65

Browse files
committed
fix(claude): resolve task output from physical launch cwd
1 parent 95b0888 commit 0893a65

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7972,24 +7972,29 @@ describe("ClaudeAdapterV2 background wake turns", () => {
79727972
);
79737973

79747974
it.effect.skipIf(process.getuid === undefined)(
7975-
"tails foreground Bash output under the cwd the query launched in, not the session's",
7975+
"tails foreground Bash output under the physical cwd the query launched in",
79767976
() =>
79777977
Effect.scoped(
79787978
Effect.gen(function* () {
79797979
const fileSystem = yield* FileSystem.FileSystem;
79807980
const path = yield* Path.Path;
7981-
const launchCwd = yield* fileSystem.makeTempDirectoryScoped({
7981+
const root = yield* fileSystem.makeTempDirectoryScoped({
79827982
prefix: "t3-claude-task-output-cwd-",
79837983
});
7984+
const physicalCwd = path.join(root, "real", "project");
7985+
const launchCwd = path.join(root, "link");
7986+
yield* fileSystem.makeDirectory(physicalCwd, { recursive: true });
7987+
yield* fileSystem.symlink(physicalCwd, launchCwd);
79847988
// The session opens in /workspace; a relative TMPDIR puts Claude's
79857989
// task files under whichever cwd the CLI was launched in. Linux,
79867990
// because Claude Code's macOS build ignores TMPDIR.
7987-
const harness = yield* makeWakeHarnessWithOptions({ environment: { TMPDIR: "tmp" } });
7991+
const harness = yield* makeWakeHarnessWithOptions({ environment: { TMPDIR: "../tmp" } });
79887992
const now = yield* DateTime.now;
79897993
const toolUseId = "toolu_foreground_bash";
79907994
const taskId = "foreground-bash-task";
79917995
const tasks = path.join(
7992-
launchCwd,
7996+
root,
7997+
"real",
79937998
"tmp",
79947999
`claude-${process.getuid?.()}`,
79958000
"project",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10006,7 +10006,9 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1000610006
taskOutputRoot: claudeTaskOutputRoot(
1000710007
adapterOptions.environment,
1000810008
path,
10009-
turnInput.runtimePolicy.cwd,
10009+
yield* fileSystem
10010+
.realPath(turnInput.runtimePolicy.cwd ?? ".")
10011+
.pipe(Effect.orElseSucceed(() => turnInput.runtimePolicy.cwd)),
1001010012
hostPlatform,
1001110013
),
1001210014
};

0 commit comments

Comments
 (0)