Skip to content

fix: refresh prepared PRs from the live target branch - #190576

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

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

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #190561.

What Problem This Solves

A conversation continuing an existing PR can report that its base is current even after the target branch advances. GitHub PR details may retain an older base SHA while the branch-ref endpoint already names the new tip. Using that PR-detail SHA leaves newer target files out of the workspace. After integrating a newer base, repeated preparation must also avoid resetting the review comparison to that older metadata.

User Impact

A fresh refresh_base integrates the current tip of the verified target repository and branch for both imported PRs and PRs originally published by the conversation. Repeating prepare_pr afterward preserves the correct review comparison, so integrated upstream files do not appear as PR changes merely because GitHub's PR details lag.

The accepted PR head and identity remain intact for subsequent publication. A pending conflict continues against its accepted commit; a later fresh refresh picks up further target changes. There are no configuration, schema, dependency, or permission changes.

Why This Change Was Made

The preparation owner already verifies the PR destination and distinguishes new selection from pending integration. It now uses the existing guarded branch-ref reader for a fresh refresh, and when preparation sees disagreement between the accepted base and the metadata for the same destination. Reading the live ref distinguishes stale metadata from a target that actually moved, without adding a cache or another integration mechanism.

The registered-action regression keeps PR metadata unchanged while the same Git branch advances, then repeats preparation and checks the saved comparison and cached diff. The existing conflict/publication scenario advances the target during a pending conflict and verifies that resolution finishes the earlier target before a fresh refresh imports the new tip. An existing preparation fixture now creates the actual branch it retargets to. The 50-line test-budget allocation covers those missing conditions and that required fixture adaptation.

Evidence

On unchanged main, both PR-origin variants returned current with the old commit instead of the independently advanced branch commit. A follow-on regression also reproduced the stale review comparison after repeated preparation. The corrected candidate passes all 85 cases across the five related action, preparation, source-adoption, and integration files.

Changed-file formatting/lint and affected production/test type checks passed; unaffected type-graph results were retained under unchanged consumer contracts. The five test files passed with one worker in 228.05 seconds (230.72 seconds including the native shard wrapper). They use real Git, request authority, and workspace state with external GitHub fixtures; helper-only tests would miss the selection and recovery boundaries. Hosted CI timing for this revision remains pending.

The live baseline reproduced the stale result through actual guest conversations for both PR origins, with independent GitHub PR-detail and branch-ref reads. On the corrected build, both conversations selected the live target, retained the accepted base while it advanced during conflict resolution, then picked up the newer tip on a fresh refresh. Both published directly to their original PRs without intervening preparation; original head history, saved files, authors and public metadata were preserved.

All selected CI jobs and both source reviews are green for the current head. After publication refreshed GitHub’s metadata, a further real target-branch advance restored the stale-metadata condition. Both guest conversations refreshed that target and repeated preparation while preserving the correct review base, files, indexes, heads and bindings. Returning guests remained denied merge after admin inspection; authorized admins then merged the original fixture PRs, with independently verified file trees matching their final published heads.

The matched captures and recording below show the initial fresh-base transition; separate native receipts establish the later resolution, publication, repeated-preparation and permission checks. This is isolated Guest Lab proof, not a production deployment or full release claim.

Visual evidence

Open preview

View Before After
Session-published PR Session-published PR: old base reported current while the target file is absent Session-published PR: live base selected with conflicts and the target file present
Imported PR Imported PR: old base reported current while the target file is absent Imported PR: live base selected with conflicts and the target file present

Guest refresh selects the live base and returns actual conflicts

external-after-native.mp4

Visual verification

  • Baseline: d797c14 (native carrier 681513d48b3bbc42764d81bfbcdf241e64229122)
  • Exact head: a3a00c492bb36c4790169facd3c6549c8cd06815
  • Scenario: Advance the existing PR target branch without changing its name while PR details retain the older base SHA, then ask the guest to refresh its saved work.
  • Runtime/build: OpenClaw 2026.10.9-32892a4877a6-2026-11-01T18-25-47.179Z; native carrier tree 0fbe50b178c2370fbfdd23a955847ec328f15d81 equals the reviewed head tree.
  • Before: current at old PR metadata fe892761; base-policy.txt absent
  • After: conflicts at live branch 0b8d8025; base-policy.txt present
  • Saved work: Priority/express delivery and unpublished tracking note preserved
  • Both PR origins exercised through actual guest conversations and independent GitHub PR-detail/ref reads.
  • The target branch names and original PR identities stay unchanged.
  • Matched 780×662 crops, dark theme, and the same fixture conversations; baseline is the retained older runtime, not a claim of whole-runtime parity.
  • Original build metadata is preserved; the candidate native carrier has the exact reviewed source tree.
  • All decoded frames and matched stills were inspected. Original frame timing is retained; initial scale normalization and short endpoint holds are disclosed. No real-time playback or product-latency claim.
  • The recording ends at fresh-base conflicts. Subsequent pinning, resolution, publication and repeated preparation use separate native receipts.

@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 size: S 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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 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

Prepared PRs refresh from the live target branch and retain the correct review comparison when GitHub PR metadata lags.

Example: The target advances from fe892761 to 0b8d8025 while PR details retain the older SHA.

  • Before: refresh_base returns current at fe892761 and base-policy.txt is absent.
  • After: refresh_base selects 0b8d8025, imports base-policy.txt, and reports the actual delivery-mode.txt conflict.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful repair with inspected shipped-flow evidence, meaningful owner-boundary regressions, successful exact-head gates, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after Guest Lab screenshots exercise refresh_base through actual conversations for imported and session-published PRs, showing the live commit, imported target file, real conflicts, and preserved saved work on the declared candidate build. These address the prior review's candidate-output request; later resolution and repeated-preparation receipts are described in the body but were not independently inspected.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A conversation reports its PR base as current while newer target files are missing, and repeated preparation can regress its review comparison.
Reason: The maintainer-authored repair restores documented refresh behavior without adding configuration, permissions, schemas, or a parallel integration path.

Merge readiness

✅ Ready for maintainer review

This PR fixes a source-confirmed target-selection bug still present on main; no actionable introduced defects remain.

Priority: P2
Reviewed head: a3a00c492bb36c4790169facd3c6549c8cd06815

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway preparation owner verifies the conversation and PR, selects a target commit, and delegates file integration and review-base preparation to the existing workspace owners.

flowchart TD
  A[Conversation GitHub action] --> B[PR preparation owner]
  B --> C[Requester and PR verification]
  C --> D[Guarded live branch reader]
  D --> E[Workspace integration owner]
  E --> F[Saved files and review comparison]
Loading

Technical review

Best possible solution:

Land the focused live-ref selection fix through the existing preparation and integration owners.

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

Current-main source establishes the stale-SHA path, and the linked report and inspected baseline screenshots demonstrate its observable result; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete repair: select the live commit in the preparation owner, preserve pending integration, and reuse the existing guarded transport and review-base machinery.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Prepared-PR base refresh and review comparison keeps the original intent (5cac93c: Enable prepared PRs to integrate their verified destination while preserving accepted heads, saved work, and pending targets.)
  • Session-published PR continuation keeps the original intent (4ececc4: Let the original conversation recover outside head changes through the existing preparation owner without transferring creator authority.)
  • Preparation ownership keeps the original intent (484419f: Keep private preparation decisions with their single consumer rather than introducing forwarding layers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 5cac93c adds src/gateway/github-pr-workspace-preparation.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: 5cac93c15f2a; files: src/gateway/github-pr-workspace-preparation.ts)
  • Ayaan Zaidi: Raw commit 4ececc4 adds src/gateway/github-pr-workspace-preparation.ts:260 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ececc447d2e; files: src/gateway/github-pr-workspace-preparation.ts)
  • Peter Steinberger: Raw commit 484419f adds src/gateway/github-pr-workspace-preparation.ts:264 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 484419f1a36d; files: src/gateway/github-pr-workspace-preparation.ts)

PR surface

Source +23, Tests +50, Docs +2, Other +2. Total +77 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 23 0 +23
Tests 2 50 0 +50
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 78 1 +77

Review metrics

Metric Value Why it matters
Production versus test growth Production +23 lines; tests +50 lines The growth reuses existing transport machinery and covers stale metadata, repeated preparation, and pending-target preservation without new production state or test scaffolding.

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: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Prepared PR conversations can silently omit newer target files, with no demonstrated saved-work loss or remote-history corruption.
  • 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-11-01T18:20:22.829Z sha cb67b88 :: needs maintainer review before merge. :: none

Reviewed November 1, 2026, 2:21 PM ET / 19:21 UTC (Revision 2).

@shakkernerd shakkernerd self-assigned this Nov 1, 2026
@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. 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 1, 2026
@shakkernerd
shakkernerd merged commit 0e70bc4 into main Nov 1, 2026
149 of 150 checks passed
@shakkernerd
shakkernerd deleted the bound-pr-live-base branch November 1, 2026 19:32
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: prepared PRs refresh the live target branch while preserving their review comparison through conflict resolution and repeated preparation.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 2, 2026
Refresh prepared PR workspaces from the current target branch and preserve their review comparison when GitHub PR metadata lags. Keep pending conflict resolution on its accepted base while retaining the original PR identity and saved guest work.

Fixes openclaw#190561.
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.

fix: PR refresh reports current when its target branch has advanced

1 participant