Skip to content

fix: prepared PRs cannot refresh their target branch - #190223

Merged
shakkernerd merged 2 commits into
mainfrom
bound-pr-base-refresh
Nov 1, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
bound-pr-base-refresh

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #190201.

What Problem This Solves

A guest who recovered an existing PR with prepare_pr could publish further changes, then become unable to integrate the target branch. refresh_base rejected every associated PR and redirected back to preparation, which updates PR source and review comparison without merging destination-only changes.

User Impact

Prepared and recovered PRs can integrate their current target branch, resolve conflicts, and continue publishing to the original PR. Saved guest files and Git history remain intact. Distinct staged and unstaged versions are preserved by refusing the refresh until the staged work is committed; existing requester permissions and changed-remote-head publication checks remain in effect.

Why This Change Was Made

Bound base refresh now uses the existing PR preparation owner to verify the current requester, publisher, PR identity, and target, then passes that verified base to the existing workspace integration owner. It keeps accepted PR-head metadata separate from the target being merged. Pending head preparation and pending base integration remain separate operations, and a retry finishes its accepted base before selecting another target.

A previous publication still identifies the accepted head after the PR is retargeted; it is matched by its original head branch rather than its former target branch. Review comparison follows the integrated host history, so repeating preparation does not discard a completed base merge from the comparison. No configuration, schema, or public action parameters are added.

Evidence

The registered-action regression first reproduced the original refusal after outside head advancement, successful preparation, and same-PR publication, with both linked and unlinked guests. Production source was unchanged for that run; both cases failed at the bound-PR guard.

The corrected registered-action flow now recovers another writer's head, publishes, retargets the PR to a conflicting base, preserves distinct staged work, recovers an interrupted transfer, resolves conflicts, and publishes directly to the same PR. It proves both previous PR history and the selected target remain ancestors, then repeats preparation to check the review comparison. Existing fork, maintainer/guest, remote-head rejection, and prefix-stability controls passed alongside it.

  • Changed-file format/lint and affected production/test type families passed remotely.
  • Twelve related test files passed: 258 tests, four native shards in 248.10 seconds. The two expanded real-Git fixture files share existing setup and protect the user-visible integration boundary; the 155-line allocation records that distinct regression growth.
  • Independent engineering review is clean on final head ee73c0e5de4. Autoreview is scoped-clean for P0–P2 on the complete implementation range 726a4da0fb5..d797c14276f and separately on the final test-only supplement; the unchanged production review is reused.
  • The full native pnpm build passed on implementation tree d797c14276f, including runtime and Control UI output, in 2 minutes 33.9 seconds.
  • Hosted CI passed on final head ee73c0e5de4: 61 checks passed, 55 were intentionally skipped, and none were failing, pending, or missing. The earlier implementation head also passed its 14 selected Node rows and related UI/build/type/security gates.
  • The final test-only addition passed the complete 38-case preparation fixture, including three explicit bound-refresh controls: an unlinked guest cannot refresh a maintainer-prepared private PR; revocation after the actual base fetch prevents source effects; and revocation during recovery prevents a pending resolution acknowledgement from changing either workspace. The tests assert that revocation occurred and compare binding, canonical/projection heads, indexes, and changed-file bytes. They use real authorization/Git/storage owners with fixed external GitHub/container I/O; no live private-repository or exhaustive revocation claim is made.
  • Format/lint and the selected type families passed again for the test-only addition. Reusing unchanged results gives 261 distinct focused cases across the two runs; this was not a fresh 261-case run. ClawSweeper’s final-head review rated the patch and proof Diamond with no findings or before-merge requests.

Live GitHub flow

Both a conversation-published PR and a genuine guest-authored fork PR reproduced the baseline refusal, then completed the corrected flow in the same retained sessions: outside-head recovery, publication, actual target retargeting to a conflicting base, refresh, resolution, native checks, and direct publication back to the original PR without another prepare_pr. Original PR/head branches, authors, title/body, outside contributions, saved tracking work, and base-only content were preserved. Both final heads contain their prior publication and integrated target as ancestors.

The current admin subsequently merged both disposable demo PRs: session publication and external fork. A returning guest after admin inspection was denied operator.write. Each real sandbox passed its three fixture checks and exact working/index/diff assertions. Each bound autoreview completed scoped-clean at its default P0-only scope after publication; these are separate from this source PR's engineering review.

The runtime used the exact production source tree of d797c14276f through a verified native build carrier. Final head ee73c0e5de4 adds only authorization tests and their test-line budget; production/runtime/UI files and dependencies are identical. The live run and media retain their actual d797c14276f / 681513d48b3 identities and are reused without replay. Before/after captures show the same prepared PR and retargeted base. The recording shows reaching the conflict result; native receipts and live GitHub ancestry/content checks establish the later resolution, publication, and admin completion. The external acknowledgement wrapper timed out after dispatch, but its retained nested result and filesystem state proved completion, so it was not retried. No access, model, isolation, or timeout override was used.

Visual evidence

Open preview

View Before After
Session-published PR Session-published PR: bound base refresh refused Session-published PR: actual target integrated and conflicts returned
External fork PR External fork PR: bound base refresh refused External fork PR: actual target integrated and conflicts returned

External fork PR: sanitized native request-to-conflict recording

external-after-refresh.mp4

Visual verification

  • Baseline: 726a4da
  • Exact head: d797c14276f3327227e13556557cc58f88db9c71
  • Scenario: A genuine guest refreshes a prepared PR after its actual target branch is changed to a conflicting base.
  • Runtime/build: OpenClaw runtime carrier 681513d48b3bbc42764d81bfbcdf241e64229122; identical source tree fcca9abedf58b0b63ef0b77661ca15d665d59200 to PR head d797c14. Baseline carrier cce92b3963e65398cc8e4714393fb2011dd54845 matches source 726a4da.
  • Before: Both prepared PRs refused refresh_base without changing saved work or GitHub state.
  • After: Both returned conflicts for delivery-mode.txt at the verified retargeted base b978c563.
  • Completion: Both resolved and published directly to their original PR/head branches; current admin subsequently merged both.
  • Preservation: Prior PR head and integrated base are ancestors; saved tracking/outside dispatch/base policy files verified.
  • Same durable PR/session and target per comparison; 1280×720 source viewport, identical 780×662 crop and theme. Equivalent refresh requests use separate before/after conversation turns.
  • Sanitized native capture; opaque masks hide private actor/model/route fields. Final high-DPI frame normalized to the source viewport. No fabricated UI, dropped frames, speed changes, or latency comparison.
  • Full 719-frame decoded sequence/privacy/PTS review reused from the media owner; lead inspected copied stills and the complete temporal overview. Original capture and transformation evidence remain held.
  • Recording shows the request, tool progress and returned conflict result; settled stills show the completed message. No real-time-player inspection claim.
  • Native publication/ancestry/blob receipts and admin/guest-scope checks establish later completion; the refresh recording alone does not.

@clawsweeper

clawsweeper Bot commented Nov 1, 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 docker Docker and sandbox tooling agents Agent runtime and tooling size: M labels Nov 1, 2026
@shakkernerd shakkernerd self-assigned this Nov 1, 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allows prepared PR workspaces to integrate their verified target branch while preserving saved work and the accepted PR head.

Example: A prepared PR targets integration-bot-target-1101, whose delivery-mode.txt conflicts with saved work.

  • Before: refresh_base refuses because the workspace already continues an existing PR.
  • After: refresh_base returns the delivery-mode.txt conflict at base b978c563cc74d8e9f7316a8729c3d16edb88c4a8 for resolution and subsequent same-PR publication.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful repair supported by shipped-entry-point evidence, real-owner regression controls, unchanged persisted formats, and successful exact-head gates.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected native before/after captures exercise github_publish through a retained prepared conversation, replacing the refusal with verified-target conflicts; linked live GitHub results corroborate later publication, and production-path controls establish private-PR rejection and revocation before workspace changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Guests recovering or importing a PR cannot integrate its target branch because refresh_base redirects them to preparation, which does not merge destination-only changes.
Reason: Restores the documented contribution workflow with maintainer-authored direction, existing actions, and no new configuration or public API.

Merge readiness

✅ Ready for maintainer review

This PR fixes a confirmed workflow refusal still present on current main; no actionable introduced defect or unresolved merge concern was found.

Priority: P2
Reviewed head: ee73c0e5de4a6151c388bfe3b60e0f99a947385c

Before merge

None.

Findings

None.

Agent review details

How this fits together

The github_publish tool dispatches Gateway actions that verify requester and publisher authority, then coordinate the canonical Git checkout and sandbox projection to return conflicts or an exact review base.

flowchart TD
User[Guest request] --> Tool[GitHub publish tool]
Tool --> Gateway[Gateway action]
Gateway --> Verify[PR preparation and authority owner]
Verify --> Integration[Workspace integration owner]
Integration --> Workspace[Canonical checkout and sandbox projection]
Workspace --> Result[Conflicts or review base]
Loading

