Open History to see the last commit
1/**
2 * Multi-instance validation slices for `ProviderInstanceRegistryLive`.
3 *
4 * Two axes of the driver/registry refactor are exercised here:
5 *
6 * 1. **Same driver, many instances** — the "multi-instance codex slice"
7 * describe block below configures two independent `codex` instances and
8 * asserts each gets its own closures and identity. This is the
9 * multi-codex capability the refactor exists to unlock.
10 *
11 * 2. **Many drivers, one registry** — the "all drivers slice" describe
12 * block below configures one instance of every shipped driver
13 * (`codex`, `claudeAgent`, `cursor`, `grok`, `opencode`) in a single
14 * `ProviderInstanceConfigMap` and asserts the registry boots them all
15 * without cross-contamination. This proves the driver SPI is uniform
16 * across every provider — any driver plugs into the registry through
17 * the same `ProviderDriver` value contract.
18 *
19 * Every instance in these tests is configured with `enabled: false` so the
20 * provider-status checks short-circuit to pending/disabled snapshots
21 * without trying to spawn real `codex` / `claude` / `agent` / `grok` / `opencode`
22 * binaries. That keeps the assertions focused on registry routing
23 * behaviour rather than the runtime details of each provider.
24 */
25import { describe, expect, it } from "@effect/vitest";
26import * as NodeServices from "@effect/platform-node/NodeServices";
27import {
28 type ClaudeSettings,
29 type CodexSettings,
30 type CursorSettings,
31 type GrokSettings,
32 type OpenCodeSettings,
33 ProviderDriverKind,
34 type ProviderInstanceConfigMap,
35 ProviderInstanceId,
36} from "@t3tools/contracts";
37import { isHostWindows } from "@t3tools/shared/hostProcess";
38import * as DateTime from "effect/DateTime";
39import * as Effect from "effect/Effect";
40import * as FileSystem from "effect/FileSystem";
41import * as Layer from "effect/Layer";
42import * as Path from "effect/Path";
43import * as Stream from "effect/Stream";
44import { HttpClient, HttpClientResponse } from "effect/unstable/http";
45
46import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
47import type { BuiltInDriversEnv } from "../builtInDrivers.ts";
48import { AntigravityInstallation } from "../AntigravityInstallation.ts";
49import { ServerConfig } from "../../config.ts";
50import { expandHomePath } from "../../pathExpansion.ts";
51import { ServerSettingsService } from "../../serverSettings.ts";
52import { ClaudeDriver } from "../Drivers/ClaudeDriver.ts";
53import { CodexDriver } from "../Drivers/CodexDriver.ts";
54import { CursorDriver } from "../Drivers/CursorDriver.ts";
55import { GrokDriver } from "../Drivers/GrokDriver.ts";
56import { OpenCodeDriver } from "../Drivers/OpenCodeDriver.ts";
57import * as ModelManifest from "../ModelManifest.ts";
58import { OpenCodeRuntimeLive } from "../opencodeRuntime.ts";
59import * as CodexResetCredit from "./codexResetCredit.ts";
60import { NoOpProviderEventLoggers, ProviderEventLoggers } from "./ProviderEventLoggers.ts";
61import { makeProviderInstanceRegistry } from "./ProviderInstanceRegistryLive.ts";
62
63const TestHttpClientLive = Layer.succeed(
64 HttpClient.HttpClient,
65 HttpClient.make((request) =>
66 Effect.succeed(HttpClientResponse.fromWeb(request, Response.json({ version: "0.0.0" }))),
67 ),
68);
69
70const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
71
72const BackgroundPolicyAlwaysRunLayer = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
73 reportClientActivity: () => Effect.void,
74 removeRpcClient: () => Effect.void,
75 reportHostPowerState: () => Effect.void,
76 snapshot: Effect.succeed({
77 hostPower: {
78 source: "unknown",
79 idle: "unknown",
80 idleSeconds: null,
81 locked: "unknown",
82 suspended: false,
83 onBattery: "unknown",
84 lowPowerMode: "unknown",
85 thermalState: "unknown",
86 stale: true,
87 updatedAt: TEST_EPOCH,
88 },
89 leases: [],
90 activeForegroundLeaseCount: 0,
91 activeScopeKeys: [],
92 shouldRunOpportunisticWork: true,
93 updatedAt: TEST_EPOCH,
94 }),
95 streamChanges: Stream.empty,
96 hasDemand: () => Effect.succeed(true),
97 shouldRunScopeWork: () => Effect.succeed(true),
98 shouldRunOpportunisticWork: Effect.succeed(true),
99});
100
101const makeCodexConfig = (overrides: Partial<CodexSettings>): CodexSettings => ({
102 enabled: false,
103 binaryPath: "codex",
104 homePath: "",
105 shadowHomePath: "",
106 launchArgs: "",
107 customModels: [],
108 ...overrides,
109});
110
111const makeClaudeConfig = (overrides: Partial<ClaudeSettings>): ClaudeSettings => ({
112 enabled: false,
113 binaryPath: "claude",
114 homePath: "",
115 customModels: [],
116 launchArgs: "",
117 autoCompactWindow: "",
118 ...overrides,
119});
120
121const makeCursorConfig = (overrides: Partial<CursorSettings>): CursorSettings => ({
122 enabled: false,
123 binaryPath: "cursor-agent",
124 apiEndpoint: "",
125 customModels: [],
126 ...overrides,
127});
128
129const makeGrokConfig = (overrides: Partial<GrokSettings>): GrokSettings => ({
130 enabled: false,
131 binaryPath: "grok",
132 customModels: [],
133 ...overrides,
134});
135
136const makeOpenCodeConfig = (overrides: Partial<OpenCodeSettings>): OpenCodeSettings => ({
137 enabled: false,
138 binaryPath: "opencode",
139 serverUrl: "",
140 serverPassword: "",
141 customModels: [],
142 ...overrides,
143});
144
145const makeTildeProviderFixtures = Effect.fn(
146 "ProviderInstanceRegistryLive.test.makeTildeProviderFixtures",
147)(function* () {
148 const fileSystem = yield* FileSystem.FileSystem;
149 const path = yield* Path.Path;
150 const homePath = expandHomePath("~");
151 const fixtureDir = yield* fileSystem.makeTempDirectoryScoped({
152 directory: homePath,
153 prefix: ".t3-provider-path-test-",
154 });
155 const codexPath = path.join(fixtureDir, "codex");
156 const claudePath = path.join(fixtureDir, "claude");
157 const claudeHomePath = path.join(fixtureDir, "claude-home");
158 const codexScriptPath = path.join(fixtureDir, "codex-script.json");
159 const codexFixtureDir = path.join(import.meta.dirname, "../testFixtures");
160
161 yield* fileSystem.copyFile(path.join(codexFixtureDir, "codexCollabMockPeer.sh"), codexPath);
162 yield* fileSystem.copyFile(
163 path.join(codexFixtureDir, "codexCollabMockPeer.mjs"),
164 path.join(fixtureDir, "codexCollabMockPeer.mjs"),
165 );
166 yield* fileSystem.copyFile(
167 path.join(codexFixtureDir, "codexMultiAgentWire.json"),
168 path.join(fixtureDir, "codexMultiAgentWire.json"),
169 );
170 yield* fileSystem.writeFileString(
171 codexScriptPath,
172 // @effect-diagnostics-next-line preferSchemaOverJson:off - fixed script document read by the external Codex mock peer.
173 JSON.stringify({ rootThreadId: "probe-thread", notifications: [] }),
174 );
175 yield* fileSystem.chmod(codexPath, 0o755);
176
177 yield* fileSystem.writeFileString(
178 claudePath,
179 [
180 "#!/usr/bin/env node",
181 'import * as NodeReadline from "node:readline";',
182 'if (process.argv.includes("--version")) {',
183 ' process.stdout.write("claude 2.1.219\\n");',
184 " process.exit(0);",
185 "}",
186 "const lines = NodeReadline.createInterface({ input: process.stdin });",
187 'lines.on("line", (line) => {',
188 " const message = JSON.parse(line);",
189 ' if (message.type !== "control_request" || message.request?.subtype !== "initialize") return;',
190 " process.stdout.write(JSON.stringify({",
191 ' type: "control_response",',
192 " response: {",
193 ' subtype: "success",',
194 " request_id: message.request_id,",
195 " response: {",
196 " commands: [], agents: [], models: [],",
197 ' output_style: "default", available_output_styles: ["default"],',
198 ' account: { email: "test@example.com", subscriptionType: "pro", tokenSource: "oauth" },',
199 " },",
200 " },",
201 ' }) + "\\n");',
202 "});",
203 "setInterval(() => {}, 1_000);",
204 "",
205 ].join("\n"),
206 );
207 yield* fileSystem.chmod(claudePath, 0o755);
208 yield* fileSystem.makeDirectory(claudeHomePath);
209
210 const asTildePath = (filePath: string) => `~/${path.relative(homePath, filePath)}`;
211 return {
212 codexBinaryPath: asTildePath(codexPath),
213 claudeBinaryPath: asTildePath(claudePath),
214 claudeHomePath,
215 codexScriptPath,
216 };
217});
218
219describe("ProviderInstanceRegistryLive — multi-instance codex slice", () => {
220 // `ServerConfig.layerTest` needs `FileSystem` to materialize its scratch
221 // directory. `Layer.merge` just unions requirements, so we have to push
222 // `NodeServices.layer` through `Layer.provideMerge` to satisfy that
223 // dependency while still surfacing NodeServices to the test body (the
224 // codex driver's `create` yields `ChildProcessSpawner` directly).
225 const testLayer = ServerConfig.layerTest(process.cwd(), {
226 prefix: "provider-instance-registry-test",
227 }).pipe(
228 Layer.provideMerge(NodeServices.layer),
229 Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
230 Layer.provideMerge(ServerSettingsService.layerTest()),
231 Layer.provideMerge(TestHttpClientLive),
232 Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
233 Layer.provideMerge(ModelManifest.layerTest),
234 Layer.provideMerge(CodexResetCredit.layerTest),
235 );
236
237 it.live("boots two independent codex instances from a ProviderInstanceConfigMap", () =>
238 Effect.gen(function* () {
239 const personalId = ProviderInstanceId.make("codex_personal");
240 const workId = ProviderInstanceId.make("codex_work");
241 const codexDriverKind = ProviderDriverKind.make("codex");
242
243 const configMap: ProviderInstanceConfigMap = {
244 [personalId]: {
245 driver: codexDriverKind,
246 displayName: "Codex (personal)",
247 enabled: false,
248 config: makeCodexConfig({
249 binaryPath: "/opt/codex-personal/bin/codex",
250 homePath: "/home/julius/.codex_personal",
251 customModels: ["personal-preview"],
252 }),
253 },
254 [workId]: {
255 driver: codexDriverKind,
256 displayName: "Codex (work)",
257 enabled: false,
258 config: makeCodexConfig({
259 binaryPath: "/opt/codex-work/bin/codex",
260 homePath: "/home/julius/.codex",
261 customModels: ["work-preview"],
262 }),
263 },
264 };
265
266 const { registry } = yield* makeProviderInstanceRegistry({
267 drivers: [CodexDriver],
268 configMap,
269 });
270
271 const instances = yield* registry.listInstances;
272 expect(instances.map((instance) => instance.instanceId).toSorted()).toEqual(
273 [personalId, workId].toSorted(),
274 );
275 expect(instances.every((instance) => instance.driverKind === codexDriverKind)).toBe(true);
276 expect(instances.map((instance) => instance.displayName).toSorted()).toEqual(
277 ["Codex (personal)", "Codex (work)"].toSorted(),
278 );
279
280 // Each instance must be retrievable by id and carry its *own* closures.
281 const personal = yield* registry.getInstance(personalId);
282 const work = yield* registry.getInstance(workId);
283 expect(personal).toBeDefined();
284 expect(work).toBeDefined();
285 expect(personal!.adapter).not.toBe(work!.adapter);
286 expect(personal!.textGeneration).not.toBe(work!.textGeneration);
287 expect(personal!.snapshot).not.toBe(work!.snapshot);
288
289 // Snapshots identify themselves by instanceId + driver — this is
290 // what makes per-instance routing distinguishable downstream.
291 const personalSnapshot = yield* personal!.snapshot.getSnapshot;
292 expect(personalSnapshot.instanceId).toBe(personalId);
293 expect(personalSnapshot.driver).toBe(codexDriverKind);
294 expect(personalSnapshot.enabled).toBe(false);
295 // The layout resolves the configured home through the host Path.
296 const path = yield* Path.Path;
297 expect(personalSnapshot.continuation?.groupKey).toBe(
298 `codex:home:${path.resolve("/home/julius/.codex_personal")}`,
299 );
300
301 const workSnapshot = yield* work!.snapshot.getSnapshot;
302 expect(workSnapshot.instanceId).toBe(workId);
303 expect(workSnapshot.driver).toBe(codexDriverKind);
304 expect(workSnapshot.enabled).toBe(false);
305 expect(workSnapshot.continuation?.groupKey).toBe(
306 `codex:home:${path.resolve("/home/julius/.codex")}`,
307 );
308
309 // Nothing goes to the unavailable bucket — both drivers are registered.
310 const unavailable = yield* registry.listUnavailable;
311 expect(unavailable).toEqual([]);
312 }).pipe(Effect.provide(testLayer)),
313 );
314
315 it.live("treats an explicit in-config enabled:false as disabling despite the envelope", () =>
316 Effect.gen(function* () {
317 // Old settings files can carry both flags with conflicting values.
318 // The explicit false must win so a user's disable is never undone.
319 const staleId = ProviderInstanceId.make("codex_stale");
320 const configMap: ProviderInstanceConfigMap = {
321 [staleId]: {
322 driver: ProviderDriverKind.make("codex"),
323 enabled: true,
324 config: makeCodexConfig({ enabled: false }),
325 },
326 };
327
328 const { registry } = yield* makeProviderInstanceRegistry({
329 drivers: [CodexDriver],
330 configMap,
331 });
332
333 const instance = yield* registry.getInstance(staleId);
334 expect(instance).toBeDefined();
335 expect(instance!.enabled).toBe(false);
336 const snapshot = yield* instance!.snapshot.getSnapshot;
337 expect(snapshot.enabled).toBe(false);
338 }).pipe(Effect.provide(testLayer)),
339 );
340
341 it.live("runs Codex and Claude readiness probes from configured tilde paths", () =>
342 Effect.gen(function* () {
343 if (yield* isHostWindows) return;
344
345 const fixtures = yield* makeTildeProviderFixtures();
346
347 const codexId = ProviderInstanceId.make("codex_tilde");
348 const claudeId = ProviderInstanceId.make("claude_tilde");
349 const configMap: ProviderInstanceConfigMap = {
350 [codexId]: {
351 driver: ProviderDriverKind.make("codex"),
352 enabled: true,
353 environment: [
354 {
355 name: "T3_CODEX_COLLAB_SCRIPT",
356 value: fixtures.codexScriptPath,
357 sensitive: false,
358 },
359 ],
360 config: makeCodexConfig({ enabled: true, binaryPath: fixtures.codexBinaryPath }),
361 },
362 [claudeId]: {
363 driver: ProviderDriverKind.make("claudeAgent"),
364 enabled: true,
365 config: makeClaudeConfig({
366 enabled: true,
367 binaryPath: fixtures.claudeBinaryPath,
368 homePath: fixtures.claudeHomePath,
369 }),
370 },
371 };
372
373 const { registry } = yield* makeProviderInstanceRegistry({
374 drivers: [CodexDriver, ClaudeDriver],
375 configMap,
376 });
377 const codex = yield* registry.getInstance(codexId);
378 const claude = yield* registry.getInstance(claudeId);
379 expect(codex).toBeDefined();
380 expect(claude).toBeDefined();
381
382 const [codexSnapshot, claudeSnapshot] = yield* Effect.all(
383 [codex!.snapshot.refresh, claude!.snapshot.refresh],
384 { concurrency: "unbounded" },
385 );
386 expect(codexSnapshot).toMatchObject({ status: "ready", installed: true, version: "0.0.0" });
387 expect(claudeSnapshot).toMatchObject({
388 status: "ready",
389 installed: true,
390 version: "2.1.219",
391 });
392 }).pipe(Effect.provide(testLayer)),
393 );
394
395 it.live(
396 "shadows instances whose driver is not registered in this build without failing boot",
397 () =>
398 Effect.gen(function* () {
399 const codexId = ProviderInstanceId.make("codex_main");
400 const ghostId = ProviderInstanceId.make("ghost_main");
401
402 const configMap: ProviderInstanceConfigMap = {
403 [codexId]: {
404 driver: ProviderDriverKind.make("codex"),
405 enabled: false,
406 config: makeCodexConfig({}),
407 },
408 [ghostId]: {
409 driver: ProviderDriverKind.make("ghostDriver"),
410 displayName: "A fork-only driver we don't ship",
411 enabled: false,
412 config: { arbitrary: "payload", preserved: true },
413 },
414 };
415
416 const { registry } = yield* makeProviderInstanceRegistry({
417 drivers: [CodexDriver],
418 configMap,
419 });
420
421 const instances = yield* registry.listInstances;
422 expect(instances).toHaveLength(1);
423 expect(instances[0]!.instanceId).toBe(codexId);
424
425 const unavailable = yield* registry.listUnavailable;
426 expect(unavailable).toHaveLength(1);
427 const ghost = unavailable[0]!;
428 expect(ghost.instanceId).toBe(ghostId);
429 expect(ghost.driver).toBe("ghostDriver");
430 expect(ghost.availability).toBe("unavailable");
431 expect(ghost.unavailableReason).toMatch(/ghostDriver/);
432 }).pipe(Effect.provide(testLayer)),
433 );
434});
435
436describe("ProviderInstanceRegistryLive — all drivers slice", () => {
437 // All drivers need `NodeServices` (ChildProcessSpawner + FileSystem +
438 // Path). `OpenCodeDriver.create` additionally yields `OpenCodeRuntime`
439 // at construction time, so we wire `OpenCodeRuntimeLive` into the stack.
440 // `OpenCodeRuntimeLive` bundles its own `NetService.layer` via
441 // `Layer.provide`, so the only external requirement it still exposes is
442 // `ChildProcessSpawner` — resolved here by piping it through
443 // `provideMerge(NodeServices.layer)`.
444 //
445 // The nested `provideMerge`s read bottom-up: `NodeServices.layer`
446 // provides `OpenCodeRuntimeLive`'s deps while keeping its own outputs
447 // surfaced; that merged layer then provides `ServerConfig.layerTest`'s
448 // `FileSystem` dep while keeping everything else surfaced to the test.
449 const infraLayer = OpenCodeRuntimeLive.pipe(Layer.provideMerge(NodeServices.layer));
450 const testLayer = AntigravityInstallation.layer.pipe(
451 Layer.provideMerge(
452 ServerConfig.layerTest(process.cwd(), {
453 prefix: "provider-instance-registry-all-drivers-test",
454 }),
455 ),
456 Layer.provideMerge(infraLayer),
457 Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
458 Layer.provideMerge(ServerSettingsService.layerTest()),
459 Layer.provideMerge(TestHttpClientLive),
460 Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
461 Layer.provideMerge(ModelManifest.layerTest),
462 Layer.provideMerge(CodexResetCredit.layerTest),
463 );
464
465 it.live("boots one instance of every shipped driver from a single config map", () =>
466 Effect.gen(function* () {
467 const codexId = ProviderInstanceId.make("codex_default");
468 const claudeId = ProviderInstanceId.make("claude_default");
469 const cursorId = ProviderInstanceId.make("cursor_default");
470 const grokId = ProviderInstanceId.make("grok_default");
471 const openCodeId = ProviderInstanceId.make("opencode_default");
472
473 const codexDriverKind = ProviderDriverKind.make("codex");
474 const claudeDriverKind = ProviderDriverKind.make("claudeAgent");
475 const cursorDriverKind = ProviderDriverKind.make("cursor");
476 const grokDriverKind = ProviderDriverKind.make("grok");
477 const openCodeDriverKind = ProviderDriverKind.make("opencode");
478
479 const configMap: ProviderInstanceConfigMap = {
480 [codexId]: {
481 driver: codexDriverKind,
482 displayName: "Codex",
483 enabled: false,
484 config: makeCodexConfig({ homePath: "/home/julius/.codex" }),
485 },
486 [claudeId]: {
487 driver: claudeDriverKind,
488 displayName: "Claude",
489 enabled: false,
490 config: makeClaudeConfig({
491 homePath: "/home/julius/.claude-work",
492 launchArgs: "--verbose",
493 }),
494 },
495 [cursorId]: {
496 driver: cursorDriverKind,
497 displayName: "Cursor",
498 enabled: false,
499 config: makeCursorConfig({}),
500 },
501 [grokId]: {
502 driver: grokDriverKind,
503 displayName: "Grok",
504 enabled: false,
505 config: makeGrokConfig({}),
506 },
507 [openCodeId]: {
508 driver: openCodeDriverKind,
509 displayName: "OpenCode",
510 enabled: false,
511 config: makeOpenCodeConfig({}),
512 },
513 };
514
515 const { registry } = yield* makeProviderInstanceRegistry<BuiltInDriversEnv>({
516 drivers: [CodexDriver, ClaudeDriver, CursorDriver, GrokDriver, OpenCodeDriver],
517 configMap,
518 });
519
520 // Every configured instance must materialize — none downgraded to a
521 // shadow snapshot, because every driver in the map is registered.
522 const unavailable = yield* registry.listUnavailable;
523 expect(unavailable).toEqual([]);
524
525 const instances = yield* registry.listInstances;
526 expect(instances).toHaveLength(5);
527 expect(instances.map((instance) => instance.instanceId).toSorted()).toEqual(
528 [codexId, claudeId, cursorId, grokId, openCodeId].toSorted(),
529 );
530
531 // Instance lookup by id resolves each instance to its own bundle —
532 // this is how rest-of-server routes turn/session calls in the new
533 // model. Each driver's bundle carries its advertised `driverKind`.
534 const codex = yield* registry.getInstance(codexId);
535 const claude = yield* registry.getInstance(claudeId);
536 const cursor = yield* registry.getInstance(cursorId);
537 const grok = yield* registry.getInstance(grokId);
538 const openCode = yield* registry.getInstance(openCodeId);
539 expect(codex?.driverKind).toBe(codexDriverKind);
540 expect(claude?.driverKind).toBe(claudeDriverKind);
541 expect(cursor?.driverKind).toBe(cursorDriverKind);
542 expect(grok?.driverKind).toBe(grokDriverKind);
543 expect(openCode?.driverKind).toBe(openCodeDriverKind);
544 expect(codex?.displayName).toBe("Codex");
545 expect(claude?.displayName).toBe("Claude");
546 expect(cursor?.displayName).toBe("Cursor");
547 expect(grok?.displayName).toBe("Grok");
548 expect(openCode?.displayName).toBe("OpenCode");
549
550 // Every instance owns its own set of closures — no sharing across
551 // drivers. `adapter` / `textGeneration` / `snapshot` are all
552 // distinct references even when two instances happen to share a
553 // trait (e.g. Cursor + others all use a stub-or-real
554 // `textGeneration`; they must still be different object values).
555 const adapters = [
556 codex!.adapter,
557 claude!.adapter,
558 cursor!.adapter,
559 grok!.adapter,
560 openCode!.adapter,
561 ];
562 expect(new Set(adapters).size).toBe(adapters.length);
563 const textGenerations = [
564 codex!.textGeneration,
565 claude!.textGeneration,
566 cursor!.textGeneration,
567 grok!.textGeneration,
568 openCode!.textGeneration,
569 ];
570 expect(new Set(textGenerations).size).toBe(textGenerations.length);
571 const snapshots = [
572 codex!.snapshot,
573 claude!.snapshot,
574 cursor!.snapshot,
575 grok!.snapshot,
576 openCode!.snapshot,
577 ];
578 expect(new Set(snapshots).size).toBe(snapshots.length);
579
580 // Snapshots identify themselves by `instanceId` + `driver` so
581 // downstream aggregation in `ProviderRegistry` can tell instances
582 // apart even when two share a driver. With `enabled: false`, the
583 // check short-circuits and we get a disabled/pending snapshot back
584 // — that's enough signal to validate the stamping wrapper without
585 // spawning real binaries.
586 const codexSnapshot = yield* codex!.snapshot.getSnapshot;
587 expect(codexSnapshot.instanceId).toBe(codexId);
588 expect(codexSnapshot.driver).toBe(codexDriverKind);
589 expect(codexSnapshot.enabled).toBe(false);
590 expect(codexSnapshot.continuation?.groupKey).toBe(
591 `codex:home:${(yield* Path.Path).resolve("/home/julius/.codex")}`,
592 );
593
594 const claudeSnapshot = yield* claude!.snapshot.getSnapshot;
595 expect(claudeSnapshot.instanceId).toBe(claudeId);
596 expect(claudeSnapshot.driver).toBe(claudeDriverKind);
597 expect(claudeSnapshot.enabled).toBe(false);
598 expect(claudeSnapshot.continuation?.groupKey).toBe(
599 `claude:home:${(yield* Path.Path).resolve("/home/julius/.claude-work")}`,
600 );
601
602 const cursorSnapshot = yield* cursor!.snapshot.getSnapshot;
603 expect(cursorSnapshot.instanceId).toBe(cursorId);
604 expect(cursorSnapshot.driver).toBe(cursorDriverKind);
605 expect(cursorSnapshot.enabled).toBe(false);
606 expect(cursorSnapshot.continuation?.groupKey).toBe(
607 `${cursorDriverKind}:instance:${cursorId}`,
608 );
609
610 const grokSnapshot = yield* grok!.snapshot.getSnapshot;
611 expect(grokSnapshot.instanceId).toBe(grokId);
612 expect(grokSnapshot.driver).toBe(grokDriverKind);
613 expect(grokSnapshot.enabled).toBe(false);
614 expect(grokSnapshot.continuation?.groupKey).toBe(`${grokDriverKind}:instance:${grokId}`);
615
616 const openCodeSnapshot = yield* openCode!.snapshot.getSnapshot;
617 expect(openCodeSnapshot.instanceId).toBe(openCodeId);
618 expect(openCodeSnapshot.driver).toBe(openCodeDriverKind);
619 expect(openCodeSnapshot.enabled).toBe(false);
620 expect(openCodeSnapshot.continuation?.groupKey).toBe(
621 `${openCodeDriverKind}:instance:${openCodeId}`,
622 );
623 }).pipe(Effect.provide(testLayer)),
624 );
625});