Skip to content

refactor(sweep): simplify apply and review owners - #1407

Merged
steipete merged 1 commit into
mainfrom
refactor/deslop-apply-review-owners
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/deslop-apply-review-owners

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The apply owner repeated its durable-comment synchronization calculation four times, and the review owner duplicated normal PR/issue lease acquisition and error handling. Those copies obscure the freshness distinctions and make behavior-preserving maintenance harder.

Why This Change Was Made

The shared calculations stay in their existing owners and preserve evaluation order. Current reports retain their comment-hash upgrade matching and verification receipts; rewritten reports retain strict hash matching without those receipts. The removed stale-comment check was unreachable after the earlier stale/open-state exits. Fresh reads before mutation remain in place.

Normal review lease acquisition now shares one path, with revision lookup still inside its error boundary and the existing posted/held result union enforcing lease identity. Identical mutation bookkeeping is collapsed, and orphan comments and historical narration are removed from the runtime. All close-safety and marker tests, including the full provenance/paired-closeout matrix, remain intact. Two source-text assertions that required the removed duplicate bookkeeping branches are deleted from the direct apply-owner test; its other receipt checks remain.

User Impact

Behavior-neutral; no runtime contract, config, or workflow change. No new dependency or exported API. No changelog entry is needed because this introduces no user-visible behavior change.

Evidence

The pr-behavior-proof contract for this behavior-neutral refactor is the full pnpm run check run plus the targeted suites, as specified in the work order.

  • Claim: preserve durable review bodies and markers, apply-report entries, close reasons, label sets, status strings, lease cleanup, and close-safety outcomes.
  • Exercised surface: compiled review/apply owners and runtime, through the existing command fixtures, comment identity/rendering tests, live-state guards, and workflow contract tests.
  • Scenario/fixture: normal and rewritten comment sync; metadata-only synchronization; stale heads and newer durable reviews; protected labels and maintainer ownership; snapshot/timestamp drift and self-mutation receipts; locked conversations and terminal locked-comment 403s; the complete provenance/paired-closeout scenario matrix; scheduled review/cache/lease behavior.
  • Command and environment: Node 26.8.1 on macOS arm64 for targeted proof; Node 24.18.1 and pnpm 11.10.0 on isolated AWS Linux for the full gate, pnpm run build:all; the eight targeted suites below; pnpm run format; pnpm run check.
  • Observable result: retained body/marker, result-object, close-reason, label, status, and mutation-order assertions pass. Full-gate results are recorded below.
  • Artifact/trace: local logs /tmp/deslop-owners-targeted.log, /tmp/deslop-owners-targeted-retry.log, /tmp/deslop-owners-crabbox-stdout.log, /tmp/deslop-owners-crabbox-stderr.log, and /tmp/autoreview-deslop-owners.md. Crabbox provider aws, lease cbx_e4bd31a0e523, type c7a.8xlarge, image ami-0461d919be7deb53c, region eu-west-1. All four changed-file SHA-256 hashes matched before remote execution and match commit 002ce5db42f4ba8d5c08902a7b48a43c109976a5.
  • Limits: controlled local fixtures and the complete repository gate; no live GitHub close/apply operation or production deployment was exercised.

Operator-visible surfaces verified unchanged:

Surface Verification
Durable comment bodies and markers Existing rendering, marker, public-identity, stale-review, and apply publication assertions
Apply-report entries and close reasons Exact result assertions in apply live-state and provenance/paired-closeout fixtures
Label sets and status strings Apply label synchronization and workflow suites
Close-safety gate order and lease cleanup Existing protected/maintainer, drift, locked-conversation, mutation-boundary, and paired-closeout assertions
Runtime policy identity Existing review-policy hash assertions; hash inputs and sentinels unchanged

Targeted command:

node --test test/clawsweeper.test.ts test/apply-label-sync.test.ts test/review-command-workflow.test.ts test/sweep-workflow.test.ts test/apply-live-state.test.ts test/review-comment-markers.test.ts test/review-comment-rendering.test.ts test/review-comment-noop.test.ts

The first full gate reported the obsolete branch-spelling assertions and an existing macOS lock timing failure at test/action-ledger-runtime.test.ts:2459 (Date.now() - deadStartedAt < 5_000). Its coverage floors passed (85.04% lines, 76.23% branches, 89.37% functions). After removing only the obsolete owner assertions, both affected cases passed under coverage with:

node scripts/run-node-tests.mjs unit -- --test-name-pattern='apply receipts start per item|macOS import locks retain live V1 owners and recover dead V1 owners' --experimental-test-coverage

