| 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 | 119 | Effect.gen(function* () { |
| 120 | 120 | const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; |
| 121 | 121 | const path = yield* Path.Path; |
| 122 | const { cwd } = yield* ServerConfig; | |
| 122 | 123 | const httpClient = yield* HttpClient.HttpClient; |
| 123 | 124 | const serverSettings = yield* ServerSettingsService; |
| 124 | 125 | const eventLoggers = yield* ProviderEventLoggers; |
| ... | ... | @@ -154,11 +155,11 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = { |
| 154 | 155 | capacity: 1, |
| 155 | 156 | timeToLive: CAPABILITIES_PROBE_TTL, |
| 156 | 157 | lookup: () => |
| 157 | probeClaudeCapabilities(effectiveConfig, processEnv).pipe( | |
| 158 | probeClaudeCapabilities(effectiveConfig, processEnv, cwd).pipe( | |
| 158 | 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 | 164 | const checkProvider = checkClaudeProviderStatus( |
| 164 | 165 | effectiveConfig, |
apps/server/src/provider/Drivers/ClaudeHome.test.ts+10-1| ... | ... | @@ -34,11 +34,20 @@ it.layer(NodeServices.layer)("ClaudeHome", (it) => { |
| 34 | 34 | expect((yield* makeClaudeEnvironment({ homePath })).CLAUDE_CONFIG_DIR).toBe(resolved); |
| 35 | 35 | expect(yield* makeClaudeContinuationGroupKey({ homePath })).toBe(`claude:home:${resolved}`); |
| 36 | 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 | 51 | it.effect("keeps continuation compatible across instances with the same Claude HOME", () => |
| 43 | 52 | Effect.gen(function* () { |
| 44 | 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 | 44 | export const makeClaudeCapabilitiesCacheKey = Effect.fn("makeClaudeCapabilitiesCacheKey")( |
| 45 | 45 | function* ( |
| 46 | 46 | config: Pick<ClaudeSettings, "binaryPath" | "homePath">, |
| 47 | cwd?: string, | |
| 47 | 48 | ): Effect.fn.Return<string, never, Path.Path> { |
| 48 | 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 | 583 | const probeClaudeCapabilities = ( |
| 584 | 584 | claudeSettings: ClaudeSettings, |
| 585 | 585 | environment?: NodeJS.ProcessEnv, |
| 586 | cwd?: string, | |
| 586 | 587 | ) => { |
| 587 | 588 | const abort = new AbortController(); |
| 588 | 589 | return Effect.gen(function* () { |
| ... | ... | @@ -602,6 +603,7 @@ const probeClaudeCapabilities = ( |
| 602 | 603 | settingSources: ["user", "project", "local"], |
| 603 | 604 | allowedTools: [], |
| 604 | 605 | env: claudeEnvironment, |
| 606 | ...(cwd ? { cwd } : {}), | |
| 605 | 607 | stderr: () => {}, |
| 606 | 608 | }, |
| 607 | 609 | }); |