@@ -99,19 +99,19 @@ describe("ProviderCommandReactor", () => { |
99 | 99 | let scope: Scope.Closeable | null = null; |
100 | 100 | const createdStateDirs = new Set<string>(); |
101 | 101 | const createdBaseDirs = new Set<string>(); |
| 102 | + // Per-run workspace dirs so concurrent test runs don't race on the same path. |
| 103 | + // The reactor's existence guard checks these before starting a provider session. |
| 104 | + let workspaceRoot = ""; |
| 105 | + let workspaceWorktree = ""; |
102 | 106 |
|
103 | | - // The workspace existence guard in ProviderCommandReactor checks that the |
104 | | - // project's workspaceRoot exists on disk before starting a provider session. |
105 | | - // Create the paths the suite uses once for the whole run. |
106 | | - const WORKSPACE_ROOT = "/tmp/provider-project"; |
107 | | - const WORKSPACE_WORKTREE = "/tmp/provider-project-worktree"; |
108 | 107 | beforeAll(() => { |
109 | | - NodeFS.mkdirSync(WORKSPACE_ROOT, { recursive: true }); |
110 | | - NodeFS.mkdirSync(WORKSPACE_WORKTREE, { recursive: true }); |
| 108 | + workspaceRoot = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3code-ws-")); |
| 109 | + workspaceWorktree = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3code-wt-")); |
111 | 110 | }); |
| 111 | + |
112 | 112 | afterAll(() => { |
113 | | - NodeFS.rmSync(WORKSPACE_ROOT, { recursive: true, force: true }); |
114 | | - NodeFS.rmSync(WORKSPACE_WORKTREE, { recursive: true, force: true }); |
| 113 | + NodeFS.rmSync(workspaceRoot, { recursive: true, force: true }); |
| 114 | + NodeFS.rmSync(workspaceWorktree, { recursive: true, force: true }); |
115 | 115 | }); |
116 | 116 |
|
117 | 117 | afterEach(async () => { |
@@ -444,7 +444,7 @@ describe("ProviderCommandReactor", () => { |
444 | 444 | commandId: CommandId.make("cmd-project-create"), |
445 | 445 | projectId: asProjectId("project-1"), |
446 | 446 | title: "Provider Project", |
447 | | - workspaceRoot: input?.workspaceRoot ?? "/tmp/provider-project", |
| 447 | + workspaceRoot: input?.workspaceRoot ?? workspaceRoot, |
448 | 448 | defaultModelSelection: modelSelection, |
449 | 449 | createdAt: now, |
450 | 450 | }), |
@@ -552,7 +552,7 @@ describe("ProviderCommandReactor", () => { |
552 | 552 | await waitFor(() => harness.sendTurn.mock.calls.length === 1); |
553 | 553 | expect(harness.startSession.mock.calls[0]?.[0]).toEqual(ThreadId.make("thread-1")); |
554 | 554 | expect(harness.startSession.mock.calls[0]?.[1]).toMatchObject({ |
555 | | - cwd: "/tmp/provider-project", |
| 555 | + cwd: workspaceRoot, |
556 | 556 | modelSelection: { |
557 | 557 | instanceId: ProviderInstanceId.make("codex"), |
558 | 558 | model: "gpt-5-codex", |
@@ -680,7 +680,7 @@ describe("ProviderCommandReactor", () => { |
680 | 680 | effectIt.effect("rejects a turn when the workspace directory no longer exists", () => |
681 | 681 | Effect.gen(function* () { |
682 | 682 | const harness = yield* Effect.promise(() => |
683 | | - createHarness({ workspaceRoot: "/tmp/provider-project-missing" }), |
| 683 | + createHarness({ workspaceRoot: "/tmp/t3code-definitely-missing-" + process.pid }), |
684 | 684 | ); |
685 | 685 | const now = "2026-01-01T00:00:00.000Z"; |
686 | 686 |
|
@@ -828,7 +828,7 @@ describe("ProviderCommandReactor", () => { |
828 | 828 |
|
829 | 829 | expect(harness.generateThreadTitle).toHaveBeenCalledTimes(1); |
830 | 830 | expect(harness.generateThreadTitle.mock.calls[0]?.[0]).toMatchObject({ |
831 | | - cwd: "/tmp/provider-project", |
| 831 | + cwd: workspaceRoot, |
832 | 832 | previousTitle: "Investigate reconnect regressions", |
833 | 833 | message: [ |
834 | 834 | "USER:", |
@@ -1519,7 +1519,7 @@ describe("ProviderCommandReactor", () => { |
1519 | 1519 | commandId: CommandId.make("cmd-thread-branch"), |
1520 | 1520 | threadId: ThreadId.make("thread-1"), |
1521 | 1521 | branch: "t3code/1234abcd", |
1522 | | - worktreePath: "/tmp/provider-project-worktree", |
| 1522 | + worktreePath: workspaceWorktree, |
1523 | 1523 | }), |
1524 | 1524 | ); |
1525 | 1525 |
|
@@ -1560,7 +1560,7 @@ describe("ProviderCommandReactor", () => { |
1560 | 1560 | expect(harness.generateBranchName.mock.calls[0]?.[0]).toMatchObject({ |
1561 | 1561 | message: "Add a safer reconnect backoff.", |
1562 | 1562 | }); |
1563 | | - expect(harness.refreshStatus.mock.calls[0]?.[0]).toBe("/tmp/provider-project-worktree"); |
| 1563 | + expect(harness.refreshStatus.mock.calls[0]?.[0]).toBe(workspaceWorktree); |
1564 | 1564 | }); |
1565 | 1565 |
|
1566 | 1566 | it("forwards codex model options through session start and turn send", async () => { |
@@ -2053,15 +2053,15 @@ describe("ProviderCommandReactor", () => { |
2053 | 2053 | await waitFor(() => harness.startSession.mock.calls.length === 1); |
2054 | 2054 | await waitFor(() => harness.sendTurn.mock.calls.length === 1); |
2055 | 2055 | expect(harness.startSession.mock.calls[0]?.[1]).toMatchObject({ |
2056 | | - cwd: "/tmp/provider-project", |
| 2056 | + cwd: workspaceRoot, |
2057 | 2057 | }); |
2058 | 2058 |
|
2059 | 2059 | await Effect.runPromise( |
2060 | 2060 | harness.engine.dispatch({ |
2061 | 2061 | type: "thread.meta.update", |
2062 | 2062 | commandId: CommandId.make("cmd-thread-worktree-change"), |
2063 | 2063 | threadId: ThreadId.make("thread-1"), |
2064 | | - worktreePath: "/tmp/provider-project-worktree", |
| 2064 | + worktreePath: workspaceWorktree, |
2065 | 2065 | }), |
2066 | 2066 | ); |
2067 | 2067 |
|
@@ -2087,7 +2087,7 @@ describe("ProviderCommandReactor", () => { |
2087 | 2087 | expect(harness.stopSession.mock.calls.length).toBe(0); |
2088 | 2088 | expect(harness.startSession.mock.calls[1]?.[1]).toMatchObject({ |
2089 | 2089 | threadId: ThreadId.make("thread-1"), |
2090 | | - cwd: "/tmp/provider-project-worktree", |
| 2090 | + cwd: workspaceWorktree, |
2091 | 2091 | resumeCursor: { opaque: "resume-1" }, |
2092 | 2092 | modelSelection: { |
2093 | 2093 | instanceId: ProviderInstanceId.make("claudeAgent"), |
@@ -2620,7 +2620,7 @@ describe("ProviderCommandReactor", () => { |
2620 | 2620 | status: "ready", |
2621 | 2621 | runtimeMode: "approval-required", |
2622 | 2622 | threadId: ThreadId.make("thread-1"), |
2623 | | - cwd: "/tmp/provider-project", |
| 2623 | + cwd: workspaceRoot, |
2624 | 2624 | resumeCursor: { opaque: "resume-without-instance" }, |
2625 | 2625 | createdAt: now, |
2626 | 2626 | updatedAt: now, |
|