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