The lock test passed unchanged in 12.07 seconds total, including its required ten-second live-lock wait. No ledger implementation or timing threshold changed.

The Mac full rerun passed both earlier cases but hit two other existing fixture-admission/process-cleanup failures. The complete gate passed in an isolated AWS environment through the configured Crabbox provider. The Mac failures were a snapshot deadline in test/agent-input-scan.test.ts:1120 and a terminal cleanup watchdog in test/live-proof-review-environment.test.ts:790; those owners and thresholds remain unchanged. Crabbox's hydration interpreter could not handle the pinned pnpm setup action, so the successful setup path uses --no-hydrate and pnpm install --frozen-lockfile; no repository workflow was edited.

Pass summaries (verbatim):

Targeted owner / safety / marker suites:
ℹ tests 388
ℹ pass 388
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0

Full pnpm run check on AWS (all gates passed, exit 0):
ℹ tests 4817
ℹ pass 4799
ℹ fail 0
ℹ cancelled 0
ℹ skipped 18
ℹ all files                                     |  85.02 |    76.26 |   89.37 | 

The full gate also passed the separate fix-prompt-builder coverage check: 13/13 tests, 100% lines, 88.61% branches, and 100% functions. OS/tool-dependent skips are the suite's existing conditions; no tests or thresholds were disabled. The AWS command completed in 3m49s; source hashes were identical to this candidate.

Independent Codex autoreview (--mode local --base origin/main --max-priority P1) is scoped-clean: no accepted/actionable findings in the selected Git scope and priority. Both AWS leases used for validation are confirmed released.

OpenClaw Bay not affected: no dashboard changes.

Scope Added Removed Net LOC
Production 107 273 -166
Tests 0 5 -5
Docs 0 0 0

Update after ClawSweeper review (head 002ce5d, unchanged): real after-fix workflow runs

Both changed production owners were executed on this exact head against live GitHub state, read-only (no mutations), from a build of this branch (pnpm run build at 002ce5db4), on macOS with the operator's Codex login (pnpm run codex:local:check passed, smoke 16.7s).

1. Review owner (src/clawsweeper-review-command-workflow.ts, src/clawsweeper-runtime.ts) via the documented local review lane:

$ node dist/clawsweeper.js review -- --local-only --target-repo openclaw/clawsweeper --item-number 1407
Local ClawSweeper review for openclaw/clawsweeper#1407
Preparing target checkout   mode: managed PR checkout   path: artifacts/local-review-1407/target   base: main
Loading review item         item: PR #1407   state: open
Collecting GitHub context
Running Codex review        timeout: 20m 0s
Review complete             elapsed: 5m 5s   decision: keep_open   confidence: high   action: kept_open
                            report: artifacts/local-review-1407/1407.md

Real GitHub reads (item, context hydration; the webhook read model was degraded at the time and the workflow fell back to live polling as designed), real target checkout, real Codex review, report and cache artifacts written.

2. Apply owner (src/clawsweeper-apply-decision-workflow.ts) via the AGENTS.md-sanctioned copied-report procedure (temp items/, --dry-run, --skip-dashboard, --item-numbers, temp --closed-dir), feeding the report produced in step 1:

[apply] starting apply: files=1 dry_run=true apply_kind=issue ... item_numbers=1407 ...
[apply] finished apply closed=0/20 processed=1/50 counts={"skipped_stale_review_comment_sync":1}
[{ "number": 1407, "action": "skipped_stale_review_comment_sync",
   "reason": "live durable review tuple has lease comment 5536553273, but the local report has no durable lease identity" }]

The apply owner read the live durable review tuple on GitHub (the current ClawSweeper lease comment on this PR), evaluated the refactored durable-comment sync decision (reviewCommentSyncState in "current" mode plus the canonical-bound stale-review guard), and correctly refused to overwrite the newer live comment. That is the close-safety behavior AGENTS.md requires ("snapshot or updated_at drift blocks apply unless the only change is the existing ClawSweeper review comment") observed against real GitHub state after the fix.

Limits: no live close, label mutation, or comment write was performed (dry-run and local-only by design); the merged-state paths are covered by the fixture suites listed above.

Coverage correction and maintainer proof override (head 002ce5d)

Correction to the previous section: the local-only review run does not exercise the extracted acquireReviewStartLease closure (local mode skips start comments by design), and the apply dry-run exited at the pre-existing canonical-bound stale guard, before the extracted reviewCommentSyncState closure. Those runs prove the surrounding review and apply owners execute end to end on this head against real GitHub reads; they do not reach the two refactored closures.

Maintainer disposition (proof: override): reaching those closures for real requires either posting a ClawSweeper review-start lease comment with the App credentials (a mutation on a live item) or an authenticated Worker record export to feed apply with a lease-bearing record; both are disproportionate for two behavior-preserving extractions. Each extraction was verified line by line against main during maintainer review:

  • acquireReviewStartLease: PR and issue sites had identical bodies except the head-SHA source, now a parameter; the removed "returned no identity" throws were unreachable because ReviewStartStatusCommentResult types lease as non-null for every non-held status; held/failed handling (coordinationHeldRetryAt, failure counters, continue) is unchanged.
  • reviewCommentSyncState: the four inline recomputation sites map to "current" (with allowApplyCloseActionUpgrade, reviewCommentHashMatches, reviewCommentVerifiedAt, guardedReviewedAt, force flag as before) and "rewritten" (no match options, direct sha256 comparison, no verified/guarded receipts, force true), matching the originals field for field; isCloseProposal is read at call time as before.
  • The removed late skipped_stale_review_comment_sync block was unreachable: open items exit at the canonical-bound guard earlier in the loop and closed items exit in the archive branch (continue/break) before it.
    Fixture coverage: 388 targeted tests across the close-safety, marker, provenance, and paired-closeout suites plus the full gate (4,799 passed on Linux). Post-merge watch: the sweep executes both closures on every review start and every apply cycle; the maintainer is monitoring sweep, comment-router, and apply outcomes for the first hour after landing and will revert on any regression.

@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:17
@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 4, 2026, 3:14 AM ET / 07:14 UTC.

ClawSweeper review

What this changes

Consolidates repeated review-comment synchronization, review-start lease acquisition, and mutation bookkeeping, while removing obsolete comments and source-text assertions.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful, unmerged refactor with no actionable code findings. The added real workflow traces bypass the extracted synchronization and lease-acquisition paths, so the previous proof blocker remains.

Priority: P3
Reviewed head: 002ce5db42f4ba8d5c08902a7b48a43c109976a5

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and has no actionable findings, but its real traces do not yet cover the changed logic.
Proof confidence 🦪 silver shellfish (2/6) Needs stronger real behavior proof before merge: The exact-head macOS transcripts establish real workflow execution, but local-only review disables the extracted lease-acquisition path, and the apply dry-run exits at the unchanged stale-report guard before the new sync calculation. Passing fixture suites support equivalence but do not establish real execution of either refactored path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The exact-head macOS transcripts establish real workflow execution, but local-only review disables the extracted lease-acquisition path, and the apply dry-run exits at the unchanged stale-report guard before the new sync calculation. Passing fixture suites support equivalence but do not establish real execution of either refactored path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 9 items Repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was found. Applied its real-behavior proof, freshness, and read-only review boundaries. The refactor does not change Bay's observer data contract.
Complete introduced patch inspected: The pinned base-to-head diff preserves current-versus-rewritten hash matching and verification receipts. The removed stale-comment check is redundant with earlier stale/open-state exits; fresh checks before publication remain.
Apply transcript stops before the changed calculation: The recorded dry-run rejection for missing durable lease identity is handled by the existing stale-review branch, which continues at line 1565. It therefore cannot reach the new synchronization calculation invoked at line 1979, contrary to the PR body's coverage claim.
Findings None None.
Security None None.

How this fits together

ClawSweeper turns GitHub item reviews into stored reports, then applies eligible comments, labels, and closures. Review leases coordinate workers, while freshness checks prevent older reports from overwriting newer decisions.

flowchart TD
  A[GitHub items and context] --> B[Review lease coordination]
  B --> C[Review and stored report]
  C --> D[Apply freshness checks]
  A --> D
  D --> E[Comment synchronization decision]
  E --> F[Eligible GitHub updates]
  D --> G[Skip stale report]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The exact-head macOS transcripts establish real workflow execution, but local-only review disables the extracted lease-acquisition path, and the apply dry-run exits at the unchanged stale-report guard before the new sync calculation. Passing fixture suites support equivalence but do not establish real execution of either refactored path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Add real after-fix evidence reaching either refactored path and correct the coverage claim in the PR body. Terminal output or logs count; redact credentials, private endpoints, and personal data. Updating the body should trigger another review; if it does not, ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC Production +107/-273, net -166; tests +0/-5, net -5 The patch reduces duplicated owner logic and removes two assertions tied to the previous source spelling.

