Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

CodexDriver.test.ts

597 lines23.7 KB

1import * as CodexInstallation from "../CodexInstallation.ts";
2import * as ServerSecretStore from "../../auth/ServerSecretStore.ts";
3import * as ServerEnvironment from "../../environment/ServerEnvironment.ts";
4// @effect-diagnostics nodeBuiltinImport:off
5import * as NodeServices from "@effect/platform-node/NodeServices";
6import * as NodeOS from "node:os";
7import * as NodePath from "node:path";
8import { expect, it } from "@effect/vitest";
9import { EnvironmentId, ProviderInstanceId, ProviderSessionId, ThreadId } from "@t3tools/contracts";
10import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
11import * as Effect from "effect/Effect";
12import * as Deferred from "effect/Deferred";
13import * as Fiber from "effect/Fiber";
14import * as FileSystem from "effect/FileSystem";
15import * as Layer from "effect/Layer";
16import * as Option from "effect/Option";
17import * as PlatformError from "effect/PlatformError";
18import * as Schema from "effect/Schema";
19import * as Sink from "effect/Sink";
20import * as Stream from "effect/Stream";
21import { HttpClient, HttpClientResponse } from "effect/http";
22import * as ChildProcess from "effect/process/ChildProcess";
23import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
24​
25import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
26import * as ServerConfig from "../../config.ts";
27import * as ServerSettings from "../../serverSettings.ts";
28import * as ResetCreditCoordinator from "../resetCreditCoordinator.ts";
29import * as ProviderEventLoggers from "../ProviderEventLoggers.ts";
30import * as ModelManifest from "../ModelManifest.ts";
31import {
32 createProviderVersionAdvisory,
33 ProviderVersionCache,
34 resolveLatestProviderVersion,
35} from "@t3tools/provider-core/server/maintenanceResolver";
36import { CodexDriver } from "./CodexDriver.ts";
37import * as CodexAdapterV2 from "../../orchestration-v2/Adapters/CodexAdapterV2.ts";
38import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
39import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/ProviderAdapter";
40import * as ProviderCredentialStore from "../ProviderCredentialStore.ts";
41import * as ProviderHostLive from "../ProviderHostLive.ts";
42​
43const layerDeps = ServerConfig.layerTest(process.cwd(), {
44 prefix: "t3-codex-driver-maintenance-",
45}).pipe(
46 Layer.provideMerge(NodeServices.layer),
47 Layer.provideMerge(IdAllocator.layer),
48 Layer.provideMerge(
49 Layer.mock(CodexAdapterV2.CodexAppServerClientFactory)({
50 open: () => Effect.die("Maintenance resolution must not open a Codex session"),
51 }),
52 ),
53 Layer.provideMerge(
54 Layer.mock(CodexInstallation.CodexInstallation)({
55 managedDirectory: "unused-managed-installation",
56 }),
57 ),
58 Layer.provideMerge(Layer.mock(ServerSecretStore.ServerSecretStore)({})),
59 Layer.provideMerge(
60 Layer.succeed(ServerEnvironment.ServerEnvironmentIdentity, {
61 getEnvironmentId: Effect.succeed(EnvironmentId.make("00000000-0000-4000-8000-000000000001")),
62 }),
63 ),
64 Layer.provideMerge(ServerSettings.layerTest()),
65 Layer.provideMerge(ModelManifest.layerTest),
66 Layer.provideMerge(ResetCreditCoordinator.layerTest),
67 Layer.provideMerge(
68 Layer.mock(BackgroundPolicy.BackgroundPolicy)({
69 shouldRunScopeWork: () => Effect.succeed(false),
70 }),
71 ),
72 Layer.provideMerge(
73 Layer.succeed(
74 ProviderEventLoggers.ProviderEventLoggers,
75 ProviderEventLoggers.NoOpProviderEventLoggers,
76 ),
77 ),
78 Layer.provideMerge(
79 Layer.succeed(
80 HttpClient.HttpClient,
81 HttpClient.make(() => Effect.die("Disabled Codex must not make an HTTP request")),
82 ),
83 ),
84);
85const layerTest = ProviderHostLive.layer.pipe(Layer.provideMerge(layerDeps));
86​
87// The `#!/bin/sh` stub below cannot be resolved as an executable on Windows.
88const windowsHost = HostProcessPlatform.defaultValue() === "win32";
89​
90const noSpawn = ChildProcessSpawner.make(() =>
91 Effect.die("Disabled Codex must not spawn a process"),
92);
93const encodeCredentials = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
94​
95it.layer(layerTest)("CodexDriver", (it) => {
96 it.effect("disconnect refreshes a restored managed account while its auth flow is idle", () =>
97 Effect.gen(function* () {
98 const instanceId = ProviderInstanceId.make("restored-managed-account");
99 const credentials = new Map<string, Uint8Array>();
100 const secrets = ServerSecretStore.ServerSecretStore.of({
101 get: (key) => Effect.sync(() => Option.fromUndefinedOr(credentials.get(key))),
102 set: (key, value) =>
103 Effect.sync(() => {
104 credentials.set(key, value);
105 }),
106 remove: (key) =>
107 Effect.sync(() => {
108 credentials.delete(key);
109 }),
110 create: () => Effect.die("unused"),
111 getOrCreateRandom: () => Effect.die("unused"),
112 });
113 yield* Effect.gen(function* () {
114 const store = yield* ProviderCredentialStore.make("codex-chatgpt", instanceId);
115 const json = yield* encodeCredentials({
116 clientId: "oaiapp_test",
117 accessToken: "dummy-owned-access",
118 refreshToken: "dummy-refresh",
119 expiresAt: Number.MAX_SAFE_INTEGER,
120 earliestRefreshAt: null,
121 scopes: ["chatgpt.tokens.use.direct"],
122 subject: "test-user",
123 email: "account@example.test",
124 });
125 yield* store.set(new TextEncoder().encode(json));
126 const executable = {
127 executablePath: "/user/bin/codex",
128 managedVersionDirectory: null,
129 source: "local" as const,
130 version: "0.156.1",
131 };
132 const installation = yield* CodexInstallation.CodexInstallation;
133 const serverConfig = yield* ServerConfig.ServerConfig;
134 const sharedHome = NodePath.join(serverConfig.stateDir, "shared-codex-home");
135 const launches: Array<
136 Parameters<CodexAdapterV2.CodexAppServerClientFactoryShape["open"]>[0]
137 > = [];
138 // Sign-out interrupts an account check that is still resolving the runtime.
139 // Interrupt the two startup checks that way (one is the sign-in listener's);
140 // the disconnect below must still refresh.
141 let interruptedChecks = 0;
142 const startupChecksInterrupted = yield* Deferred.make<void>();
143 const acquire = () =>
144 Effect.suspend(() => {
145 if (interruptedChecks === 2) return Effect.succeed(executable);
146 interruptedChecks += 1;
147 return (
148 interruptedChecks === 2
149 ? Deferred.succeed(startupChecksInterrupted, undefined)
150 : Effect.void
151 ).pipe(Effect.andThen(Effect.interrupt));
152 });
153 const instance = yield* CodexDriver.create({
154 instanceId,
155 displayName: "Restored account",
156 enabled: true,
157 environment: [{ name: "OPENAI_API_KEY", value: "ambient-key", sensitive: true }],
158 config: { ...CodexDriver.defaultConfig(), setupMode: "managed", homePath: sharedHome },
159 }).pipe(
160 Effect.provideService(
161 CodexAdapterV2.CodexAppServerClientFactory,
162 CodexAdapterV2.CodexAppServerClientFactory.of({
163 open: (launch) =>
164 Effect.sync(() => launches.push(launch)).pipe(
165 Effect.andThen(Effect.die("The fixture stops after recording the launch")),
166 ),
167 }),
168 ),
169 Effect.provideService(
170 CodexInstallation.CodexInstallation,
171 CodexInstallation.CodexInstallation.of({
172 ...installation,
173 managedDirectory: "unused-managed-installation",
174 resolve: () => Effect.succeed(executable),
175 acquire,
176 }),
177 ),
178 Effect.provideService(
179 ChildProcessSpawner.ChildProcessSpawner,
180 ChildProcessSpawner.make(() =>
181 Effect.fail(
182 PlatformError.badArgument({
183 module: "ChildProcessSpawner",
184 method: "spawn",
185 description: "The fixture app-server is unavailable",
186 }),
187 ),
188 ),
189 ),
190 );
191 const observedAccount = yield* Deferred.make<void>();
192 const disconnected = yield* instance.snapshot.streamChanges.pipe(
193 Stream.tap((provider) =>
194 provider.auth.status === "authenticated"
195 ? Deferred.succeed(observedAccount, undefined).pipe(Effect.asVoid)
196 : Effect.void,
197 ),
198 Stream.filter((provider) => provider.auth.status === "unauthenticated"),
199 Stream.runHead,
200 Effect.forkScoped,
201 );
202 yield* Deferred.await(startupChecksInterrupted);
203 const restored = yield* instance.snapshot.refresh;
204 expect(restored.auth.email).toBe("account@example.test");
205 expect(restored.runtimePaths?.homePath).toBe(sharedHome);
206 expect(restored.runtimePaths?.shadowHomePath).toContain(
207 `providers/codex/${instanceId}/shadow`,
208 );
209 yield* Deferred.await(observedAccount);
210 // Sessions launch the T3-installed Codex with the account's token, not ambient credentials.
211 const threadId = ThreadId.make("managed-account-thread");
212 yield* instance.orchestrationAdapter
213 .openSession({
214 threadId,
215 providerSessionId: ProviderSessionId.make("managed-account-session"),
216 modelSelection: { instanceId, model: "gpt-5.4" },
217 runtimePolicy: ProviderAdapterV2RuntimePolicy.make({
218 runtimeMode: "full-access",
219 interactionMode: "default",
220 cwd: serverConfig.stateDir,
221 }),
222 })
223 .pipe(Effect.scoped, Effect.exit);
224 expect(launches).toHaveLength(1);
225 const launch = launches[0]!;
226 expect(launch.settings.binaryPath).toBe(executable.executablePath);
227 expect(launch.settings.launchArgs).toContain("openai_token_sharing");
228 expect(launch.environment.ACCESS_TOKEN).toBe("dummy-owned-access");
229 expect(launch.environment.OPENAI_API_KEY).toBeUndefined();
230 expect(launch.environment.CODEX_HOME).toBe(launch.settings.homePath);
231 const before = yield* instance.auth!.subscribe("test-owner").pipe(Stream.runHead);
232 expect(Option.getOrThrow(before).phase).toBe("idle");
233 yield* instance.auth!.logout(Effect.void);
234 const after = Option.getOrThrow(yield* Fiber.join(disconnected));
235 expect(after.auth.status).toBe("unauthenticated");
236 expect(after.auth.email).toBeUndefined();
237 expect(after.installed).toBe(true);
238 expect(after.models).toEqual([]);
239 expect(Option.isNone(yield* store.get)).toBe(true);
240 }).pipe(
241 Effect.provideService(ServerSecretStore.ServerSecretStore, secrets),
242 Effect.provideService(
243 HttpClient.HttpClient,
244 HttpClient.make((request) =>
245 Effect.sync(() => {
246 expect([
247 "https://auth.openai.com/.well-known/openid-configuration",
248 "https://auth.openai.com/revoke",
249 "https://api.openai.com/v1/models",
250 ]).toContain(request.url);
251 if (request.url.endsWith("/models"))
252 return HttpClientResponse.fromWeb(request, Response.json({ models: [] }));
253 return HttpClientResponse.fromWeb(
254 request,
255 request.url.endsWith("/revoke")
256 ? new Response(null, { status: 200 })
257 : Response.json({
258 issuer: "https://auth.openai.com",
259 authorization_endpoint: "https://auth.openai.com/api/accounts/authorize",
260 token_endpoint: "https://auth.openai.com/api/accounts/oauth/token",
261 jwks_uri: "https://auth.openai.com/jwks",
262 revocation_endpoint: "https://auth.openai.com/revoke",
263 }),
264 );
265 }),
266 ),
267 ),
268 );
269 }).pipe(Effect.scoped),
270 );
271​
272 it.effect.skipIf(windowsHost)(
273 "runs the standalone updater against the shared home, not the shadow home",
274 () =>
275 Effect.gen(function* () {
276 const fs = yield* FileSystem.FileSystem;
277 const tempDir = yield* fs
278 .makeTempDirectoryScoped({ prefix: "t3-codex-driver-" })
279 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
280 const sharedHome = NodePath.join(tempDir, "codex-home");
281 const shadowHome = NodePath.join(tempDir, "codex-shadow");
282 const binaryPath = NodePath.join(sharedHome, "packages", "standalone", "bin", "codex");
283 yield* fs.makeDirectory(NodePath.dirname(binaryPath), { recursive: true });
284 yield* fs.writeFileString(binaryPath, "#!/bin/sh\n");
285 yield* fs.chmod(binaryPath, 0o755);
286​
287 const instance = yield* CodexDriver.create({
288 instanceId: ProviderInstanceId.make("codex-shadow"),
289 displayName: "Codex test",
290 enabled: false,
291 environment: [],
292 config: {
293 ...CodexDriver.defaultConfig(),
294 binaryPath,
295 homePath: sharedHome,
296 shadowHomePath: shadowHome,
297 },
298 });
299​
300 const capabilities = yield* instance.snapshot.resolveMaintenance();
301 expect(capabilities.update).toMatchObject({
302 executable: binaryPath,
303 args: ["update"],
304 lockKey: "codex-native",
305 env: { CODEX_HOME: sharedHome },
306 });
307 }).pipe(
308 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn),
309 Effect.scoped,
310 ),
311 );
312​
313 it.effect("stays manual-only when the configured executable does not exist", () =>
314 Effect.gen(function* () {
315 const instance = yield* CodexDriver.create({
316 instanceId: ProviderInstanceId.make("codex-missing"),
317 displayName: "Codex test",
318 enabled: false,
319 environment: [],
320 config: {
321 ...CodexDriver.defaultConfig(),
322 binaryPath: NodePath.join(NodeOS.tmpdir(), "t3-codex-missing", "codex"),
323 },
324 });
325 expect((yield* instance.snapshot.resolveMaintenance()).update).toBeNull();
326 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn), Effect.scoped),
327 );
328​
329 for (const fixture of [
330 {
331 name: "leaves mise npm-backend installations manual-only",
332 installSegments: ["mise", "installs", "npm-openai-codex", "0.110.0"],
333 npmOwned: false,
334 },
335 {
336 name: "leaves mise tool aliases backed by npm manual-only",
337 installSegments: ["mise", "installs", "codex", "0.110.0"],
338 npmOwned: false,
339 },
340 {
341 name: "keeps npm updates for globals in a mise Node installation",
342 installSegments: ["mise", "installs", "node", "24.0.0"],
343 npmOwned: true,
344 },
345 {
346 name: "keeps npm updates for ordinary global installations",
347 installSegments: ["npm-global"],
348 npmOwned: true,
349 },
350 ] as const) {
351 it.effect.skipIf(windowsHost)(fixture.name, () =>
352 Effect.gen(function* () {
353 const fs = yield* FileSystem.FileSystem;
354 const tempDir = yield* fs
355 .makeTempDirectoryScoped({ prefix: "t3-codex-installer-" })
356 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
357 const installPath = NodePath.join(tempDir, ...fixture.installSegments);
358 const realBinaryPath = NodePath.join(
359 installPath,
360 "lib",
361 "node_modules",
362 "@openai",
363 "codex",
364 "bin",
365 "codex.js",
366 );
367 const binaryPath = NodePath.join(tempDir, "bin", "codex");
368 yield* fs.makeDirectory(NodePath.dirname(realBinaryPath), { recursive: true });
369 yield* fs.makeDirectory(NodePath.dirname(binaryPath), { recursive: true });
370 yield* fs.writeFileString(realBinaryPath, "#!/bin/sh\n");
371 yield* fs.chmod(realBinaryPath, 0o755);
372 yield* fs.symlink(realBinaryPath, binaryPath);
373​
374 const instance = yield* CodexDriver.create({
375 instanceId: ProviderInstanceId.make("codex-installer"),
376 displayName: "Codex installer test",
377 enabled: false,
378 environment: [],
379 config: {
380 ...CodexDriver.defaultConfig(),
381 binaryPath,
382 homePath: NodePath.join(tempDir, "codex-home"),
383 },
384 });
385​
386 const update = (yield* instance.snapshot.resolveMaintenance()).update;
387 if (fixture.npmOwned) {
388 expect(update).toMatchObject({
389 executable: "npm",
390 args: [
391 "install",
392 "-g",
393 "--prefix",
394 installPath,
395 "--allow-scripts=@openai/codex",
396 "@openai/codex@latest",
397 ],
398 });
399 } else {
400 expect(update).toBeNull();
401 }
402 }).pipe(
403 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn),
404 Effect.scoped,
405 ),
406 );
407 }
408​
409 for (const layout of ["direct", "wrapper"] as const) {
410 it.effect.skipIf(windowsHost)(`leaves a mise ${layout} installation manual-only`, () =>
411 Effect.gen(function* () {
412 const fs = yield* FileSystem.FileSystem;
413 const tempDir = yield* fs
414 .makeTempDirectoryScoped({ prefix: `t3-codex-mise-${layout}-` })
415 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
416 const binaryPath =
417 layout === "direct"
418 ? NodePath.join(tempDir, "mise", "installs", "codex", "0.110.0", "codex")
419 : NodePath.join(tempDir, "omarchy", "bin", "codex");
420 yield* fs.makeDirectory(NodePath.dirname(binaryPath), { recursive: true });
421 yield* fs.writeFileString(
422 binaryPath,
423 layout === "direct"
424 ? "#!/bin/sh\n"
425 : '#!/bin/sh\nmise use -g --quiet "codex" || exit 1\nexec mise x "codex" -- "codex" "$@"\n',
426 );
427 yield* fs.chmod(binaryPath, 0o755);
428​
429 const instance = yield* CodexDriver.create({
430 instanceId: ProviderInstanceId.make(`codex-mise-${layout}`),
431 displayName: "Codex mise test",
432 enabled: false,
433 environment: [],
434 config: {
435 ...CodexDriver.defaultConfig(),
436 binaryPath,
437 homePath: NodePath.join(tempDir, "codex-home"),
438 },
439 });
440​
441 expect((yield* instance.snapshot.resolveMaintenance()).update).toBeNull();
442 }).pipe(
443 Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn),
444 Effect.scoped,
445 ),
446 );
447 }
448​
449 it.effect.each([
450 {
451 name: "conventional shim",
452 dataRoot: "mise",
453 commandName: "codex",
454 version: "0.153.4",
455 nodeFirst: false,
456 },
457 {
458 name: "custom data directory",
459 dataRoot: "custom-tool-data",
460 commandName: "codex",
461 version: "0.153.4",
462 nodeFirst: false,
463 },
464 {
465 name: "renamed configured command",
466 dataRoot: "mise",
467 commandName: "custom-codex",
468 version: "0.153.4",
469 nodeFirst: false,
470 },
471 {
472 name: "outdated provider",
473 dataRoot: "mise",
474 commandName: "codex",
475 version: "0.153.3",
476 nodeFirst: false,
477 },
478 {
479 name: "npm before shim",
480 dataRoot: "mise",
481 commandName: "codex",
482 version: "0.153.4",
483 nodeFirst: true,
484 },
485 ])(
486 "does not mistake Homebrew mise for Codex's installer: $name",
487 (fixture) =>
488 Effect.gen(function* () {
489 const fs = yield* FileSystem.FileSystem;
490 const tempDir = yield* fs
491 .makeTempDirectoryScoped({ prefix: "t3-codex-mise-shim-" })
492 .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
493 const brewPrefix = NodePath.join(tempDir, "homebrew");
494 const brewPath = NodePath.join(brewPrefix, "bin", "brew");
495 const misePath = NodePath.join(brewPrefix, "Cellar", "mise", "2026.9.1", "bin", "mise");
496 const shimDir = NodePath.join(tempDir, fixture.dataRoot, "shims");
497 const npmPrefix = NodePath.join(tempDir, "mise", "installs", "node", "24.13.0");
498 const npmBin = NodePath.join(npmPrefix, "bin");
499 const npmEntry = NodePath.join(
500 npmPrefix,
501 "lib",
502 "node_modules",
503 "@openai",
504 "codex",
505 "bin",
506 "codex.js",
507 );
508 for (const file of [brewPath, misePath, npmEntry]) {
509 yield* fs.makeDirectory(NodePath.dirname(file), { recursive: true });
510 yield* fs.writeFileString(file, "#!/bin/sh\n");
511 yield* fs.chmod(file, 0o755);
512 }
513 yield* fs.makeDirectory(shimDir, { recursive: true });
514 yield* fs.makeDirectory(npmBin, { recursive: true });
515 yield* fs.symlink(misePath, NodePath.join(shimDir, fixture.commandName));
516 yield* fs.symlink(npmEntry, NodePath.join(npmBin, fixture.commandName));
517 const lookupPath = [
518 ...(fixture.nodeFirst ? [npmBin, shimDir] : [shimDir, npmBin]),
519 NodePath.dirname(brewPath),
520 ].join(NodePath.delimiter);
521 const probes: Array<ReadonlyArray<string>> = [];
522 const metadataSpawner = ChildProcessSpawner.make((command) => {
523 if (!ChildProcess.isStandardCommand(command) || command.command !== brewPath) {
524 return Effect.die("Provider resolution must not execute a provider or updater");
525 }
526 probes.push(command.args);
527 const stdout =
528 command.args[0] === "--prefix"
529 ? brewPrefix
530 : JSON.stringify({ formulae: [{ versions: { stable: "2026.9.1" } }] });
531 return Effect.succeed(
532 ChildProcessSpawner.makeHandle({
533 pid: ChildProcessSpawner.ProcessId(1),
534 exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(0)),
535 isRunning: Effect.succeed(false),
536 kill: () => Effect.void,
537 unref: Effect.succeed(Effect.void),
538 stdin: Sink.drain,
539 stdout: Stream.encodeText(Stream.make(stdout)),
540 stderr: Stream.empty,
541 all: Stream.empty,
542 getInputFd: () => Sink.drain,
543 getOutputFd: () => Stream.empty,
544 }),
545 );
546 });
547 const instance = yield* CodexDriver.create({
548 instanceId: ProviderInstanceId.make("codex-mise-shim"),
549 displayName: "Codex shim test",
550 enabled: false,
551 environment: [{ name: "PATH", value: lookupPath, sensitive: false }],
552 config: {
553 ...CodexDriver.defaultConfig(),
554 binaryPath: fixture.commandName,
555 homePath: NodePath.join(tempDir, "codex-home"),
556 },
557 }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, metadataSpawner));
558 const capabilities = yield* instance.snapshot.resolveMaintenance();
559 const latestVersion = yield* resolveLatestProviderVersion(capabilities).pipe(
560 Effect.provideService(
561 ProviderVersionCache,
562 new Map([
563 ["@openai/codex", { expiresAt: Number.MAX_SAFE_INTEGER, version: "0.153.4" }],
564 ]),
565 ),
566 );
567 expect(probes).toEqual([]);
568 expect(latestVersion).toBe("0.153.4");
569 expect(
570 createProviderVersionAdvisory({
571 driver: CodexDriver.driverKind,
572 currentVersion: fixture.version,
573 latestVersion,
574 maintenanceCapabilities: capabilities,
575 }),
576 ).toMatchObject({
577 status: fixture.version === "0.153.4" ? "current" : "behind_latest",
578 currentVersion: fixture.version,
579 latestVersion: "0.153.4",
580 canUpdate: fixture.nodeFirst,
581 });
582 if (fixture.nodeFirst) {
583 expect(capabilities.update).toMatchObject({
584 executable: "npm",
585 args: expect.arrayContaining([
586 "--prefix",
587 yield* fs.realPath(npmPrefix),
588 "@openai/codex@latest",
589 ]),
590 });
591 } else {
592 expect(capabilities.update).toBeNull();
593 }
594 }).pipe(Effect.scoped),
595 { skip: windowsHost },
596 );
597});