Skip to content

fix(maint): keep PR maintenance delta-only#108018

Merged
steipete merged 4 commits into
mainfrom
fix/pr-fork-delta
Jul 15, 2026
Merged

fix(maint): keep PR maintenance delta-only#108018
steipete merged 4 commits into
mainfrom
fix/pr-fork-delta

Conversation

@steipete

@steipete steipete commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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-head rebased 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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M maintainer Maintainer-authored PR labels Jul 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread scripts/pr-lib/push.sh
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete steipete changed the title fix(maint): keep fork prep sync delta-only fix(maint): keep PR maintenance delta-only Jul 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +232 to 234
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready maintainer proof:

  • Preparation now keeps the contributor fork delta after ordinary main drift; prepare-run completed without rebasing and preserved exact head 255cabc145dd84d756d50706cb76cd3e96238cc0.
  • Push protection rejects a prepared head that no longer contains the hosted PR head before any encoded state or GitHub mutation.
  • PR CI derives the checked-out synthetic merge commit's first parent once and uses it for docs, security, build, and scope decisions. The stale event base reproduced 12,521 changed files; the exact merge parent selects the intended 10-file merge delta.
  • Composite-action input is passed through env, covered by the interpolation security guard.

Proof:

  • Blacksmith Testbox tbx_01kxj2k5cnhm2fxdeapqhwgbzb: pnpm test test/scripts/ci-workflow-guards.test.ts test/scripts/pr-prepare-gates.test.ts — 89/89 passed.
  • Same Testbox: pnpm check:changed — passed.
  • python3 scripts/check-composite-action-input-interpolation.py — passed.
  • git diff --check — passed.
  • Final autoreview — clean, no accepted/actionable findings (0.98 confidence).
  • Exact-head CI run: https://github.com/openclaw/openclaw/actions/runs/29391924865 — green.
  • Repo-native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 108018 — passed using exact/recent hosted proof; remote branch already matched the prepared head.

Known proof gaps: none.

@steipete
steipete merged commit 2e73cff into main Jul 15, 2026
92 checks passed
@steipete
steipete deleted the fix/pr-fork-delta branch July 15, 2026 05:49
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 15, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: fork prep sync serializes unrelated mainline files

1 participant