fix: sync package manifest state during auto-stage-candidate.yml - #139
Conversation
auto-stage-candidate.yml only updated the root manifest on successful build staging, leaving the package manifest's candidate_state_status out of sync (observed with codex 0.145.0: root=ready_to_publish, package=codex_build_dispatched). Add a stage subcommand to update-codex-candidate-manifest.js that updates both manifests' state fields, and harden the workflow's checkout/push with a re-fetch + force-with-lease guard against concurrent branch updates. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2caf78854
ℹ️ 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".
| # 使えるよう main 版で上書きし、そのままコミット対象に含める。 | ||
| git checkout origin/main -- scripts/update-codex-candidate-manifest.js | ||
|
|
||
| node scripts/update-codex-candidate-manifest.js stage "$BUILD_RUN_ID" "$SOURCE_REF" "$SOURCE_SHA" |
There was a problem hiding this comment.
Allow staging to repair the existing split manifest state
When a candidate was already staged by the old workflow—leaving the root manifest at ready_to_publish while the package manifest remains codex_build_dispatched, as described for 0.145.0—this new synchronization call is unreachable. The preceding “Check candidate branch state” step still requires the root state to equal codex_build_dispatched, so re-dispatching the same successful run sets should_stage=false and leaves the manifests inconsistent. Accept this recovery state while validating the version and run ID, or add an explicit repair path.
Useful? React with 👍 / 👎.
Summary
auto-stage-candidate.ymlonly updated the root manifest when staging a successful build, leaving the package manifest'scandidate_state_status(and related fields) out of sync. Observed concretely with codex 0.145.0: root ended upready_to_publishwhile the package manifest stayedcodex_build_dispatched.stagesubcommand toscripts/update-codex-candidate-manifest.js(stageManifestsReadyToPublish()) that updates both manifests' state fields and sharedupdated_at, while keeping build provenance (build_run_id/source_ref/source_sha) root-only since the package manifest schema doesn't carry those fields.auto-stage-candidate.yml's checkout/push sequence: re-fetch immediately before checkout, re-verify both manifests' candidate version/state (includingexpected_build_run_id) against the initial check, and push with--force-with-leasepinned to the re-fetched SHA to guard against concurrent branch updates (e.g. fromcodex-version-watch.yml's own force-with-lease updates).node --check/node --testfor this script tonpm-package.yml's verify job (previously not run in CI).Test plan
node --check scripts/update-codex-candidate-manifest.js— syntax OKnode --test scripts/update-codex-candidate-manifest.test.js— 14/14 PASS (7 existing + 7 new)npm-packageverify job,lintactionlint/shellcheck) — pending, will confirm after PR opens🤖 Generated with Claude Code (design/review by GPT-5.6-terra, implementation by GPT-5.4-mini)