Skip to content

Commit b16a2c4

Browse files
fix(server): interrupted manifest and spawn-helper checks run again
The manifest disk load turned an interruption into an empty success, which Cache would keep. The spawn-helper check marked itself done before its filesystem calls, so an interrupted first check was skipped from then on. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent db229f0 commit b16a2c4

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎apps/server/src/provider/ModelManifest.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from "@t3tools/contracts";
2222
import { codexModelFamily } from "@t3tools/shared/model";
2323
import * as Cache from "effect/Cache";
24+
import * as Cause from "effect/Cause";
2425
import * as Clock from "effect/Clock";
2526
import * as Context from "effect/Context";
2627
import * as Effect from "effect/Effect";
@@ -361,7 +362,11 @@ export const make = Effect.gen(function* () {
361362
Effect.gen(function* () {
362363
const fromDisk = yield* fileSystem.readFileString(cachePath).pipe(
363364
Effect.flatMap((raw) => decodeManifestCache(raw)),
364-
Effect.catchCause(() => Effect.succeed(null)),
365+
// An interruption must stay one, or `Cache` would keep this load as a
366+
// successful empty result and never read the disk copy again.
367+
Effect.catchCause((cause) =>
368+
Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.succeed(null),
369+
),
365370
);
366371
if (fromDisk === null) return;
367372
// The disk copy is the last-seen remote manifest, so it outranks the

‎apps/server/src/terminal/NodePtyAdapter.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ const ensureNodePtySpawnHelperExecutable = Effect.fn(function* () {
7474

7575
const helperPath = yield* resolveNodePtySpawnHelperPath;
7676
if (!helperPath) return;
77-
didEnsureSpawnHelperExecutable = true;
7877

79-
if (!(yield* fs.exists(helperPath))) {
80-
return;
78+
if (yield* fs.exists(helperPath)) {
79+
// Best-effort: avoid FileSystem.stat in packaged mode where some fs metadata can be missing.
80+
yield* fs.chmod(helperPath, 0o755).pipe(Effect.orElseSucceed(() => undefined));
8181
}
82-
83-
// Best-effort: avoid FileSystem.stat in packaged mode where some fs metadata can be missing.
84-
yield* fs.chmod(helperPath, 0o755).pipe(Effect.orElseSucceed(() => undefined));
82+
// Set only once the check has finished, so an interrupted check runs again.
83+
didEnsureSpawnHelperExecutable = true;
8584
});
8685

8786
/**

0 commit comments

Comments
 (0)