Skip to content

fix(review): verify provenance against raw Git history - #1298

Merged
steipete merged 1 commit into
mainfrom
fix/provenance-boundary-20260829
Aug 29, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/provenance-boundary-20260829

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: Browser SDK import-boundary review with unsupported historical attribution.

Additional instructions

Keep Allow edits from maintainers enabled.

What Problem This Solves

Resolves a problem where readers of ClawSweeper reviews could see confident claims that a person introduced code even though the cited commit did not change that code. In the reported Browser review, the cited commit changed unrelated mobile UI rather than either Browser barrel. The retained report had confident related-people attribution while its structured regression provenance was unknown.

The recovered artifacts and Actions logs do not contain raw blame output; private/R2 retention has not been verified. The exact historical command and checkout/history state are unknown; this repair does not claim that a particular shallow-checkout configuration caused that incident. It repairs the demonstrated missing verification boundary and reproduces concrete ways that boundary could fail.

Why This Change Was Made

ClawSweeper now verifies source-line changes against the actual parents recorded in raw Git commit objects before projecting historical people attribution or structured regression provenance. The model still judges routing and semantic relevance; the host supplies only verified Git facts, keeps author, committer, PR author, and merger separate, and never equates line authorship with feature responsibility.

The canonical reader is shared by both attribution surfaces. It clears blame ignore lists, detects carried-forward renames, rejects incomplete parent evidence, disables replacement refs and legacy grafts, and parses Git records on LF boundaries. Blame is a locator, not introduction proof; graph-truncated parent displays and root-style output cannot substitute for raw-parent patch evidence. Missing objects, ambiguous rename mappings, unavailable paths, oversized reads, and exhausted verification budgets remain unknown without failing the whole review.

Unverified candidates retain only low-confidence routing suggestions. Public report and comment readers require host-owned proof markers, so legacy stored prose cannot regain historical confidence simply by being rendered. The prior merged-history routing policy remains intact: the current PR proposer is not automatically a historical feature owner.

User Impact

Maintainers and contributors receive bounded, factual source-line attribution rather than an unsupported claim about who introduced a feature or regression. Genuine verified author/committer metadata remains available; uncertain history is visibly uncertain and useful nonhistorical routing is preserved. A required maintainer-decision owner stays synchronized with that normalized public result.

This change does not edit Browser code, rewrite stored historical reports, or mutate the old public comment. It adds no operator setting, dependency, database migration, fetch budget, scanner exemption, sandbox bypass, or GitHub mutation route. The existing model-facing decision schema gains the bounded, nullable history pointer.

OpenClaw Bay Impact

No Bay change is needed. This changes report/comment attribution, not observer routes, controls, queue state, or aggregate telemetry. The public API contract and dashboard/public-observability.ts were inspected: those projections select closed aggregate fields rather than serializing likely-owner or regression-provenance report content. Bay remains observer-only.

Documentation Impact

docs/pr-review-comments.md is the active implementation reference and now documents the history-proof owner, raw-parent and record-boundary rules, unknown/carried-forward behavior, host markers, and legacy downgrade. CONTRIBUTING.md remains the active contributor guide and now states the existing Bash 4+ prerequisite for workflow-intake validation on macOS; this does not change the default shell. The local-review and public-observer API documentation was also checked; their isolation and observer contracts are unchanged.

Evidence

Candidate: 3b2fb44d092a4bd265d72825f66b3d7175c327b9, based on e1eefe217304f0f510acb3890db1155cef61682e.

The final full gate passed on Node 24.20.0, pnpm 11.10.0, Git 2.55.0, and Bash 5.3.15. From the candidate checkout, with installed Git/Bash selected only for this task:

PATH="/opt/homebrew/opt/git/bin:/opt/homebrew/opt/bash/bin:$PATH" pnpm run check

Result: 4,035 tests; 4,026 passed, 9 skipped, 0 failed. Full coverage was 82.95% lines / 75.51% branches / 88.08% functions. Static guards, formatting, documentation checks, all three builds, lint, and changed-coverage validation passed. The focused attribution/reader/runner proof passed 124/124 tests. An earlier full run exposed one obsolete rendering assertion; its final test-only alignment preserved proposal-only close guards and removed a false-positive owner-commit-link test. The final full gate includes that correction.

A fresh independent pre-commit P0–P2 source review returned scoped-clean, no findings, and “patch is correct” with confidence 0.90. A separate fresh committed-branch review against the recorded base also returned scoped-clean, no P0–P2 findings, with confidence 0.87. These reviewers inspected source and did not run tests; the execution evidence above is separate. Both required review stages are complete on the candidate's source.

