-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Use codex update for standalone installs #3626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
BearHuddleston
wants to merge
9
commits into
pingdotgg:main
from
BearHuddleston:codex/codex-standalone-update-command
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
594e1c1
fix codex standalone update command
BearHuddleston 58bd576
address codex standalone update review
BearHuddleston e89a0a2
handle legacy codex standalone paths
BearHuddleston b065023
clarify native update default executable
BearHuddleston b49bd08
stabilize native update advisory commands
BearHuddleston 56a21f9
track provider update action identity
BearHuddleston 971ec3e
detect versioned codex standalone installs and pin update env
BearHuddleston 36e391a
fix provider maintenance update edge cases
BearHuddleston 2d6adf5
track attempted provider update environments
BearHuddleston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| import { describe, expect, it } from "@effect/vitest"; | ||
|
|
||
| import { | ||
| deriveCodexStandaloneUpdateEnvironment, | ||
| isCodexStandaloneCommandPath, | ||
| resolveCodexProviderMaintenanceCapabilities, | ||
| } from "./CodexDriver.ts"; | ||
|
|
||
| describe("isCodexStandaloneCommandPath", () => { | ||
| it("matches current-symlink standalone layouts", () => { | ||
| expect( | ||
| isCodexStandaloneCommandPath("/home/u/.codex/packages/standalone/current/bin/codex"), | ||
| ).toBe(true); | ||
| expect(isCodexStandaloneCommandPath("/home/u/.codex/packages/standalone/current/codex")).toBe( | ||
| true, | ||
| ); | ||
| }); | ||
|
|
||
| it("matches the versioned release binary the current symlink resolves to", () => { | ||
| expect( | ||
| isCodexStandaloneCommandPath( | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/codex", | ||
| ), | ||
| ).toBe(true); | ||
| expect( | ||
| isCodexStandaloneCommandPath( | ||
| "C:\\Users\\u\\.codex\\packages\\standalone\\releases\\0.111.0-x86_64-pc-windows-msvc\\codex.EXE", | ||
| ), | ||
| ).toBe(true); | ||
| }); | ||
|
|
||
| it("rejects paths outside a standalone install", () => { | ||
| expect(isCodexStandaloneCommandPath("/home/u/.local/bin/codex")).toBe(false); | ||
| expect(isCodexStandaloneCommandPath("/usr/lib/node_modules/@openai/codex/bin/codex.js")).toBe( | ||
| false, | ||
| ); | ||
| expect( | ||
| isCodexStandaloneCommandPath("/home/u/monorepo/packages/standalone/node_modules/.bin/codex"), | ||
| ).toBe(false); | ||
| expect( | ||
| isCodexStandaloneCommandPath( | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0/notes/codex.txt", | ||
| ), | ||
| ).toBe(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe("deriveCodexStandaloneUpdateEnvironment", () => { | ||
| it("pins CODEX_HOME to the install root of the matched binary", () => { | ||
| expect( | ||
| deriveCodexStandaloneUpdateEnvironment( | ||
| "/home/julius/codex-home/packages/standalone/current/codex", | ||
| ), | ||
| ).toEqual({ CODEX_HOME: "/home/julius/codex-home" }); | ||
| expect( | ||
| deriveCodexStandaloneUpdateEnvironment( | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/codex", | ||
| ), | ||
| ).toEqual({ CODEX_HOME: "/home/u/.codex" }); | ||
| expect( | ||
| deriveCodexStandaloneUpdateEnvironment( | ||
| "C:\\Users\\u\\.codex\\packages\\standalone\\releases\\1.0.0\\codex.exe", | ||
| ), | ||
| ).toEqual({ CODEX_HOME: "C:\\Users\\u\\.codex" }); | ||
| }); | ||
|
|
||
| it("returns null when no install root precedes the standalone segment", () => { | ||
| expect(deriveCodexStandaloneUpdateEnvironment("/packages/standalone/current/codex")).toBeNull(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("resolveCodexProviderMaintenanceCapabilities", () => { | ||
| it.each([ | ||
| { | ||
| label: "bare command", | ||
| binaryPath: "codex", | ||
| resolvedCommandPath: "/home/u/.local/bin/codex", | ||
| expectedExecutable: "/home/u/.local/bin/codex", | ||
| }, | ||
| { | ||
| label: "current alias", | ||
| binaryPath: "/home/u/.codex/packages/standalone/current/codex", | ||
| resolvedCommandPath: "/home/u/.codex/packages/standalone/current/codex", | ||
| expectedExecutable: "/home/u/.codex/packages/standalone/current/codex", | ||
| }, | ||
| { | ||
| label: "visible alias", | ||
| binaryPath: "/usr/local/bin/codex", | ||
| resolvedCommandPath: "/usr/local/bin/codex", | ||
| expectedExecutable: "/usr/local/bin/codex", | ||
| }, | ||
| ])("allows native updates for a $label with a versioned release realpath", (testCase) => { | ||
| expect( | ||
| resolveCodexProviderMaintenanceCapabilities({ | ||
| binaryPath: testCase.binaryPath, | ||
| platform: "linux", | ||
| resolvedCommandPath: testCase.resolvedCommandPath, | ||
| realCommandPath: | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/codex", | ||
| }), | ||
| ).toEqual({ | ||
| provider: "codex", | ||
| packageName: "@openai/codex", | ||
| update: { | ||
| command: `CODEX_HOME=/home/u/.codex ${testCase.expectedExecutable} update`, | ||
| executable: testCase.expectedExecutable, | ||
| args: ["update"], | ||
| lockKey: "codex-native", | ||
| env: { CODEX_HOME: "/home/u/.codex" }, | ||
| }, | ||
| }); | ||
| }); | ||
|
|
||
| it.each([ | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/codex", | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/bin/codex", | ||
| ])("disables one-click updates for an explicitly configured release path: %s", (binaryPath) => { | ||
| expect( | ||
| resolveCodexProviderMaintenanceCapabilities({ | ||
| binaryPath, | ||
| resolvedCommandPath: binaryPath, | ||
| realCommandPath: binaryPath, | ||
| }), | ||
| ).toEqual({ | ||
| provider: "codex", | ||
| packageName: "@openai/codex", | ||
| update: null, | ||
| }); | ||
| }); | ||
|
|
||
| it("disables one-click updates when a bare command resolves directly to a release", () => { | ||
| const releasePath = | ||
| "/home/u/.codex/packages/standalone/releases/0.111.0-x86_64-unknown-linux-musl/codex"; | ||
|
|
||
| expect( | ||
| resolveCodexProviderMaintenanceCapabilities({ | ||
| binaryPath: "codex", | ||
| resolvedCommandPath: releasePath, | ||
| realCommandPath: releasePath, | ||
| }), | ||
| ).toEqual({ | ||
| provider: "codex", | ||
| packageName: "@openai/codex", | ||
| update: null, | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.