The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 21:30 UTC
fix(server): thread cwd through Claude capability probe (#2048) (#2124)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Matt Van Horn committed
Jul 17, 2026 at 14:22 UTC
4e3f2f04d577152672110303b432a72218fe4e61
4 files changed
+17
-4
apps/server/src/provider/Drivers/ClaudeDriver.ts
+3
-2
@@ -119,6 +119,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = {
119
Effect.gen(function* () {
120
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
121
const path = yield* Path.Path;
122
+ const { cwd } = yield* ServerConfig;
123
const httpClient = yield* HttpClient.HttpClient;
124
const serverSettings = yield* ServerSettingsService;
125
const eventLoggers = yield* ProviderEventLoggers;
@@ -154,11 +155,11 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = {
155
capacity: 1,
156
timeToLive: CAPABILITIES_PROBE_TTL,
157
lookup: () =>
157
- probeClaudeCapabilities(effectiveConfig, processEnv).pipe(
158
+ probeClaudeCapabilities(effectiveConfig, processEnv, cwd).pipe(
159
Effect.provideService(Path.Path, path),
160
),
161
});
161
- const capabilitiesCacheKey = yield* makeClaudeCapabilitiesCacheKey(effectiveConfig);
162
+ const capabilitiesCacheKey = yield* makeClaudeCapabilitiesCacheKey(effectiveConfig, cwd);
163
164
const checkProvider = checkClaudeProviderStatus(
165
effectiveConfig,
apps/server/src/provider/Drivers/ClaudeHome.test.ts
+10
-1
@@ -34,11 +34,20 @@ it.layer(NodeServices.layer)("ClaudeHome", (it) => {
34
expect((yield* makeClaudeEnvironment({ homePath })).CLAUDE_CONFIG_DIR).toBe(resolved);
35
expect(yield* makeClaudeContinuationGroupKey({ homePath })).toBe(`claude:home:${resolved}`);
36
expect(yield* makeClaudeCapabilitiesCacheKey({ binaryPath: "claude", homePath })).toBe(
37
- `claude\0${resolved}`,
37
+ `claude\0${resolved}\0`,
38
);
39
}),
40
);
41
42
+ it.effect("separates capability probes by cwd", () =>
43
+ Effect.gen(function* () {
44
+ const config = { binaryPath: "claude", homePath: "" };
45
+ const first = yield* makeClaudeCapabilitiesCacheKey(config, "/repo-a");
46
+ const second = yield* makeClaudeCapabilitiesCacheKey(config, "/repo-b");
47
+ expect(first).not.toBe(second);
48
+ }),
49
+ );
50
+
51
it.effect("keeps continuation compatible across instances with the same Claude HOME", () =>
52
Effect.gen(function* () {
53
const path = yield* Path.Path;
apps/server/src/provider/Drivers/ClaudeHome.ts
+2
-1
@@ -44,8 +44,9 @@ export const makeClaudeContinuationGroupKey = Effect.fn("makeClaudeContinuationG
44
export const makeClaudeCapabilitiesCacheKey = Effect.fn("makeClaudeCapabilitiesCacheKey")(
45
function* (
46
config: Pick<ClaudeSettings, "binaryPath" | "homePath">,
47
+ cwd?: string,
48
): Effect.fn.Return<string, never, Path.Path> {
49
const resolvedHomePath = yield* resolveClaudeHomePath(config);
49
- return `${config.binaryPath}\0${resolvedHomePath}`;
50
+ return `${config.binaryPath}\0${resolvedHomePath}\0${cwd ?? ""}`;
51
},
52
);
apps/server/src/provider/Layers/ClaudeProvider.ts
+2
@@ -583,6 +583,7 @@ function waitForAbortSignal(signal: AbortSignal): Promise<void> {
583
const probeClaudeCapabilities = (
584
claudeSettings: ClaudeSettings,
585
environment?: NodeJS.ProcessEnv,
586
+ cwd?: string,
587
) => {
588
const abort = new AbortController();
589
return Effect.gen(function* () {
@@ -602,6 +603,7 @@ const probeClaudeCapabilities = (
603
settingSources: ["user", "project", "local"],
604
allowedTools: [],
605
env: claudeEnvironment,
606
+ ...(cwd ? { cwd } : {}),
607
stderr: () => {},
608
},
609
});