Source and reader coverage

Complete affected owners, callers, readers, and relevant siblings were inspected rather than reviewing the diff alone:

Boundary Inspected source and contract
Model output to trusted decision schema/clawsweeper-decision.schema.json, clawsweeper-types, clawsweeper-policy, and clawsweeper-decision-parser; model output cannot mint host verification markers.
Native producer clawsweeper-review-preparation, clawsweeper-review-command-workflow, and clawsweeper-review-runtime; parsed output passes through history verification before the decision leaves the runtime.
Raw Git evidence pr-review-evidence and clawsweeper-regression-provenance; bounded callback-free reads, exact recorded parents, actual added-line spans, actor metadata, and conservative predecessor relationships. The PR test-merge reader shares the corrected raw-parent parser.
Stored report to public comment clawsweeper-report-document, clawsweeper-report-parser, clawsweeper-status-context, clawsweeper-review-presentation, report rendering/orchestration/comment helpers, and review blobs; both direct and stored-report paths preserve the public trust boundary.
Action and ownership siblings decision-packets, report actions, and close-decision owners; selected-owner consistency and proposal-only mutation gates remain covered.
Native isolation agent-runner, agent-input-scan, codex-env, codex-spawn, and commit-sweeper; mandatory input scanning, read-only inspection, credential stripping, empty GitHub config, and disabled web search remain in the native path.

Dependency contracts were checked directly in Git 2.55.0 raw commit parsing, its graft-environment and identity handling, and Codex CLI schema/output arguments. Codex loads and passes the schema into the user turn; its JSON loader is not proof of Git truth or model-service schema admission.

Scope and production growth

Nineteen existing files changed: production TypeScript +232 net, model-facing prompt/schema +33 net, tests +316 net, and docs +32 net. Combined runtime/model-contract growth is +265. The added production surface establishes the previously missing typed source-line proof and public-projection boundary; a prose-only warning or shallow-fetch change cannot enforce that contract. It reuses the trusted Git reader and existing report representation, replaces unrestricted Git injection and the older blame-only verification path, and avoids a parallel attribution implementation or schema overhaul.

Real Behavior Proof

Claim and exercised surface: unchanged or unverifiable history must not become confident historical people attribution; genuine introducing-line metadata must survive the actual producer, report serialization, and public-comment reader.

Scenario and observed before/after: disposable real Git histories contain an introducing commit, unrelated later work, shallow boundaries with the actual parent available or missing, and genuine introduction positives. The pre-fix verifier attributed an unchanged line to the unrelated commit. After the repair those histories remain carried-forward/unknown, while real introducing author and committer metadata stays distinct from PR author and merger. Further fail-before/pass-after cases cover configured blame exclusions, exact/inexact renames, legacy grafts, replacement refs, malformed parent records, and CR/Unicode record-boundary spoofing. The sibling test-merge reader rejects fake ancestry. Legacy report rendering no longer promotes a historical role, high confidence, or owner commit link without host proof.

Executed production path: the built review --local-range CLI was exercised against real Git repositories, then its actual report was passed through the public-comment renderer. Positive and negative attribution, selected-owner consistency, and clean target checkouts were asserted. The focused run and final full gate include this proof in test/regression-provenance.test.ts, alongside the provenance and comment-reader siblings. A local rendering of the retained incident report likewise produced no attributed predecessor and only unverified routing candidates; the live comment was not touched.

Limits: that deterministic producer-to-report-to-comment harness uses existing fixture Codex/scanner executables to control model decisions. It proves the changed Git and projection behavior, not native model-service schema admission, hosted publication, or a reproduction of the unavailable historical blame invocation. No live GitHub write is part of this proof.

Native CLI/schema admission — executed

A separate native run on 2026-08-29, 19:34:46–19:40:13 UTC completed with exit 0 in 326.458 seconds, using real TruffleHog 3.97.1 and Codex CLI 0.150.1 on the candidate/base above. It used the configured built-in OpenAI provider, retained the mandatory scanner and read-only checkout inspection, requested read-only sandboxing with approvals disabled, stripped GitHub credentials, isolated GitHub config, and disabled web search. This was GitHub-isolated, not air-gapped: Codex inference used its configured model service.

The executed CLI command, from the candidate checkout, was:

NATIVE_PROOF_INSTRUCTIONS='This run is one native local-range integration proof for the committed attribution repair. Use the normal structured decision schema and perform read-only source/history inspection. Do not run tests, builds, install commands, Git mutations, gh, network lookup tools, or publication/apply commands. Existing focused/full-suite and real-Git fail-before/pass-after evidence is held separately; do not claim to have rerun it. Do not manufacture a likely owner just to exercise the schema. Keep private model-routing identifiers out of the response. The native flow must retain the mandatory scanner and read-only sandbox.'
PATH="/opt/homebrew/opt/git/bin:/opt/homebrew/opt/bash/bin:$PATH" \
pnpm run review -- \
  --local-range --target-repo openclaw/clawsweeper --target-dir . \
  --base e1eefe217304f0f510acb3890db1155cef61682e \
  --artifact-dir artifacts/provenance-native-3b2fb44d \
  --codex-sandbox read-only --codex-forced-login-method chatgpt \
  --additional-prompt "$NATIVE_PROOF_INSTRUCTIONS"

The task pinned CODEX_BIN to the verified installed CLI and selected the existing Codex runner; it did not alter persistent configuration or override the configured model. No model-selector flag was passed: configured routing was used, and its private model identifier is intentionally omitted from this proof. The report records review_status: complete, local_checkout_access: verified, and the exact base/head. The model returned two non-null history pointers and no host proof markers. The host verified both pointers and emitted two raw_parent_line_v1 source-line author facts. Passing that native report through the production public-comment renderer retained both facts and removed the model's broader role descriptions.

The native source review reported zero findings and zero risks, with “patch is correct” and confidence 0.88. It explicitly did not rerun or reassess the separate test evidence. The recorded 35 shell commands had no Git mutation, GitHub CLI, network-lookup, or test/build/install command matches; the isolated GitHub config remained empty. HEAD and the clean checkout were unchanged after both the CLI run and local comment rendering.

Sanitized trace: artifacts/provenance-native-3b2fb44d/native-sanitized-proof.json. Raw model output, report, comment rendering, and execution logs remain private; the sanitized trace records their hashes, tool versions, exact candidate/base, outcomes, and limits. Observable result extract:

{
  "exitCode": 0,
  "reviewStatus": "complete",
  "readOnlyCheckoutInspection": "verified",
  "nonNullHistoryPointers": 2,
  "modelSuppliedHostProofMarkers": 0,
  "hostProofMarkersInReport": 2,
  "publicCommentSourceLineAuthorCount": 2,
  "rawModelRolesRemovedFromComment": true,
  "reviewFindingCount": 0,
  "headUnchanged": true,
  "checkoutCleanAfterRendering": true
}

Native limits: one candidate/base and two positive histories, with negative cases established separately by the deterministic real-Git regressions; no hosted publication, live GitHub comment update, or packet-level network audit. The native model's realBehaviorProof: not_applicable describes its source-only review of separately held evidence, not the CLI/report behavior directly observed here. The separate committed-branch review is complete and clean. Exact-head CI and a ClawSweeper review matching the current PR head and body remain required before landing.

@clawsweeper

clawsweeper Bot commented Aug 29, 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 August 29, 2026 20:09
@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 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 4:13 PM ET / 20:13 UTC.

ClawSweeper review

What this changes

The PR verifies that a blamed source line was actually changed against raw recorded Git parents before publishing attribution or regression provenance in review reports and comments.

Merge readiness

✅ Ready for maintainer review

Keep open: the raw-parent verifier is a distinct repair not present on the fetched current main, and the introduced implementation plus real-Git regression coverage support it without a concrete correctness blocker.

Priority: P2
Reviewed head: 3b2fb44d092a4bd265d72825f66b3d7175c327b9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is well-scoped to its safety boundary, has substantial real-Git coverage, and includes credible production-path validation.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.
Evidence reviewed 5 items Introduced safety boundary: The PR adds a bounded reader that accepts attribution only when the blamed line is added relative to every raw recorded parent; unverified and carried-forward lines are downgraded.
Public-output guard: Report parsing and comment rendering require the host-owned raw-parent marker before retaining historical owner metadata, preserving conservative handling for older unmarked reports.
Production-path regression coverage: The focused suite exercises disposable real Git histories and runs the built local-range review path through report and public-comment rendering for both verified and rejected attribution cases.
Findings None None.
Security None None.

How this fits together

ClawSweeper converts review inputs into durable reports and public comments. This change validates model-supplied history pointers at the Git boundary before report and comment rendering consume them.

flowchart LR
  A[Review decision] --> B[History pointer]
  B --> C[Raw Git history reader]
  C --> D{Line changed in parents?}
  D -->|Yes| E[Verified attribution]
  D -->|No or unknown| F[Conservative routing output]
  E --> G[Reports and public comments]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression coverage production +373/-141; tests +795/-479 The implementation growth is paired with substantial focused coverage for real Git-history edge cases and rendering.
Changed surface 19 files affected The repair spans the provenance reader, report pipeline, schema, documentation, and focused tests.

Technical review

Best possible solution:

Land the bounded raw-parent verification and retain the conservative unknown/carried-forward output when history cannot prove a source-line change.

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

Yes, at high confidence: the supplied proof and focused tests use disposable real Git repositories to exercise the local review and rendering path across positive and negative attribution cases.

Is this the best way to solve the issue?

Yes. Validating the exact blamed line against raw recorded parents at the shared Git boundary is narrower and more reliable than trusting blame display metadata or free-form reviewer attribution.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded review-integrity repair with limited blast radius and no availability, credential, or delivery impact.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.

Label justifications:

  • P2: This is a bounded review-integrity repair with limited blast radius and no availability, credential, or delivery impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the provenance reader and its report/comment projection; the supplied real-Git local-range CLI trace exercises introducing, unrelated, shallow, rename, graft, and malformed-history cases and reports conservative after-fix output with clean checkouts.

Evidence

What I checked:

  • Introduced safety boundary: The PR adds a bounded reader that accepts attribution only when the blamed line is added relative to every raw recorded parent; unverified and carried-forward lines are downgraded. (src/clawsweeper-regression-provenance.ts:90, 3b2fb44d092a)
  • Public-output guard: Report parsing and comment rendering require the host-owned raw-parent marker before retaining historical owner metadata, preserving conservative handling for older unmarked reports. (src/clawsweeper-report-parser.ts:319, 3b2fb44d092a)
  • Production-path regression coverage: The focused suite exercises disposable real Git histories and runs the built local-range review path through report and public-comment rendering for both verified and rejected attribution cases. (test/regression-provenance.test.ts:649, 3b2fb44d092a)
  • Feature history: Regression provenance was introduced and subsequently clarified in commits by Martin Cleary; the current PR continues that surface with a raw-parent verification boundary. (src/clawsweeper-regression-provenance.ts, dde38ecb4c74)
  • Contributor validation: The supplied PR evidence reports a Node 24 full check with 4,026 passing tests and a real local-range CLI/report-rendering trace at the recorded head. (3b2fb44d092a)

Likely related people:

  • Martin Cleary: Introduced and clarified the existing regression-provenance surface in the recorded history. (role: regression-provenance feature contributor; confidence: high; commits: bb69d1fc582d, dde38ecb4c74; files: src/clawsweeper-regression-provenance.ts)
  • Peter Steinberger: Current-main and proposed work both touch the review Git-evidence and provenance boundary. (role: recent review-runtime contributor; confidence: high; commits: e1eefe217304, 3b2fb44d092a; files: src/pr-review-evidence.ts, src/clawsweeper-regression-provenance.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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for the reviewed candidate.

The missing boundary was between model/blame hints and published historical attribution. One shared host-owned reader now verifies the implicated line against raw recorded parents, and report/comment readers preserve only that verified projection. This replaces the blame-only verification and unrestricted injected Git path; missing or carried-forward evidence stays conservative. The necessary proof/projection boundary accounts for net +232 production TypeScript lines and +33 prompt/schema lines; regression tests are net +316.

The final local command was:

PATH="/opt/homebrew/opt/git/bin:/opt/homebrew/opt/bash/bin:$PATH" pnpm run check

It passed all gates with 4,026 passing tests, nine skips, and no failures. The PR body records the separate 124-test focused run and executed native Codex/TruffleHog local-range CLI → persisted report → public-comment rendering proof. Independent precommit and committed-branch reviews both returned scoped-clean with no P0–P2 findings.

Exact-head CI run 33272663379 passed pnpm check, the sparse repair build smoke, and Windows Codex launcher coverage. CodeQL also passed. The dispatch-only hosted-native smoke was skipped in normal PR CI; the separately executed native proof is documented rather than describing that skip as a pass. The current ClawSweeper review found no actionable issues, marked proof sufficient, and listed no before-merge or rank-up work. Its reviewed head and source revision were checked against the unchanged PR head and body; this comment records validation completion without changing either.

Current-main drift was inspected: the overlapping prompt/docs edits are disjoint, attribution owners and their tests are unchanged, and the nearest scanner change is limited to unrelated fixture classification. GitHub reports the candidate mergeable with all relevant checks green; no enforced independent-approval rule applies. The original Browser comment remains untouched. Its actual historical blame invocation is still unproven: the recovered artifacts do not contain that stdout, and private/R2 retention has not been verified.

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