Repository navigation
Stamp upstream workspace version into PwrAgent release builds - #21
Merged
Merged
Conversation
Upstream main keeps codex-rs/Cargo.toml at version 0.0.0, so fork builds compiled CARGO_PKG_VERSION as 0.0.0 and the models manager sent client_version=0.0.0 to /models, hiding version-gated models. Add stamp-workspace-version.py to write upstream-version.txt into the workspace version and Cargo.lock before every release/unsigned build, and verify it after. Pin the behaviour in the signing contract and the release-check workflow.
- verify every version-inheriting member, not just four crates - fail a drifted tag in the metadata job before the build matrix - check lockfile consistency with cargo update --locked (index only) - tolerate arrays/comments before version in [workspace.package] - compute both rewrites before writing; share lockfile block parsing
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
pwragent-v0.171.0-pwragent.4(6eb6e92) returns only 7 models from app-servermodel/list. Homebrew codex 0.169.0 returns 13 on the same account.gpt-6.1-sol,gpt-6.1-terra,gpt-6.2-sol,gpt-6.2-astraandgpt-6-solare missing.client_version_to_whole()incodex-rs/models-managerbuilds the/modelsclient_versionfromCARGO_PKG_VERSION_*, and the backend filters models by minimum client version. Upstreammainkeepscodex-rs/Cargo.tomlatversion = "0.0.0"and writes the real version only on release tags. The fork builds frommain-based commits, andpwragent-release.ymlonly exportedCODEX_BUILD_VERSION. So the binaries sentclient_version=0.0.0.~/.codex/models_cache.jsonshows"client_version": "0.0.0". The 0.163 fork tag happened to carry0.163.0, so it worked. About 50 otherenv!("CARGO_PKG_VERSION")sites (analytics, otel, session metadata, turn metadata, login, ...) also reported 0.0.0. The--versionchecks passed because they readCODEX_BUILD_VERSION.Fix
scripts/pwragent-release/stamp-workspace-version.pystamp [--expect-release-version V]writes the plain semver fromupstream-version.txtinto[workspace.package] version. It also writes it into theCargo.lockentries of every workspace member that inherits that version. It finds those members withcargo metadata --no-deps --offline, which needs no network.rust-release.ymlbumps onlyCargo.tomland runscargo update --workspacewhere it needs to, because its cargo builds are not--locked. This fork'spwragent-macos-unsigned.ymlbuilds with--locked, so the script rewrites the lockfile entries directly. That needs no network or registry and keeps--lockedworking. It is idempotent and keeps CRLF line endings on Windows checkouts.--expect-release-version, the build fails unless the downstream version (from the tag or the dev build) starts with<upstream>-. This stops a tag from drifting away fromupstream-version.txt.verifyfails unlesscodex-models-manager,codex-cli,codex-app-serverandcodex-code-mode-hosthave the upstream version in both their resolved manifests andCargo.lock. Because of that it also fails on 0.0.0.pwragent-release.yml(Unix matrix and Windows build) andpwragent-macos-unsigned.ymlrunstampjust beforecargo buildandverifyjust after it, in the same step. The Windows job usespython.pwragent-release-check.ymlnow:unittest discover);cargo metadata --lockedon the real tree. It also triggers oncodex-rs/Cargo.tomlchanges, so an upstream rebase that breaks stamping fails on the rebase PR, not during a release.check-release-signing.pyrequires stamp →cargo build→ verify, in that order, inbuild,windows-prepareand the unsigned macOS workflow. It also requires the check-workflow steps.test_stamp_workspace_version.pycovers:version = 4do not, and running it twice gives the same result;upstream-version.txt(no0.0.0, no prerelease, no partial versions);Why stamp at build time instead of committing the version
Committing
version = "0.171.0"onpwragentwould make every upstream rebase touch about 175 lines (the manifest plus every workspace entry inCargo.lock). Upstream changes those lockfile lines whenever it adds a crate or changes a dependency, so most syncs would conflict. On every baseline bump someone would have to remember to edit both files as well asupstream-version.txt. That second copy of the version is exactly what drifted here. Stamping at build time keepsupstream-version.txtas the single source of truth. It leaves upstream's files untouched, so rebases do not conflict. The contract check and the release-check workflow keep it enforced.Validation
python3 scripts/pwragent-release/check-release-signing.py→ okpython3 -m unittest discover -s scripts/pwragent-release -p 'test_*.py'→ 10 tests okverifyfails with0.0.0before stamping.stamp --expect-release-version 0.172.0-pwragent.1is rejected.stamp --expect-release-version 0.171.0-pwragent.5rewrites 174 members, and thenverifyand fullcargo metadata --lockedpass. A staleCargo.lockfailsverify.client_version_to_whole()undercargo test --locked -p codex-models-managergaveCLIENT_VERSION=0.171.0. Before this change it was0.0.0.The release builds themselves have not run on this PR. Apply
ci:release-signingorci:macos-unsignedto run them before tagging.