Skip to content

runtime: detect Codex package layout#23596

Merged
bolinfest merged 1 commit into
mainfrom
pr23596
May 20, 2026
Merged

runtime: detect Codex package layout#23596
bolinfest merged 1 commit into
mainfrom
pr23596

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented May 20, 2026

Why

The package-builder stack now creates a canonical Codex package directory where the entrypoint lives under bin/, bundled helper resources live under codex-resources/, and bundled PATH-style tools live under codex-path/. That layout is not specific to the standalone installer: npm, brew, install scripts, and manually unpacked artifacts should all be able to use the same package shape.

The Rust runtime still only knew about the legacy standalone release layout, where resources sit next to the executable. A packaged binary therefore would not identify its package root or prefer the bundled rg from codex-path/.

What changed

  • Adds CodexPackageLayout to codex-install-context and detects it from an executable path shaped like <package>/bin/<entrypoint> when <package>/codex-package.json is present.
  • Splits InstallContext into an install method plus an optional package layout so the layout is shared across npm, bun, brew, standalone, and other launch contexts.
  • Stores package-layout paths as AbsolutePathBuf values.
  • Keeps codex-resources/ and codex-path/ optional so Codex can still run with degraded behavior if sidecar directories are missing.
  • Updates InstallContext::rg_command() to prefer bundled codex-path/rg or rg.exe, then fall back to the legacy standalone resources location, then system rg.
  • Updates codex doctor reporting so package installs show package, bin, resources, and path directories, and so bundled search detection recognizes codex-path/ for any install method.

Test plan

  • cargo test -p codex-install-context
  • cargo test -p codex-cli
  • cargo test -p codex-tui update_action::tests::maps_install_context_to_update_action
  • just bazel-lock-check

Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Rechecked the current head after the force-push; no additional security or correctness issues found.

Base automatically changed from pr23582 to main May 20, 2026 05:43
bolinfest added a commit that referenced this pull request May 20, 2026
## Why

Release CI already builds the Codex entrypoints before staging
artifacts, and the package builder can now package those prebuilt
binaries directly. The workflow should produce package-shaped sidecar
archives from the same staged entrypoints that downstream distribution
channels will eventually consume, without rebuilding `codex` or
`codex-app-server` inside the packaging step.

This intentionally does **not** publish the new package archives as
GitHub Release assets yet. The archives are kept with workflow artifacts
until npm, Homebrew, `install.sh`, winget, and related consumers are
ready to switch over.

## What changed

- Adds a `Build Codex package archive` step to
`.github/workflows/rust-release.yml` after target artifacts are staged.
- Runs `scripts/build_codex_package.py` for both release bundles:
- `primary` builds `codex-package-${TARGET}.tar.gz` with `--variant
codex`.
- `app-server` builds `codex-app-server-package-${TARGET}.tar.gz` with
`--variant codex-app-server`.
- Passes `--entrypoint-bin target/${TARGET}/release/<entrypoint>` so
packages contain the entrypoint already built by the workflow.
- Deletes both package archive names before the final GitHub Release
upload so they remain workflow artifacts only for now.

## Verification

- Parsed `.github/workflows/rust-release.yml` with Ruby's YAML loader.








---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/23582).
* #23596
* __->__ #23582
@bolinfest bolinfest enabled auto-merge (squash) May 20, 2026 05:55
@bolinfest bolinfest disabled auto-merge May 20, 2026 06:02
@bolinfest bolinfest merged commit cfa16fc into main May 20, 2026
47 of 62 checks passed
@bolinfest bolinfest deleted the pr23596 branch May 20, 2026 06:13
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants