fix(maint): keep PR maintenance delta-only#108018
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6273486110
ℹ️ 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".
| echo "Prep sync cannot resolve hosted head $expected_oid locally; re-run prepare-init." >&2 | ||
| return 1 | ||
| fi | ||
| if ! git merge-base --is-ancestor "$expected_oid" HEAD; then |
There was a problem hiding this comment.
Allow sync after a GraphQL-signed prepare push
When a fork PR was previously published through createCommitOnBranch, the hosted head is GitHub's signed commit while the local prep branch stays on the unsigned local commit with the same tree (prepare_push records this split as PREP_HEAD_SHA vs LOCAL_PREP_HEAD_SHA). If a maintainer then appends a fixup and runs prepare-sync-head, local HEAD extends the local commit, not the hosted SHA, so this ancestry check rejects the normal follow-up path before graphql_push_to_fork can publish the delta; git diff $expected_oid..HEAD would only contain the appended fixup because the prior trees match.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a246d5201e
ℹ️ 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".
| # merge-verify owns relevance-aware mainline drift. Keep the hosted PR head | ||
| # as the publication parent so fork updates contain only reviewed fixups. | ||
| git fetch origin main |
There was a problem hiding this comment.
Keep strict drift sync satisfiable
When OPENCLAW_PR_STRICT_DRIFT=1 is set and origin/main has relevant drift, merge_verify still hard-fails while telling the operator to run prepare-sync-head, but this path now only fetches origin/main and preserves the hosted PR ancestry, so the PR head remains behind origin/main and the strict gate loops forever. This affects strict maintainer landings for behind-main PRs; either this command still needs to make origin/main an ancestor in that mode or the strict gate/recovery path needs to change together.
Useful? React with 👍 / 👎.
|
Land-ready maintainer proof:
Proof:
Known proof gaps: none. |
|
Merged via squash.
|
* fix(maint): keep fork prep sync delta-only * fix(ci): use exact merge parent for PR diffs * fix(ci): pass docs diff base through environment * test(ci): cover environment-mediated docs base
Closes #108016
What Problem This Solves
Fixes two stale-main assumptions that made maintainer updates to long-lived contributor PRs slow and unsafe:
scripts/pr prepare-sync-headrebased the contributor branch, and PR CI compared the tested merge commit with an old event base SHA.Why This Change Was Made
Fork sync now preserves the hosted PR head as its publication parent and publishes only appended reviewed fixups. Mainline drift remains merge verification's responsibility; rewritten prep history fails before any file encoding or GitHub call. CI resolves the tested merge commit's exact first parent once, then uses that canonical base for changed-file routing, docs scope, security checks, and downstream guards. The security lane parses Git parents directly instead of executing an untrusted PR helper before selecting trusted configuration.
User Impact
No product runtime behavior changes. Maintainers can land independent contributor PRs without rebasing every branch after unrelated merges, old PRs no longer fan out over unrelated changes, and malformed fork syncs fail quickly with a precise recovery instruction.
Evidence
tbx_01kxj2k5cnhm2fxdeapqhwgbzb: focused coordinator/CI tests 89/89 passed;pnpm check:changedpassed.bash -n scripts/pr-lib/gates.sh scripts/pr-lib/prepare-core.sh scripts/pr-lib/push.sh— passed.$autoreview --mode local— clean after resolving the security-boundary finding.