Skip to content

fix(review): prevent test-merge ancestry from being attributed to original commits - #1409

Merged
steipete merged 1 commit into
mainfrom
fix/original-commit-provenance
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/original-commit-provenance

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.

What Problem This Solves

Resolves a problem where a ClawSweeper review could attribute a GitHub test merge's main parent to the original PR commit. The historical review of the Gateway PR, reviewed at 2026-09-04T01:20:32.984Z, claimed that original head 15ca0925f5d164df5283783aea5f4a01ffe3924e had current main as its recorded parent. The original raw commit proves otherwise.

The producer run ran code 8440386ebd92f39c5d6812d74cda3793a67530a3. Its archived report (exact-review-33825006229-1, artifact ID 9919776836, report SHA-256 3db6dce3fe4050873ad4131159604ecd62b11432eed98a73fd962cba873772bb) preserves the incorrect claim; the linked durable comment is mutable and now contains later reviews. The raw report is deliberately not reproduced here.

Object role Exact commit Raw recorded parents, in order
Original PR head 15ca0925f5d164df5283783aea5f4a01ffe3924e cd8c74889d21ddcc9f3a2d47fe868224a0e44acb
Historical GitHub test merge 782c712e2dad405a2e9010354b5291fb94d42fe6 3c0eb9fd822f8101dc3117ce40dbd2b0f5e01930, 15ca0925f5d164df5283783aea5f4a01ffe3924e

Why This Change Was Made

The evidence generator supplied identities and test-merge parents but omitted the original head's raw parents, and the model's prose conflated those distinct identities. Reuse the hardened Git reader and canonical parent parser to provide typed, role-labeled originalHead and checkout records, and explicitly label testMerge. The prompt requires public ancestry claims to keep these roles separate.

Exact object-type checks prevent tag peeling. Reads retain the existing five-second/1 MiB bounds and cap parent lists at eight; unavailable, malformed, or oversized reads return parents: null, while only an inspected root returns []. The old scalar head/checkout aliases are removed. This is reviewer input, with no decision schema, dependency, configuration, routing, persistent-data, or publication-authority change and no prose scrubber.

Source preparation materializes the pinned original head. There is no evidence that a historical rebase caused the bad claim, and an integration checkout cannot rewrite an existing original SHA's parent.

User Impact

Maintainers and contributors receive explicit original-commit ancestry in review evidence, reducing false provenance and ownership claims when the actual checkout, fetched main, merge base, or test merge differs. Unknown inspection remains visibly unknown. Raw parent records alone do not establish causal introduction, authorship, or parent-object availability.

OpenClaw Bay Impact

Bay is unaffected: the change only adds reviewer-input provenance. No observer data contract, lifecycle/publication authority, queue state, telemetry, routes, or controls change.

Documentation Impact

Updated the active implementation documentation in docs/pr-review-comments.md, section “PR Introduction Evidence,” and the owning reviewer prompt in prompts/review-item.md. ClawSweeper review maintainers own this contract; src/pr-review-evidence.ts is the source of truth. Verified against this PR's four-file patch; changes to record roles, raw-object bounds, unknown/root semantics, or source acquisition trigger a documentation update. Reviewed CONTRIBUTING.md, docs/README.md, README.md, and VISION.md; no other documentation changes are needed. Release-note context is preserved here without editing the changelog.

Evidence

  • Before the production change, the new regressions failed: initial focused run 89 passed / 7 failed; additional boundary cases 2 failed; exact-object-type case 1 failed. With the patch, all four focused files passed, 98/98, under Node 24.20.0 and pnpm 11.10.0 with standard Git configuration.
  • Real Git fixtures cover synthetic merges, rebased checkouts, original heads with multiple commits, merge heads, replacement refs, legacy grafts, shallow history, missing objects, trees/tags, malformed raw parents, oversized objects, and genuine roots. Production prompt serialization is exercised, including preservation of introduced versus main-only changes.
  • Static checks, all builds, lint, and the existing changed-surface coverage gate passed (13/13). The original full local pnpm run check was interrupted under severe host load and did not pass. A representative agent-runner failure was reproduced: that command set TMPDIR inside the checkout, which the scanner correctly rejects as unsafe_path. The unchanged test passes with the default external temp directory. This diagnoses that local failure only. The full gate subsequently passed in exact-head Linux CI on f1a20200c0b22ccd309d38939879b8ec66fb7a85; the same run also passed Windows launcher and sparse repair build checks, with no retry. CodeQL passed at the same head. The hosted scan smoke is dispatch-only and was correctly skipped.
  • Fresh isolated Codex reviews before commit and after rebase both passed with no actionable P0–P3 findings. On head f1a20200c0b22ccd309d38939879b8ec66fb7a85 against base b4f7d36406ed1e375dc8eac17abc00ff63a93f02, the production build, exact historical-object probe, and selected rebase/unknown/type/size regression cases passed (3/3). The rebased four-file patch is byte-identical to the original 98/98-tested patch (SHA-256 e0c149f62c70876b121df9dfb497ec23a6e72fb5cdaf9c8b8cbbfb7387188128); upstream did not change its evidence or prompt-serialization owners.
  • The initial ClawSweeper review found no actionable issues or rank-up requests and judged the proof sufficient. No code changes were needed in response; this body now includes the completed CI result.
  • Scope: four files, production TypeScript +40/-4 (net +36), prompt +15/-3 (net +12), tests +172/-3 (net +169), documentation +13/-4 (net +9). No other owner's files changed. The related owner simplification PR changes different files.

