Repository navigation
Fork CI: static musl release binaries keyed by commit SHA - #2
Conversation
thedancingdeveloper
left a comment
There was a problem hiding this comment.
Review (epic lead, WI-1122). Blockers on head d003e74:
- bwrap is stripped again after its digest is taken. The "Build release binaries" loop strips
codex codex-code-mode-host bwrap.linux-sandboxverifies the shipped bwrap against the embeddedCODEX_BWRAP_SHA256at runtime (codex-rs/linux-sandbox/src/bundled_bwrap.rs:151-175). If the second strip changes a byte, the sandbox fails closed, so the sandbox is broken in every release. Upstream deliberately skips bwrap at this point (rust-release.yml:293: "bwrap is already stripped before hashing"). Fix: drop bwrap from that loop, and add an assertion in Package thatsha256sum bwrapequals$CODEX_BWRAP_SHA256, failing the job otherwise. - The
releasejob has no checkout, sogh release view/createhas no repository context and will fail. SetGH_REPO: ${{ github.repository }}in that step's env. - The top-level
permissions: contents: writehands a write token to the build job, which runs third-party actions (setup-zig) and repo scripts. Set top-levelcontents: read, andcontents: writeonly onrelease. upstream_version="0.162.0"is right only once fork/main is re-pointed to rust-v0.162.0 (see the #1 review). Keep it, conditional on that change.
Non-blocking:
- Add a smoke step after the build:
codex --versionmatches the stamp, andcodex --helpruns. - Add
concurrency: fork-release-${{ github.sha }}. - A bare 40-hex tag name makes git print "refname is ambiguous" for anyone who fetches tags.
fork-<sha>would avoid that. Either works for WI-1142, as long as one is chosen and documented in FORK.md.
2351d9e to
c138238
Compare
Builds static x86_64 and aarch64 musl binaries on ubuntu-24.04 and ubuntu-24.04-arm, reusing the upstream musl setup (zig 0.14.0, install-musl-build-tools.sh, setup-rusty-v8, AWS_LC_SYS_NO_JITTER_ENTROPY). bwrap is built and stripped first and its digest exported as CODEX_BWRAP_SHA256, which linux-sandbox embeds and verifies. The workspace version 0.0.0 is stamped <upstream>+fork.<shortsha> so codex --version reports the fork. Publishes a GitHub release tagged with the full commit SHA plus SHA256SUMS. Every action is pinned to a full commit SHA verified to exist. New file with a fork-unique name; no upstream workflow is edited.
- contents: read at the top level, contents: write only on the release job. - bwrap is no longer stripped a second time after hashing, which would change the bytes CODEX_BWRAP_SHA256 covers. The package step asserts the shipped bwrap's sha256 equals the embedded digest and fails the build otherwise. - The release step sets GH_REPO to github.repository so gh cannot fall back to the upstream repository.
d003e74 to
48e39fc
Compare
|
Addressed, rebased onto
|
thedancingdeveloper
left a comment
There was a problem hiding this comment.
Review (epic lead). Blocker on head 48e39fc:
- Every
cargo buildruns at the repo root, which has noCargo.toml. The workspace iscodex-rs/, socargo build --bin bwrapfails at once. Upstream usesworking-directory: codex-rs(rust-release.yml:75). Fix: adddefaults: run: working-directory: codex-rsto thebuildjob and adjust every relative path to match:- the stamp step's
codex-rs/Cargo.tomlbecomesCargo.toml; target/…anddist/…now resolve undercodex-rs/;- upload-artifact
path:needs thecodex-rs/prefix, because actions don't takedefaults.run.
Run the workflow once withworkflow_dispatchon the PR branch before asking for re-review, and link the run. A green run is the only real test of this file.
- the stamp step's
Resolved since last review: no bwrap re-strip, plus the digest assertion; GH_REPO; contents: read at the top with write only on release.
The repo root has no Cargo.toml, so every cargo build failed. The build job now defaults its run steps to codex-rs/, the version stamp edits Cargo.toml there, and the artifact paths are prefixed codex-rs/ because actions do not honour defaults.run. The musl build-tools step stays at the repo root: its script and setup-rusty-v8 write under GITHUB_WORKSPACE.
thedancingdeveloper
left a comment
There was a problem hiding this comment.
Review: no blockers (head 4893226)
The working-directory fix is correct: defaults.run.working-directory: codex-rs on build, the musl script runs at the workspace root, and the stamp and artifact paths are adjusted. Every earlier blocker is resolved (bwrap digest assertion, GH_REPO, token scopes).
I'm withdrawing my request for a pre-merge dispatch run. workflow_dispatch only works when the file is on the repo's default branch, which is main (the upstream mirror), so it can't run from here. The first real test is the push trigger when this merges to fork/main. A failure there only delays the first release, so it goes in as a follow-up fix. Suggestion for oversight: make fork/main the fork's default branch. Dispatch then works, and gh pr create targets the right base by default.
Summary
.github/workflows/fork-release.yml, a fork-only workflow that builds static musl binaries forx86_64-unknown-linux-musl(ubuntu-24.04) andaarch64-unknown-linux-musl(ubuntu-24.04-arm) on every push tofork/main.mlugg/setup-zig),.github/scripts/install-musl-build-tools.sh,./.github/actions/setup-rusty-v8, andAWS_LC_SYS_NO_JITTER_ENTROPY=1.--bin bwrapfirst, strips it and exportsCODEX_BWRAP_SHA256before the codex build. This is required:linux-sandboxembedsoption_env!("CODEX_BWRAP_SHA256")and verifies the bundled bwrap against it (the unset case is a silentNone, so the sandbox would skip its integrity check).0.0.0as<upstream>+fork.<shortsha>(currently0.162.0) socodex --versionreports the fork. The version is advanced in the rebase procedure;git describecannot be used because upstream tags are not fetched.SHA256SUMS, which is how the Vogt engine installs the fork (WI-1142).fbc6f399, rust-toolchaine0818162(1.95.0), setup-zigd1434d08(v2.2.1), upload-artifactea165f8d(v4.6.2), download-artifactd3f86a10(v4.3.0).Not verified, left for CI: whether the musl script works on GitHub-hosted runners as it does on upstream's, and the build time and binary size. No local build was run; the root filesystem is too full for a workspace build.
Test plan
fork/mainpush run the workflowSHA256SUMScodex --versionfrom the asset reports0.162.0+fork.<shortsha>