Technical review

Best possible solution:

Land the focused repair through the existing preparation and workspace integration owners while retaining source-head, authority, staging, and recovery protections.

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

Current main contains the unconditional bound-PR refusal described in #190201, and the inspected baseline capture shows that exact error; no target code was executed during this review.

Is this the best way to solve the issue?

The patch addresses the owning refusal with existing verification and integration operations, preserves preparation's destination-only contract, and keeps remote-head acceptance separate from base integration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6129cfa7bebc.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main defect remains: Current main still rejects every refresh_base request with an existing PR binding before workspace integration; preparation separately updates source or review comparison. (src/gateway/server-methods/sessions-github.ts:216, 6129cfa7bebc)
  • Verified introduction and smallest complete fix: The pinned introduced diff routes bound refresh through existing PR verification and integration owners, retains accepted-head metadata, separates pending source and base operations, and repairs receipt matching and review ancestry without adding another integration owner. (src/gateway/github-pr-workspace-preparation.ts:368, ee73c0e5de4a)
  • Final-effect authority controls: Registered-action controls exercise an unlinked guest against a maintainer-prepared private PR, revocation after base fetching, and revocation during pending-conflict recovery; they compare binding, canonical and projection heads, indexes, and file bytes. The fixture dispatches the actual tool and Gateway request with real authorization, Git, and storage owners. (src/gateway/github-pr-workspace-preparation.test.ts:91, ee73c0e5de4a)
  • Inspected behavior proof: Downloaded before/after screenshots show the same session-published PR changing from the bound-PR refusal to target-base conflicts. The final commit changes only authorization tests and their allocation, preserving the production implementation exercised by the live proof. The external-fork after image and video were absent from prepared artifacts, and browser fetches returned Cache miss; neither is claimed as inspected. (src/gateway/github-pr-workspace-refresh.test.ts:334, ee73c0e5de4a)
  • Live completion independently corroborated: Both linked disposable PRs are merged. GitHub comparison confirms the displayed integrated target b978c563cc74d8e9f7316a8729c3d16edb88c4a8 is an ancestor of both final demo heads, supporting the reported completion beyond the screenshot's conflict result. (72ef59b562a2)
  • Exact-head gates: Live REST reads show successful exact-head CI, dependency-review, and security-sensitive-review status gates, with completed changed-code checks; GitHub reports the reviewed head mergeable and clean. (ee73c0e5de4a)

Likely related people:

  • Shakker: Raw commit 9218dca adds src/gateway/github-pr-workspace-preparation.ts:40 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-pr-workspace-preparation.ts)

PR surface

Source +46, Tests +155, Docs +13, Other +2. Total +216 across 10 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 102 56 +46
Tests 2 158 3 +155
Docs 2 16 3 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 10 278 62 +216

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +102/-56 lines; tests +158/-3 lines The growth reuses existing owners and fixtures to cover bound refresh, staging preservation, recovery, same-PR publication, and distinct authorization failures.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #190201
Summary: This PR directly repairs the bound-workspace refusal established by the linked issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repairs a reproducible managed-sandbox PR integration workflow refusal without demonstrated data loss or broader runtime outage.
  • 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 (2 earlier review cycles)
  • reviewed 2026-11-01T10:28:14.445Z sha d797c14 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-01T11:29:53.698Z sha ee73c0e :: needs maintainer review before merge. :: none

Reviewed November 1, 2026, 6:36 AM ET / 11:36 UTC (Revision 3).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 1, 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-environment 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 1, 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. 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 Nov 1, 2026
@shakkernerd
shakkernerd merged commit 5cac93c into main Nov 1, 2026
172 of 173 checks passed
@shakkernerd
shakkernerd deleted the bound-pr-base-refresh branch November 1, 2026 11:48
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Prepared and recovered PRs can integrate their target branch and publish to the same PR after conflict resolution.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
Prepared and recovered PR workspaces can integrate their current target branch, resolve conflicts, and publish back to the same PR while preserving saved work, accepted history, and requester permissions.

Fixes openclaw#190201.
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]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
Backport #190223 (5cac93c) without newer origin metadata or maintainer-impersonation test fixtures. Preserve accepted PR heads, guest work, authority checks, and pending conflict recovery.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 54bcfd7333d40c3c9d72568a0e08ccb6bf339a4c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling 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: M 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.

fix: prepared PRs cannot integrate their target branch

1 participant