Real Behavior Proof

Claim: compiled production evidence generation preserves the exact original PR head's raw parents independently of the actual integration/rebased checkout and GitHub test merge, and production prompt assembly carries those roles to the reviewer.

Surface and scenarios: buildPullRequestReviewEvidence and production buildReviewPrompt against real disposable Git histories; additionally, compiled evidence generation against the exact historical original and test-merge objects in a task-owned bare object store. Historical source objects and active PR checkouts were not modified.

Commands/environment: local macOS, Node 24.20.0, pinned pnpm 11.10.0, standard Git configuration. Build and focused proof:

pnpm run build
TMPDIR="$PWD/.artifacts/original-commit-provenance/tmp" CLAWSWEEPER_PROVENANCE_PROOF_DIR="$PWD/.artifacts/original-commit-provenance" node --test test/pr-review-evidence.test.ts test/review-prompt-context.test.ts test/review-prompt-policy.test.ts test/review-provenance.test.ts

The post-rebase boundary rerun used the default external temp directory and passed all three selected cases:

node --test --test-name-pattern='original head parents survive synthetic|unavailable raw commits|invalid or oversized raw parent' test/review-provenance.test.ts

The historical probe calls the compiled buildPullRequestReviewEvidence with head.sha=15ca0925f5d164df5283783aea5f4a01ffe3924e, base.sha=3c0eb9fd822f8101dc3117ce40dbd2b0f5e01930, mergeCommitSha=782c712e2dad405a2e9010354b5291fb94d42fe6, mainSha equal to that base, and the bare fixture's HEAD at the test merge. It first verifies both objects with git --no-replace-objects cat-file -p <exact-sha> and asserts the following production output:

originalHead: verified, role=original_pr_head
  sha=15ca0925f5d164df5283783aea5f4a01ffe3924e
  parents=[cd8c74889d21ddcc9f3a2d47fe868224a0e44acb]
checkout: verified, role=actual_checkout
  sha=782c712e2dad405a2e9010354b5291fb94d42fe6
  parents=[3c0eb9fd822f8101dc3117ce40dbd2b0f5e01930,15ca0925f5d164df5283783aea5f4a01ffe3924e]
testMerge: verified, role=github_test_merge
  sha=782c712e2dad405a2e9010354b5291fb94d42fe6
  parents=[3c0eb9fd822f8101dc3117ce40dbd2b0f5e01930,15ca0925f5d164df5283783aea5f4a01ffe3924e]
mergeBase: verified, sha=cd8c74889d21ddcc9f3a2d47fe868224a0e44acb
PASS: immutable original-head parentage is separate from integration ancestry.

Artifact/trace: bounded historical output above, the original producer/artifact identities above, and reproducible real-Git regression assertions in test/review-provenance.test.ts. Red/green logs, fixture JSON, and historical production JSON are retained locally; raw reports and agent transcripts are not published on this branch.

Limits: this proves evidence generation and prompt assembly, not model compliance, a replay of the historical model session, or GitHub review publication. It does not guarantee that model prose never makes another provenance mistake. No Gateway PR or lifecycle session was changed.

Record original pinned-head and actual checkout raw parents separately from the GitHub test merge. Keep failed exact-object inspection unknown and teach the reviewer to preserve those identities in public provenance claims.
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review September 4, 2026 06:46
@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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 3:01 AM ET / 07:01 UTC.

ClawSweeper review

What this changes

The PR separates original PR commit ancestry from checkout and test-merge ancestry in reviewer input, with matching guidance and Git regression coverage.

Merge readiness

✅ Ready for maintainer review

The PR remains necessary because current main still omits original-head parent evidence. This re-review found no actionable defects, and the supplied production proof is sufficient.

