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

CodexDriver.test.ts

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