Skip to content

fix: prepare guest PRs from newer published project bases - #188790

Merged
shakkernerd merged 1 commit into
mainfrom
guest-pr-published-base
Oct 31, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
guest-pr-published-base

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #188751.

What Problem This Solves

An eligible guest can be refused when preparing an older PR from a clean project checkout that contains newer published commits. The workspace is reported as dirty or unpublished because its HEAD is not an ancestor of the PR's recorded base or head, even though the project branch already contains it.

User Impact

Guests can prepare these PRs while keeping protection for actual dirty, staged, untracked, or unpublished work. This also covers a PR targeting a release branch while the project starts from newer published main, and a fork project's own published source branch. Preparation still installs the verified PR head and preserves the sandbox's original branch and HEAD.

Why This Change Was Made

The preparation caller already verifies the original project repository. It now passes that repository and the recorded source branch to the existing integration owner. When the original PR ancestry checks do not establish publication, the owner verifies that the clean workspace HEAD belongs to that authenticated project branch.

The project source is checked independently of the PR destination. This reuses the existing Git transport and ancestry checks without scanning other refs or treating a remotely uploaded commit object as a published branch. The canonical preparation documentation now explains this distinction.

Evidence

The original production code failed both same-repository and fork cases when the fixture placed the clean workspace five published commits beyond the PR's recorded base. The updated registered-action preparation suite passes all 22 cases, including differing destinations, fork-origin history, and a clean unpublished-commit refusal. Together with unchanged passing refresh and adoption coverage, 50 related cases apply to this change.

Changed-file format/lint and the native selected production and test type checks passed remotely. The preparation file took 100.06 seconds including worker preparation; its real Git and workspace-projection path is needed to exercise the ancestry and saved-work boundary. The 84 added test/fixture lines correct the earlier misleading graph and cover the distinct preservation and source-selection cases.

Independent review is clean for this head. A real guest in a required sandbox reproduced the refusal on the baseline, then prepared the same original PR successfully on this exact head. Authenticated GitHub readback confirmed its branch, head, title, body and comments were unchanged. Both an untracked-file control and a separate clean-unpublished-commit control were refused, preserving their HEADs, trees and file bytes without installing a PR binding. The exact-head full runtime build passed.

All selected hosted CI families passed except the test-line budget ratchet and its aggregate gates. The exact CI baseline, 2c157ed06dff5032da1093cbb6745efeff2b6f33, independently fails the native checker with 6,313,613 test lines against a 6,312,587 ceiling: 1,026 inherited lines. This PR adds 84 lines and an equal grant, reproducing the hosted totals of 6,313,697 / 6,312,671 without increasing that debt. The failed job remains recorded; main now contains the budget correction in #188780. The native checker passed on the prospective result with target adb58af237c2079d8eae388b22b9ce439d19e081: 6,315,751 lines against a 6,347,719 ceiling. The original failure remains historical evidence; this receiving check does not relabel CI as green.

The focused tests use synthetic external GitHub/container I/O. The live proof used actual authenticated GitHub and the required guest sandbox. A later receiving-target check also reproduced the four published-source failures on the unfixed target and passed all 22 cases with this patch.

Visual evidence

Open preview

Before After
Preparation incorrectly refuses the clean newer published workspace Preparation succeeds while preserving the original PR branch and head

Guest submits the preparation request and receives the settled successful result

p1-after.mp4

Visual verification

  • Baseline: 899e747
  • Exact head: 61fc0253d2071d17cd591ee75236cbf8eb04850a
  • Scenario: The same sandboxed guest prepares the same older pull request from a clean project workspace five published commits ahead of the PR base.
  • Runtime/build: OpenClaw 2026.10.9-61fc0253d207-2026-10-30T23-39-20.021Z
  • Before: Refused as dirty, untracked, or unpublished despite a pristine published source
  • After: Prepared; headChanged=false; review base remains the PR common ancestor
  • Preserved: Original PR branch, head, title, body and comments unchanged
  • Actual authenticated GitHub and sandboxed guest action on the pinned baseline and exact PR head.
  • Both attempts began with the same clean project and guest HEAD five published commits beyond the PR base.
  • The private guest retains its original HEAD while the accepted PR source is staged; the canonical workspace accepts the original PR head.
  • Same desktop viewport and privacy crop; each screenshot is scrolled to its settled result. Timing is not a performance comparison.
  • Inspected both screenshots and complete sampled recording sequences; opaque privacy masks preserve the action and result.

Baseline interaction recording.

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S labels Oct 30, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allow a clean managed workspace to prepare an older PR when its HEAD belongs to the original project's published source branch.

