Repository navigation
fix(scripts): PR preparation fails when GitHub serves a stale head ref - #146950
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:33 AM ET / 11:33 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR makes maintainer tooling fetch the commit identified by live GitHub metadata, reject identity changes during acquisition, and preserve the main-branch checkpoint. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. No blocking defect was found, and the previously failing containment-test shard now passes on the reviewed head. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s PR tooling acquires contributor source for review, preparation, publication verification, and merge checks. GitHub metadata identifies the expected commit, while Git supplies its contents for the existing review and landing gates. flowchart TD
A[PR operation] --> B[Live GitHub metadata]
B --> C[Validate expected commit]
C --> D[Fetch commit from canonical origin]
D --> E[Verify commit and reread identity]
E --> F[Continue review and landing gates]
E --> G[Stop on identity drift]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +118, Docs +1, Other +36. Total +155 across 13 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use one metadata-validated acquisition owner throughout the native PR workflow while retaining existing review, publication-lease, and final merge checks. Do we have a high-confidence way to reproduce the issue? Yes, from source: stale pull-head refs cause current preparation to reject the reviewed commit, and the added native-workflow fixtures model that exact disagreement. No tests or live workflow were executed during this read-only review. Is this the best way to solve the issue? Yes. Fetching the metadata-pinned commit through the existing canonical-origin owner removes the stale projection dependency without bypassing downstream identity or landing checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6f27bf18da4e. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
openclaw#146950) * fix(scripts): prepare PRs despite stale GitHub head refs * test(scripts): migrate remaining PR acquisition fixtures * test(scripts): initialize literal transition review fixtures
Related: #140897.
What Problem This Solves
PR review and preparation can fetch an older commit when GitHub's pull-head ref lags the current PR branch and metadata.
User Impact
Maintainers can prepare and land the verified PR commit despite a delayed GitHub ref. This changes maintainer tooling only; Gateway behavior is unchanged.
Why This Change Was Made
One shared acquisition operation fetches the full commit SHA verified by live PR metadata from the canonical origin. It verifies the fetched commit and rejects changes to the PR head, branch, or repository across the fetch. Review, preparation, publication verification, and merge checks all use this operation. Existing review, CI, ancestry, merge, and source-identity gates remain in place; PR acquisition preserves the private main checkpoint and shared tracking refs.
Evidence
The issue was observed on #140897: PR metadata and the named branch pointed to
d49a43e, while GitHub's read-only pull-head ref still returned81c77fe, including after one close/reopen.The stale-ref and identity-drift regressions failed before the repair and pass afterward. The native workflow suite passed 165 tests across four files, including preparation, publication races, retained merge receipts, and cross-checkout ownership. The final two-case origin/refmap and main-checkpoint proof passed, as did changed-file checks, test types, and lint. Independent P0–P2 review found no actionable defects.
The first CI run exposed six missed fixture updates across operation-lock, merge-bypass, and review-artifact tests. Those failures reproduced locally; the related containment fixture was repaired as well. The follow-up changes only four test files and passes 46 focused contract cases, types, lint, and fresh independent P0–P2 review. Production code is unchanged. That CI run confirmed the original six failures were repaired, then exposed two literal-transition cases lacking review initialization. A one-line fixture correction passes the entire unfiltered 67-case containment suite, types, lint, and fresh P0–P2 review. All production bytes remain unchanged. CI34754466324 passed on final head
ad5eca282d996d937ebc0a73594903c9f7882013; all 98 current checks pass and 28 are skipped by their owning workflows. The current ClawSweeper review has no remaining blocker.