| author | |
| committer | |
| log | 4e3f2f04d577152672110303b432a72218fe4e61 |
| tree | 60068a9baf1ed5eced0700da46e23f013c9400c3 |
| parent | 1047dac0c5296b1c548e607f061f95227a706b49 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Julius Marminge <julius0216@outlook.com>4 files changed, 17 insertions(+), 4 deletions(-)
apps/server/src/provider/Drivers/ClaudeDriver.ts+3-2| ... | @@ -119,6 +119,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = { | ... | @@ -119,6 +119,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = { |
| 119 | Effect.gen(function* () { | 119 | Effect.gen(function* () { |
| 120 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; | 120 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; |
| 121 | const path = yield* Path.Path; | 121 | const path = yield* Path.Path; |
| 122 | const { cwd } = yield* ServerConfig; | ||
| 122 | const httpClient = yield* HttpClient.HttpClient; | 123 | const httpClient = yield* HttpClient.HttpClient; |
| 123 | const serverSettings = yield* ServerSettingsService; | 124 | const serverSettings = yield* ServerSettingsService; |
| 124 | const eventLoggers = yield* ProviderEventLoggers; | 125 | const eventLoggers = yield* ProviderEventLoggers; |
| ... | @@ -154,11 +155,11 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = { | ... | @@ -154,11 +155,11 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = { |
| 154 | capacity: 1, | 155 | capacity: 1, |
| 155 | timeToLive: CAPABILITIES_PROBE_TTL, | 156 | timeToLive: CAPABILITIES_PROBE_TTL, |
| 156 | lookup: () => | 157 | lookup: () => |
| 157 | probeClaudeCapabilities(effectiveConfig, processEnv).pipe( | 158 | probeClaudeCapabilities(effectiveConfig, processEnv, cwd).pipe( |
| 158 | Effect.provideService(Path.Path, path), | 159 | Effect.provideService(Path.Path, path), |
| 159 | ), | 160 | ), |
| 160 | }); | 161 | }); |
| 161 | const capabilitiesCacheKey = yield* makeClaudeCapabilitiesCacheKey(effectiveConfig); | 162 | const capabilitiesCacheKey = yield* makeClaudeCapabilitiesCacheKey(effectiveConfig, cwd); |
| 162 | 163 | ||
| 163 | const checkProvider = checkClaudeProviderStatus( | 164 | const checkProvider = checkClaudeProviderStatus( |
| 164 | effectiveConfig, | 165 | effectiveConfig, |
apps/server/src/provider/Drivers/ClaudeHome.test.ts+10-1| ... | @@ -34,11 +34,20 @@ it.layer(NodeServices.layer)("ClaudeHome", (it) => { | ... | @@ -34,11 +34,20 @@ it.layer(NodeServices.layer)("ClaudeHome", (it) => { |
| 34 | expect((yield* makeClaudeEnvironment({ homePath })).CLAUDE_CONFIG_DIR).toBe(resolved); | 34 | expect((yield* makeClaudeEnvironment({ homePath })).CLAUDE_CONFIG_DIR).toBe(resolved); |
| 35 | expect(yield* makeClaudeContinuationGroupKey({ homePath })).toBe(`claude:home:${resolved}`); | 35 | expect(yield* makeClaudeContinuationGroupKey({ homePath })).toBe(`claude:home:${resolved}`); |
| 36 | expect(yield* makeClaudeCapabilitiesCacheKey({ binaryPath: "claude", homePath })).toBe( | 36 | expect(yield* makeClaudeCapabilitiesCacheKey({ binaryPath: "claude", homePath })).toBe( |
| 37 | `claude\0${resolved}`, | 37 | `claude\0${resolved}\0`, |
| 38 | ); | 38 | ); |
| 39 | }), | 39 | }), |
| 40 | ); | 40 | ); |
| 41 | 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 | |||
| 42 | it.effect("keeps continuation compatible across instances with the same Claude HOME", () => | 51 | it.effect("keeps continuation compatible across instances with the same Claude HOME", () => |
| 43 | Effect.gen(function* () { | 52 | Effect.gen(function* () { |
| 44 | const path = yield* Path.Path; | 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,8 +44,9 @@ export const makeClaudeContinuationGroupKey = Effect.fn("makeClaudeContinuationG |
| 44 | export const makeClaudeCapabilitiesCacheKey = Effect.fn("makeClaudeCapabilitiesCacheKey")( | 44 | export const makeClaudeCapabilitiesCacheKey = Effect.fn("makeClaudeCapabilitiesCacheKey")( |
| 45 | function* ( | 45 | function* ( |
| 46 | config: Pick<ClaudeSettings, "binaryPath" | "homePath">, | 46 | config: Pick<ClaudeSettings, "binaryPath" | "homePath">, |
| 47 | cwd?: string, | ||
| 47 | ): Effect.fn.Return<string, never, Path.Path> { | 48 | ): Effect.fn.Return<string, never, Path.Path> { |
| 48 | const resolvedHomePath = yield* resolveClaudeHomePath(config); | 49 | const resolvedHomePath = yield* resolveClaudeHomePath(config); |
| 49 | return `${config.binaryPath}\0${resolvedHomePath}`; | 50 | return `${config.binaryPath}\0${resolvedHomePath}\0${cwd ?? ""}`; |
| 50 | }, | 51 | }, |
| 51 | ); | 52 | ); |
apps/server/src/provider/Layers/ClaudeProvider.ts+2| ... | @@ -583,6 +583,7 @@ function waitForAbortSignal(signal: AbortSignal): Promise<void> { | ... | @@ -583,6 +583,7 @@ function waitForAbortSignal(signal: AbortSignal): Promise<void> { |
| 583 | const probeClaudeCapabilities = ( | 583 | const probeClaudeCapabilities = ( |
| 584 | claudeSettings: ClaudeSettings, | 584 | claudeSettings: ClaudeSettings, |
| 585 | environment?: NodeJS.ProcessEnv, | 585 | environment?: NodeJS.ProcessEnv, |
| 586 | cwd?: string, | ||
| 586 | ) => { | 587 | ) => { |
| 587 | const abort = new AbortController(); | 588 | const abort = new AbortController(); |
| 588 | return Effect.gen(function* () { | 589 | return Effect.gen(function* () { |
| ... | @@ -602,6 +603,7 @@ const probeClaudeCapabilities = ( | ... | @@ -602,6 +603,7 @@ const probeClaudeCapabilities = ( |
| 602 | settingSources: ["user", "project", "local"], | 603 | settingSources: ["user", "project", "local"], |
| 603 | allowedTools: [], | 604 | allowedTools: [], |
| 604 | env: claudeEnvironment, | 605 | env: claudeEnvironment, |
| 606 | ...(cwd ? { cwd } : {}), | ||
| 605 | stderr: () => {}, | 607 | stderr: () => {}, |
| 606 | }, | 608 | }, |
| 607 | }); | 609 | }); |