Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @effect-diagnostics nodeBuiltinImport:off - cleanup uses Node's retrying rm, which the FileSystem service does not expose.
import { ClaudeSettings } from "@t3tools/contracts";
import * as NodeFSP from "node:fs/promises";
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
Expand Down Expand Up @@ -51,8 +53,25 @@ it.layer(NodeServices.layer)("Claude capability probe SDK boundary", (it) => {
const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-probe-sdk-" });
const executablePath = path.join(tempDir, "fake-claude.mjs");
const invocationPath = path.join(tempDir, "invocation.json");
const workspaceCwd = path.join(tempDir, "workspace");
yield* fs.makeDirectory(workspaceCwd, { recursive: true });
// The probe aborts the SDK without awaiting the child's exit, and on
// Windows a directory that is still some process's cwd cannot be
// removed. Keep the workspace outside the scoped directory and let it
// go with a retrying removal once the child has gone.
const workspaceCwd = yield* fs.makeTempDirectory({ prefix: "t3-claude-probe-cwd-" });
// Node's own retry rather than an Effect schedule: it.effect runs on a
// TestClock, so a scheduled retry would wait for time nobody advances.
// If the child still holds the directory after that, an empty temp
// directory is left behind rather than failing the test for it.
yield* Effect.addFinalizer(() =>
Effect.promise(() =>
NodeFSP.rm(workspaceCwd, {
recursive: true,
force: true,
maxRetries: 20,
retryDelay: 250,
}).catch(() => undefined),
),
);
Comment thread
cursor[bot] marked this conversation as resolved.

yield* fs.writeFileString(
executablePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
// @effect-diagnostics nodeBuiltinImport:off
import * as NodeFS from "node:fs";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";

import * as NodeServices from "@effect/platform-node/NodeServices";
Expand Down Expand Up @@ -200,7 +201,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-collab-model-activity"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -292,7 +293,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-collab-model-spawn"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -371,7 +372,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make(`thread-collab-model-${name}`),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -410,7 +411,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-collab-integration"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -552,7 +553,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-collab-stop"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -630,7 +631,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-codex-queued-stop"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "full-access",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down Expand Up @@ -727,7 +728,7 @@ describe("CodexSessionRuntime collab integration", () => {
const runtime = yield* makeCodexSessionRuntime({
threadId: ThreadId.make("thread-codex-mcp-elicitation"),
binaryPath: peerPath,
cwd: "/tmp",
cwd: NodeOS.tmpdir(),
runtimeMode: "auto",
environment: { ...process.env, T3_CODEX_COLLAB_SCRIPT: scriptPath },
});
Expand Down
Loading