Skip to content

Commit 525c3e2

Browse files
committed
fix(server): Codex no longer offers a one-click update for installs it can't detect
codex update only recognizes npm, Homebrew, and $CODEX_HOME standalone installs. Codex installs at any other path now resolve to manual-only instead of falling back to the native updater, which always failed. Part of #22487.
1 parent ca140c4 commit 525c3e2

3 files changed

Lines changed: 41 additions & 5 deletions

File tree

‎apps/server/src/provider/Drivers/CodexDriver.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ function makeCodexMaintenanceResolver(sharedHomePath: string) {
7676
nativeUpdate: {
7777
args: ["update"],
7878
isCommandPath: isCodexStandaloneCommandPath,
79+
requiresCommandPath: true,
7980
env: { CODEX_HOME: sharedHomePath },
8081
},
8182
});

‎packages/provider-core/src/server/maintenanceResolver.test.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,39 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {
417417
}),
418418
);
419419

420+
it.effect(
421+
"keeps an unrecognized install manual-only when the native updater requires its path",
422+
() =>
423+
Effect.gen(function* () {
424+
const systemPath =
425+
"/usr/local/lib/codex/releases/rust-v0.162.1-x86_64-unknown-linux-musl/bin/codex";
426+
const capabilities = yield* resolvePackageManagedProviderMaintenance(
427+
{
428+
provider: driver("codex"),
429+
npmPackageName: "@openai/codex",
430+
nativeUpdate: {
431+
args: ["update"],
432+
isCommandPath: isNativeTestCommandPath("/packages/standalone/"),
433+
requiresCommandPath: true,
434+
},
435+
},
436+
{
437+
binaryPath: "codex",
438+
resolvedCommandPath: "/usr/local/bin/codex",
439+
realCommandPath: systemPath,
440+
env: {},
441+
platform: "linux",
442+
},
443+
).pipe(
444+
Effect.provideService(HostProcess.Platform, "linux"),
445+
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, noSpawn),
446+
);
447+
448+
expect(capabilities.update).toBeNull();
449+
expect(capabilities.installPath).toBe(systemPath);
450+
}),
451+
);
452+
420453
const claudeUpdate = {
421454
provider: driver("claudeAgent"),
422455
npmPackageName: "@anthropic-ai/claude-code",

‎packages/provider-core/src/server/maintenanceResolver.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export interface PackageManagedProviderMaintenanceDefinition {
8585
readonly nativeUpdate: {
8686
readonly args: ReadonlyArray<string>;
8787
readonly isCommandPath?: (commandPath: string) => boolean;
88+
/** The updater cannot detect installs outside `isCommandPath`, so leave those manual-only. */
89+
readonly requiresCommandPath?: boolean;
8890
readonly env?: NodeJS.ProcessEnv;
8991
} | null;
9092
}
@@ -474,11 +476,11 @@ export const resolvePackageManagedProviderMaintenance = Effect.fn(
474476
}
475477
// A `node_modules` path not proven below belongs to another package or a
476478
// project, so the provider's own updater could act on the wrong install.
477-
const fallback = commandPaths.some((commandPath) =>
478-
normalizeCommandPath(commandPath).includes("/node_modules/"),
479-
)
480-
? manual
481-
: native;
479+
const fallback =
480+
nativeUpdate?.requiresCommandPath ||
481+
commandPaths.some((commandPath) => normalizeCommandPath(commandPath).includes("/node_modules/"))
482+
? manual
483+
: native;
482484
if (commandPaths.some(isVitePlusGlobalCommandPath)) {
483485
return makeProviderMaintenanceCapabilities({
484486
provider: definition.provider,

0 commit comments

Comments
 (0)