Skip to content

build: default Codex package target and output#23541

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

build: default Codex package target and output#23541
bolinfest merged 1 commit into
mainfrom
pr23541

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented May 19, 2026

Why

The package builder should be easy to run during local iteration. Requiring callers to provide both a target triple and an output directory every time makes the common host-package case more awkward than necessary.

This PR keeps explicit overrides available, but makes the default invocation useful: build for the current host release target and place the package in a fresh temporary directory. Because a temp output path is otherwise easy to lose, the builder continues to print the final package directory path when it completes.

What changed

  • Makes --target optional and maps the host OS/architecture to supported Codex package release targets.
  • Defaults Linux hosts to musl target triples so local defaults match Codex release artifacts; GNU Linux targets remain available when passed explicitly.
  • Makes --package-dir optional and creates a new codex-package-* temp directory when omitted.
  • Documents the new defaults in scripts/codex_package/README.md.

Verification

  • Compiled scripts/build_codex_package.py and scripts/codex_package/*.py with PYTHONDONTWRITEBYTECODE=1.
  • Ran scripts/build_codex_package.py --help from outside the repo.
  • Verified Linux host detection maps x86_64 and aarch64 to musl target triples.
  • Ran a fake-Cargo package build while omitting both --target and --package-dir; verified the generated metadata target, expected package files, and printed temp package path.

@bolinfest bolinfest changed the base branch from main to pr23526 May 19, 2026 20:03
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06d99f0799

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +85 to +86
("linux", "aarch64"): "aarch64-unknown-linux-musl",
("linux", "x86_64"): "x86_64-unknown-linux-musl",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid defaulting Linux hosts to musl targets

default_target() now maps Linux hosts to *-unknown-linux-musl, so running build_codex_package.py without --target on a typical Linux Rust setup (which usually only has the native *-unknown-linux-gnu std installed) causes cargo build --target ...-musl to fail unless users manually add that target/toolchain. This regresses the new default behavior and conflicts with the CLI promise that omitting --target uses the host platform.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 7265106. Linux host defaults now map to x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnu, and those are supported package targets. The existing musl targets remain available for release jobs that pass --target explicitly. I verified the Linux host mapping with patched platform.system()/platform.machine() and ran a fake-Cargo package build for x86_64-unknown-linux-gnu.

bolinfest added a commit that referenced this pull request May 19, 2026
## Why

The Codex package builder should produce a complete package without
requiring callers to pre-populate `rg` under `codex-cli/vendor` or have
`dotslash` installed on `PATH`. The repo already tracks the
authoritative DotSlash manifest in `codex-cli/bin/rg`, so the builder
can read that metadata directly and fetch the correct ripgrep archive
for the target it is packaging.

## What changed

- Added `scripts/codex_package/ripgrep.py` to parse `codex-cli/bin/rg`
after stripping the shebang, select the target platform entry, download
the configured artifact, and verify the recorded size and SHA-256
digest.
- Added a cache under `$TMPDIR/codex-package/<target>-rg` so verified
archives can be reused without fetching again.
- Extracted `rg`/`rg.exe` from `tar.gz` and `zip` artifacts into the
package-builder cache, then copied that into `codex-path` through the
existing package layout flow.
- Kept `--rg-bin` as an explicit local override for offline tests and
unusual local workflows.
- Documented the default `rg` fetch/cache behavior in
`scripts/codex_package/README.md`.

## Verification

- Ran wrapper/module syntax compilation.
- Ran `scripts/build_codex_package.py --help` from `/private/tmp`.
- Ran a local manifest fetch test covering shebang-stripped manifest
parsing, `tar.gz` extraction, `zip` extraction, size/SHA-256
verification, and cache reuse after deleting the original source
archives.
- Ran fake-cargo package/archive builds for macOS, Linux, and Windows
target layouts with `--rg-bin`, including an assertion that generated
tar archives contain no duplicate member names.




---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/23526).
* #23541
* __->__ #23526
Base automatically changed from pr23526 to main May 19, 2026 22:52
@bolinfest bolinfest enabled auto-merge (squash) May 19, 2026 22:53
@bolinfest bolinfest merged commit 79f044e into main May 20, 2026
31 checks passed
@bolinfest bolinfest deleted the pr23541 branch May 20, 2026 00:05
@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