Example: A guest prepares an older PR from a clean workspace five published main commits beyond the PR's recorded base.

  • Before: Preparation incorrectly refuses the workspace as dirty, untracked, or unpublished.
  • After: Preparation installs the verified PR source while preserving the guest's branch and HEAD; genuinely unpublished commits remain protected.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, owner-approved repair with shipped-entry-point evidence, meaningful regression coverage, and no actionable findings; the inherited CI gate remains a landing matter.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots show the guest preparation request changing from refusal to prepared on the stated exact head; accompanying live evidence identifies authenticated GitHub, the required sandbox, unchanged remote PR state, and untracked/unpublished preservation controls, addressing the prior rank-up request.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An eligible guest cannot prepare an older owned PR from a clean workspace containing newer published project commits.
Reason: The patch restores documented preparation behavior, preserves actual unpublished work, and carries feature-owner direction through its maintainer author.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current preparation bug with a focused change in the existing integration owner; no actionable patch defects were found.

Priority: P2
Reviewed head: 61fc0253d2071d17cd591ee75236cbf8eb04850a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway's GitHub preparation action verifies the requester and PR, then asks the managed workspace integration owner to install the accepted source into the canonical checkout and sandbox projection.

flowchart TD
  A[Guest preparation request] --> B[Requester and PR verification]
  B --> C[Original project identity]
  C --> D[Workspace integration owner]
  D --> E[Authenticated published branch]
  E --> F[Clean workspace ancestry check]
  F --> G[Canonical checkout and sandbox projection]
Loading

Technical review

Best possible solution:

Keep publication detection in the existing integration owner, verifying the original project's recorded branch while retaining all clean-workspace and requester checks.

Do we have a high-confidence way to reproduce the issue?

Current-main ancestry checks establish the failing graph, and the linked report and supplied baseline screenshot corroborate the refusal; no target code was executed during this review.

Is this the best way to solve the issue?

This is a focused repair of publication detection using existing repository identity, branch parsing, authenticated transport, and integration ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8034bb1fafbe.

Provenance checked

  • Initial-import ancestry and saved-work protection keeps the original intent (9218dca: Initial preparation installs the verified PR source only when existing work is disposable, preserving guest history and refusing dirty or unpublished work.)
  • Preparation orchestration and integration ownership keeps the original intent (484419f: Keep private preparation with its single consumer while retaining shared algorithms and existing authorization and storage ordering.)
  • Registered-action graph fixture changes intended behavior with a stated reason (9218dca: Exercise exact PR installation and history preservation through registered preparation; the previous success fixture placed workspace HEAD at the recorded PR base.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 9218dca adds src/gateway/github-publication-base-refresh.ts:295 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9218dca35cbf; files: src/gateway/github-publication-base-refresh.ts)
  • Peter Steinberger: Raw commit baf76f9 adds src/gateway/github-publication-base-refresh.ts:322 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: baf76f91ca2a; files: src/gateway/github-publication-base-refresh.ts)

PR surface

Source +41, Tests +84, Docs +3, Other +2. Total +130 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 43 2 +41
Tests 2 95 11 +84
Docs 1 5 2 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 6 145 15 +130

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +43/−2 lines; tests and fixtures +95/−11 lines. The production growth verifies publication through existing transport helpers; the regression growth corrects the ancestry graph and protects unpublished work across distinct source selections.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: A specific managed guest preparation workflow is incorrectly refused, with limited blast radius and no demonstrated data loss.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-30T22:56:33.582Z sha 61fc025 :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 8:25 PM ET / October 31, 2026, 00:25 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@shakkernerd shakkernerd self-assigned this Oct 31, 2026
@shakkernerd
shakkernerd merged commit 2757947 into main Oct 31, 2026
174 of 177 checks passed
@shakkernerd
shakkernerd deleted the guest-pr-published-base branch October 31, 2026 00:48
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: guests can prepare older PRs from newer published project history while preserving local work and the original PR branch.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…88790)

Allow guests to prepare older PRs from newer published project history while preserving the original PR branch and protecting local work.

Fixes openclaw#188751.
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Allow initial guest PR preparation from the recorded project's published
history while preserving unpublished work and original PR identity.

(cherry picked from commit 2757947)

Stable adaptation: preserve the existing linked-identity fixture; expand
its options type and allocate exactly 89 regression LF instead of 84.
Production and documentation patches are unchanged from the source.

Companions: #188785 is present-equivalent. Later #188784, #190223,
#190576, #190542, #195413, #197229, #197243, #199717, #195787,
#197510, #193664, #199851, #199864, #197656, #198851, #193873,
#197594, #189006, #188904, #194025, #196200, #192283, #189010,
#188816 and e0466ff are not prerequisites to this scoped repair;
retain their separate intake dispositions. No later PR-number mentions.

Proof: baseline 4 failed/20 passed through registered agent action;
fixed 41/41 across preparation, refresh and base-action suites.
Type-aware lint4, formatting5, docs MDX1419 and diff check pass.
No live GitHub or full release qualification claim.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: prepare_pr rejects a clean newer published project base

1 participant