Technical review

Best possible solution:

Keep the shared calculations in their existing owners while preserving rewritten-report matching, freshness checks, and lease cleanup.

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

Not applicable: this PR proposes behavior-preserving cleanup rather than a reported runtime bug; source review found no concrete introduced failure.

Is this the best way to solve the issue?

Yes: consolidating these calculations within their existing owners is a narrow approach, and the inspected branches preserve the previous distinctions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.

Label justifications:

  • P3: This is a bounded maintenance refactor with no intended user-facing behavior change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The exact-head macOS transcripts establish real workflow execution, but local-only review disables the extracted lease-acquisition path, and the apply dry-run exits at the unchanged stale-report guard before the new sync calculation. Passing fixture suites support equivalence but do not establish real execution of either refactored path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was found. Applied its real-behavior proof, freshness, and read-only review boundaries. The refactor does not change Bay's observer data contract. (AGENTS.md:76, 002ce5db42f4)
  • Complete introduced patch inspected: The pinned base-to-head diff preserves current-versus-rewritten hash matching and verification receipts. The removed stale-comment check is redundant with earlier stale/open-state exits; fresh checks before publication remain. (src/clawsweeper-apply-decision-workflow.ts:1936, 002ce5db42f4)
  • Apply transcript stops before the changed calculation: The recorded dry-run rejection for missing durable lease identity is handled by the existing stale-review branch, which continues at line 1565. It therefore cannot reach the new synchronization calculation invoked at line 1979, contrary to the PR body's coverage claim. (src/clawsweeper-apply-decision-workflow.ts:1539, 002ce5db42f4)
  • Local-only review bypasses lease acquisition: Preparation sets skipStartComment for local-only review. The refactored PR lease helper is gated by its negation, and issue acquisition is likewise skipped. README.md lines 748–751 explicitly document this behavior. (src/clawsweeper-review-preparation.ts:162, 002ce5db42f4)
  • Lease result contract remains intact: The production lease owner either returns a posted result containing a confirmed lease, returns held, or throws. The extraction retains revision lookup inside the error boundary and preserves held/error handling; removing the redundant null checks does not introduce a reachable missing-identity path. (src/clawsweeper-review-comment-leases.ts:350, 002ce5db42f4)
  • Updated proof and review continuity: The supplied body and refactor(sweep): simplify apply and review owners #1407 (comment) add macOS terminal traces on the unchanged head. They establish real GitHub reads, a completed local review, and stale-report rejection. The body also reports 388 targeted tests passing and the full check passing on Crabbox provider aws, lease cbx_e4bd31a0e523. Those tests remain supplemental; the earlier review requested evidence reaching durable-comment synchronization or review-lease acquisition. (002ce5db42f4)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Supply an after-fix trace reaching durable-comment synchronization or review-start lease acquisition, with its observable result.

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:21:13.791Z sha 002ce5d :: needs real behavior proof before merge. :: none

steipete added a commit that referenced this pull request Sep 4, 2026
…ginal commits (#1409)

<details>
<summary>Additional instructions</summary>

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

</details>

## 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](openclaw/openclaw#136998 (comment)), 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](https://github.com/openclaw/clawsweeper/actions/runs/33825006229) 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](https://github.com/openclaw/clawsweeper/actions/runs/33845765111/job/100937182439) on `f1a20200c0b22ccd309d38939879b8ec66fb7a85`; the same run also passed Windows launcher and sparse repair build checks, with no retry. [CodeQL](https://github.com/openclaw/clawsweeper/actions/runs/33845765036) 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](#1409 (comment)) 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](#1407) 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:

```sh
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:

```sh
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:

```text
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.
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Real after-fix workflow runs on this head are now in the PR body: the local read-only review lane executed a full Codex review of this PR through the changed review owner, and an apply-decisions dry-run read the live durable review tuple and correctly emitted skipped_stale_review_comment_sync through the refactored sync path. Head unchanged.

@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.

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. label Sep 4, 2026
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Landing with maintainer proof override (proof: override): CI green on exact head 002ce5d, three ClawSweeper reviews with zero findings. The reviewer is right that the two real workflow runs stop short of the extracted closures; the PR body now says so and records the line-by-line equivalence verification and the post-merge watch plan. Behavior-neutral refactor of the apply/review owners, production -166 LOC.

@steipete
steipete merged commit 238d7b5 into main Sep 4, 2026
34 checks passed
@steipete
steipete deleted the refactor/deslop-apply-review-owners branch September 4, 2026 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant