Skip to content

fix(review): stop attributing main-only changes to PRs - #1265

Merged
steipete merged 1 commit into
mainfrom
steipete/fix-pr-evidence-provenance
Aug 27, 2026
Merged

fix(review): stop attributing main-only changes to PRs#1265
steipete merged 1 commit into
mainfrom
steipete/fix-pr-evidence-provenance

Conversation

@steipete

@steipete steipete commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where reviewers could blame an older PR for an upgrade made only on newer main, then turn that false attribution into findings, merge risks, ratings, and unnecessary restoration requests. Confirmed example: openclaw/openclaw#130734 (comment). Maintainer patch/test-merge proof: openclaw/openclaw#130734 (comment).

The same review classified ordinary bundled-hook Markdown prose as a stored-data change, although both edited HOOK.md frontmatter blocks were unchanged.

Why This Change Was Made

The host now supplies pinned checkout/base/head/merge-base identities and separates the introduced patch from endpoint drift and base-only changes. Test-merge evidence requires matching both parents and is compared against its own base parent. Missing ancestry, stale merges, multiple merge bases, and truncated evidence remain explicit limitations rather than guessed ownership.

Every finding and derived risk/label/fixup must have an introduced trigger. This is not an untouched-file suppression rule: a changed caller can still cause a valid finding in an unchanged callee. A clean merge does not establish semantic correctness. The Markdown detector separately distinguishes prose beside source from structured storage keys, SQL, frontmatter, and documented persisted-format contracts.

Validation exposed a nearby ref-hydration defect: with Git pruning enabled, shorthand main:refs/remotes/origin/main can remove origin/main even though fetch succeeds. Review and repair fetches now fully qualify the source as refs/heads/<branch>. Pruning-enabled regressions cover both normal and shallow history. No pruning setting or validation gate is disabled.

User Impact

Review input no longer presents main-owned upgrades as PR-introduced changes. Prose-only hook documentation does not acquire a bogus migration gate. Review and repair setup works with Git pruning enabled.

No decision, repair, publication, or observer schema changes; no new write authority or automatic closes. The referenced OpenClaw PR is untouched.

OpenClaw Bay Impact

Unaffected: no observer fields, routes, publication behavior, or mutation controls change.

Documentation Impact

Updated the active docs/pr-review-comments.md contract with evidence ownership, bounds, merge-parent verification, Markdown classification, and Bay impact. Updated the review prompt and changelog. No new documentation lifecycle category.

Evidence

  • Real disposable Git graph: base B and docs-only head H retain 0.149.1; main M independently upgrades six Codex files to 0.150.1; a real two-parent merge T preserves all six M blobs. M-to-H displays the misleading downgrade; the introduced B-to-H delta and T-versus-M result do not contain it.
  • test/review-provenance.test.ts exercises production prompt assembly, shallow/blobless hydration, unavailable/stale/final merge identities, criss-cross ancestry, truncation, a real introduced downgrade, and a cross-file trigger.
  • The stored-data fixture contains the actual bundled-hook PR hunks, compared byte-for-byte with the GitHub patch. Negative classification and downstream-gate tests pass alongside genuine persistence/configuration controls.
  • All six pruning-enabled CLI/rebase/shallow regressions failed before the refspec correction and pass afterward, without overriding fetch.prune.
  • The dependency-free retry fixture now uses the existing isolated pnpm test runner and asserts exactly two actual check-script executions, instead of depending on a downloadable host pnpm version. Production containment and retry policy are unchanged.
  • On committed head 710819aa9edc15c54fde044a6639b05ac395d006: build, docs/whitespace checks, and 262 focused tests passed. Precommit and committed-branch isolated Codex autoreviews reported no actionable findings at their default P0 threshold.
  • Full pnpm run check passed on the committed head with task-local Node 24.20.0 and Bash 5.3.15: 3,785 passed, 9 platform skips, zero failures; coverage 82.09% lines / 74.56% branches / 87.59% functions. This rerun replaced an invalid attempt during concurrent host maintenance that removed its Node executable; no tests or thresholds were weakened.
  • Exact-head CI run 33082263194 passed, as did CodeQL, containment, Windows launcher, sparse-build, and production automerge E2E checks.

Review Disposition

The initial ClawSweeper review accepts the implementation and real behavior proof. Its sole P3 finding, “Remove release-owned CHANGELOG entries,” is rejected as a repository-policy scope mismatch, not an implementation defect.

At this exact head, AGENTS.md:50-52 names OpenClaw's release-owned changelog, while CONTRIBUTING.md:16-19 explicitly limits that restriction to openclaw/openclaw and distinguishes ClawSweeper's own policy. This is a maintainer-authored openclaw/clawsweeper fix. Retain both concise changelog entries documenting its user-visible changes. The identical optional rank-up suggestion is declined for the same reason.

The review-policy scoping defect has independently been fixed on main by PR #1261, commit cab813112d6fbba18ce7876bbe016d7dbd618bc0. No source change or restoration is needed in this PR. Head 710819aa9edc15c54fde044a6639b05ac395d006 and its executed proof remain unchanged; the updated body records this disposition for a fresh review under the correctly scoped policy.

Real Behavior Proof

Claim/surface: the actual local-range ClawSweeper CLI, with real Codex inference in its read-only sandbox, distinguishes an unrelated old docs branch from a genuinely introduced dependency mismatch. Neither GitHub transport nor model output was mocked.

Fixture/environment: a clean disposable Git repository under the OpenClaw policy profile, valid package JSON, executable TypeScript, and the B/H/M/T graph above. Positive head P starts at M and changes only the dependency back to 0.149.1 while the unchanged version guard requires 0.150.1. macOS; Node 24.19.0 at CLI launch (24.20.0 for the later host check); pnpm 11.10.0; Codex CLI 0.150.0-alpha.13 verified from both exact sessions; high reasoning; fast service tier; read-only sandbox.

Source binding: both reviews exercised committed head 710819aa9edc15c54fde044a6639b05ac395d006, based on 0bd84d42bc0487c32af2285006884d4f9b2f7763. All 1,273 tracked source files and 497 compiled files retained their hashes throughout. Source snapshot SHA-256: 9848f7307bc105a1970468e140cd5d2147b52467c27cf398a7bf97134c4a84d5.

Command: each control used the real product command, with the operator-configured model supplied privately:

pnpm run review -- --local-range --target-repo openclaw/openclaw --target-dir "$target_dir" --base origin/main --artifact-dir "$artifact_dir" --codex-model "$CODEX_MODEL" --codex-reasoning-effort high --codex-service-tier fast --codex-sandbox read-only --codex-timeout-ms 600000

Observed results:

Control CLI exit Review status Elapsed Outcome
Older docs branch H 0 complete 285.960 s No findings, risks, restoration requests, or stored-data warnings
Introduced downgrade P 0 complete 159.263 s Correctly found the dependency/version-guard mismatch: P1 finding, P2 item triage

The negative reviewer independently inspected newer origin/main and excluded its separate dependency upgrade. The positive finding identified the changed manifest entry, unchanged checking caller, and version guard; its risk and proposed repair followed that introduced defect. Full structured decisions and rendered report sections were inspected, not only finding arrays. Severity varied between repeated live controls; the assertion is correct attribution, not identical stochastic severity.

Host execution of node extensions/codex/src/check.ts succeeded on H and failed on P with expected 0.150.1, received 0.149.1. Both review targets retained their heads, refs, index entries, tracked bytes, and clean status. No model-side secret-file reads, target mutations, dependency installs, or GitHub operations were observed; existing Codex authentication was used normally.

Artifact fingerprints: negative structured decision SHA-256 c2caed4edd009b09f9df86ee947a44e17a424d9d1db832c6b0f1b73a332f995a; positive structured decision SHA-256 4b42395f5bd899fbcd84c24487a8cdc1c74a1b110c1677a67885773a0f8471e2. Raw prompts, model logs, and transcripts are intentionally omitted. Synthetic fixture commits are not presented as real GitHub objects.

Limits: these are controlled stochastic reviews, not a statistical guarantee or a before/after live comparison. Local-range pins its base to the merge base and supplies no test-merge identity; the model independently inspected newer main. Exact parent/blob validation is separate real-Git proof, not a claim about hosted review or the original foreign PR. Qualified hosted-fetch behavior is covered by the pruning regressions. The third-party dependency was not installed or executed. No production queue, publication, or merge was exercised by this proof.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 10:48 AM ET / 14:48 UTC.

ClawSweeper review

What this changes

Adds bounded Git evidence that distinguishes PR-introduced changes from main-branch drift, improves review-history hydration, and narrows false stored-data warnings for Markdown prose.

Merge readiness

Ready for maintainer review

Keep open: the central provenance and hydration behavior is not on current main, and the prior changelog finding is superseded by the target-specific policy correction in #1261. The current patch has no actionable correctness finding.

Priority: P2
Reviewed head: 710819aa9edc15c54fde044a6639b05ac395d006

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is well-scoped, has focused regression coverage, and includes convincing controlled runtime proof.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies source-bound, after-fix live CLI controls using real Codex inference and a disposable Git graph, with observed negative and positive outcomes and stated limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies source-bound, after-fix live CLI controls using real Codex inference and a disposable Git graph, with observed negative and positive outcomes and stated limits.
Evidence reviewed 5 items Introduced-evidence implementation: The new evidence builder separates merge-base-to-head changes, base-branch changes, endpoint drift, and a verified two-parent test merge before serializing the review input.
Hydration integration: PR context hydration obtains the pinned base and head, recovers bounded ancestry, then hydrates blobs against the merge base and base revision.
Regression coverage: The focused tests cover the misleading endpoint comparison, verified and stale test merges, shallow history, truncation, and criss-cross ancestry.
Findings None None.
Security None None.

Live Verification

Command: pnpm run build

Result: PASS (completed)

$ tsc -p tsconfig.json
✔ real Git graph distinguishes introduced changes from main-only upgrades and verifies test merge (151.04762ms)
✔ introduced downgrade and cross-file trigger remain reviewer-owned evidence (115.598605ms)
✔ missing, stale and final merge identities do not claim verified merge results (210.241904ms)
✔ missing or shallow ancestry cannot turn endpoint drift into introduced evidence (103.671526ms)
✔ production history hydration recovers a shallow PR tip and fetches only the pinned test merge (232.715673ms)
✔ bounded evidence marks oversized patches and file lists incomplete (128.827425ms)
✔ criss-cross ancestry does not guess a single introduced delta (106.750343ms)
ℹ tests 7
ℹ suites 0
ℹ pass 7
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 1312.446418

Assertions:

  • PASS expect_output: real Git graph distinguishes introduced changes from main-only upgrades and verifies test merge

How this fits together

ClawSweeper gathers GitHub context and local Git history before sending a bounded evidence package to Codex for PR review. This change improves the provenance inputs and review-tree hydration that determine which branch actually owns a finding.

flowchart LR
A[GitHub PR context] --> B[Review tree hydration]
B --> C[Merge-base evidence]
C --> D[Review prompt]
D --> E[Codex review result]
F[Current main history] --> C
E --> G[Findings and labels]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Review surface 17 files: 8 code, 3 docs/release notes, 6 tests or fixtures The patch spans the prompt, runtime evidence, review hydration, and focused regression coverage.

Technical review

Best possible solution:

Land the bounded provenance, hydration, and classifier corrections after routine maintainer approval.

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

Yes — source-reproducible: the focused real-Git fixture models the base/head/main/test-merge topology and asserts that main-only changes are excluded from introduced evidence.

Is this the best way to solve the issue?

Yes — separating pinned merge-base evidence from endpoint drift is the narrowest maintainable fix, while retaining explicit unavailable and ambiguous-history outcomes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cab813112d6f.

Labels

Label justifications:

  • P2: This corrects normal-priority review attribution and checkout hydration behavior without a demonstrated user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body supplies source-bound, after-fix live CLI controls using real Codex inference and a disposable Git graph, with observed negative and positive outcomes and stated limits.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies source-bound, after-fix live CLI controls using real Codex inference and a disposable Git graph, with observed negative and positive outcomes and stated limits.

Evidence

What I checked:

Likely related people:

  • steipete: Current-head provenance work and the merged target-policy scope correction both trace to this contributor's review-runtime history. (role: recent review-runtime contributor; confidence: high; commits: 710819aa9edc, cab813112d6f, 150dfbc48fa5; files: src/pr-review-evidence.ts, src/clawsweeper-review-runtime.ts, src/repository-profiles.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-27T14:31:05.083Z sha 710819a :: found issues before merge. :: [P3] Remove release-owned CHANGELOG entries

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The main PR body now records the disposition of the sole P3 changelog finding and matching optional rank-up suggestion, with exact policy links. The release-owned restriction applies to openclaw/openclaw, not this maintainer-authored openclaw/clawsweeper PR. The policy-scoping correction is already on main via #1261. Retain both user-visible ClawSweeper changelog entries.

Head 710819aa9edc15c54fde044a6639b05ac395d006 is unchanged. Exact-head CI and the full stable-runtime local check are green; the body contains the refreshed live CLI/model proof for this same commit. Please review the updated body under the correctly scoped target-repository policy. No autofix or merge is requested by this comment.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 2129a78 into main Aug 27, 2026
21 checks passed
@steipete
steipete deleted the steipete/fix-pr-evidence-provenance branch August 27, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

1 participant