Priority: P2
Reviewed head: f1a20200c0b22ccd309d38939879b8ec66fb7a85

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-covered repair with sufficient production-path evidence and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied current-head macOS trace exercises compiled evidence generation against historical Git objects and shows correct original-head versus integration ancestry; real-Git prompt serialization covers the surrounding cases. This proves the changed input boundary, without claiming model compliance or publication coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied current-head macOS trace exercises compiled evidence generation against historical Git objects and shows correct original-head versus integration ancestry; real-Git prompt serialization covers the surrounding cases. This proves the changed input boundary, without claiming model compliance or publication coverage.
Evidence reviewed 9 items Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md files or maintainer-notes directory were found. Applied the proof, review-continuity, narrow-scope, and Bay-impact guidance.
Current main still needs the change: The fetched main implementation retains checkoutSha and headSha scalars and supplies raw parents only for the test merge; it lacks the proposed original-head and checkout records.
Release check: The supplied latest release is v0.3.0; its tree contains no src/pr-review-evidence.ts. No shipped or merged replacement was established.
Findings None None.
Security None None.

How this fits together

ClawSweeper assembles local Git evidence and GitHub PR metadata into the model's review prompt. This change gives reviewers distinct commit identities and parent records before they assess ownership and provenance.

flowchart TD
  A[Pinned PR metadata] --> C[Bounded Git inspection]
  B[Local Git objects and checkout] --> C
  C --> D{Exact commit inspectable?}
  D -->|Yes| E[Role-labeled raw parents]
  D -->|No| F[Explicit unknown evidence]
  E --> G[Review prompt]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC Production +40/-4 (net +36); tests +172/-3 (net +169) Production growth is justified by bounded commit inspection, with broader coverage for ancestry and unavailable-object boundaries.

Technical review

Best possible solution:

Preserve distinct original-head, checkout, and test-merge records throughout reviewer input, with explicit unknown states when inspection fails.

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

Yes for the evidence gap: current main omits original-head parents, and the supplied production probe exercises that boundary. The historical model misattribution itself was not replayed.

Is this the best way to solve the issue?

Yes. Reusing the existing isolated Git reader and parent parser provides the missing facts without adding a competing provenance implementation or changing publication authority.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs misleading review-provenance evidence within a focused subsystem, without an established urgent runtime outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 supplied current-head macOS trace exercises compiled evidence generation against historical Git objects and shows correct original-head versus integration ancestry; real-Git prompt serialization covers the surrounding cases. This proves the changed input boundary, without claiming model compliance or publication coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied current-head macOS trace exercises compiled evidence generation against historical Git objects and shows correct original-head versus integration ancestry; real-Git prompt serialization covers the surrounding cases. This proves the changed input boundary, without claiming model compliance or publication coverage.

Evidence

What I checked:

  • Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md files or maintainer-notes directory were found. Applied the proof, review-continuity, narrow-scope, and Bay-impact guidance. (AGENTS.md:1, f1a20200c0b2)
  • Current main still needs the change: The fetched main implementation retains checkoutSha and headSha scalars and supplies raw parents only for the test merge; it lacks the proposed original-head and checkout records. (src/pr-review-evidence.ts:32, c673b36cf19f)
  • Release check: The supplied latest release is v0.3.0; its tree contains no src/pr-review-evidence.ts. No shipped or merged replacement was established. (a3469c99f6a8)
  • Bounded exact-object inspection: The new helper checks the exact object type, reuses the isolated Git reader and canonical parent parser, rejects excessive parent lists, and distinguishes unavailable evidence from an inspected root. (src/pr-review-evidence.ts:175, f1a20200c0b2)
  • Consumer and compatibility boundary: Production prompt assembly serializes the complete evidence object. Repository searches found no remaining checkoutSha consumers; the owning prompt uses the new records. No persistent decision, plugin API, or Bay observer contract changes. (src/clawsweeper-review-runtime.ts:483, f1a20200c0b2)
  • Production behavior proof: The fully supplied PR body records a compiled production probe on macOS with Node 24.20.0: original-head parents remain distinct while HEAD is the historical test merge. Real-Git fixtures also exercise production prompt serialization across rebased, shallow, replaced, malformed, missing, and oversized objects. The body explicitly limits the claim to evidence generation and prompt assembly, excluding model compliance and publication. (test/review-provenance.test.ts:165, f1a20200c0b2)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Martin Cleary: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-04T06:51:11.195Z sha f1a2020 :: needs maintainer review before merge. :: none

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head f1a20200c0b22ccd309d38939879b8ec66fb7a85 and the main PR body are final. The body now includes the completed exact-head CI result and current production-behavior proof. The initial review had no actionable findings or rank-up requests; no code changes were needed.

@clawsweeper

clawsweeper Bot commented Sep 4, 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.

Re-review progress:

@steipete
steipete merged commit 0bf6bf6 into main Sep 4, 2026
30 checks passed
@steipete
steipete deleted the fix/original-commit-provenance branch September 4, 2026 07:09
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