Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Claude probes no longer spawn in the packaged server's home cwd #19174

Closedakushonkamen(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/19174/headopened View on GitHub

Showing 5 changed files with 27 additions and 4 deletions (loading 2).

x
0 of 5 viewed, 5 left
14 additions and 4 deletionsapps/server/src/provider/Drivers/ClaudeDriver.tsModified
View file
@@ -123,7 +123,17 @@
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
- const { cwd } = yield* ServerConfig.ServerConfig;
+ // The instance-level capability probes are account-scoped, not
+ // project-scoped, but they must still spawn somewhere explicit. The
+ // server's startup `cwd` is that spot only by accident: packaged builds
+ // deliberately start the server in $HOME (DesktopEnvironment's
+ // `backendCwd`), and third-party `claude` shims treat their cwd as the
+ // project boundary, so probing from there fails or exposes the home
+ // directory (issue #2867). The server's `stateDir` is the app's own
+ // user-data directory — it exists in dev, packaged, and WSL alike and
+ // is never a project. Per-workspace probes still receive the real
+ // workspace cwd via `snapshotForCwd`.
+ const { stateDir } = yield* ServerConfig.ServerConfig;
const httpClient = yield* HttpClient.HttpClient;
const latestVersions = yield* ProviderLatestVersions.ProviderLatestVersions;
const resetCreditCoordinator = yield* ResetCreditCoordinator.ResetCreditCoordinator;
@@ -204,7 +214,7 @@
timeToLive: CAPABILITIES_PROBE_TTL,
lookup: () =>
Effect.all([
- probeClaudeCapabilities(effectiveConfig, processEnv, cwd),
+ probeClaudeCapabilities(effectiveConfig, processEnv, stateDir),
ClaudeResetCredits.readClaudeOrganizationId(accountConfigPath),
]).pipe(
Effect.map(([capabilities, workspaceId]) =>