Skip to content

Commit de6c728

Browse files
t3dotggclaude
andcommitted
fix(server): keep an interrupted Scratch probe from caching a miss
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 15cc5ca commit de6c728

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎apps/server/src/ws.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,18 +1806,20 @@ const makeWsRpcLayer = (
18061806
// Scratch threads run in a plain folder under the data dir. Inside a
18071807
// checkout (a dev worktree's .t3, a dotfiles home) that folder would
18081808
// inherit the repo's git status and checkpoints, so it is only offered
1809-
// when the data dir is outside any work tree. Detection failures fail
1810-
// closed and hide the folder, never the config.
1809+
// when the data dir is outside any work tree. Detection failures and
1810+
// defects fail closed and hide the folder, never the config.
18111811
// Probed once per connection: a negative VCS detection is not cached.
1812-
// A cached probe memoizes an interrupt exit too, so a config load that
1813-
// is cancelled mid-probe invalidates it and the next load probes again.
1812+
// An interrupt stays an interrupt, so a config load cancelled mid-probe
1813+
// invalidates the cache and the next load probes again.
18141814
const [cachedScratchWorkspaceRoot, invalidateScratchWorkspaceRoot] =
18151815
yield* Effect.cachedInvalidateWithTTL(
18161816
gitWorkflow.isRepository(config.baseDir).pipe(
18171817
Effect.map((isRepository) =>
18181818
isRepository ? undefined : path.resolve(config.baseDir, "scratch"),
18191819
),
1820-
Effect.catchCause(() => Effect.succeed(undefined)),
1820+
Effect.catchCause((cause) =>
1821+
Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.succeed(undefined),
1822+
),
18211823
),
18221824
Duration.infinity,
18231825
);

0 commit comments

Comments
 (0)