Skip to content

fix(review): preserve history across local reruns - #1133

Merged
brokemac79 merged 3 commits into
mainfrom
codex/csw-126-local-review-history
Aug 12, 2026
Merged

brokemac79 merged 3 commits into
mainfrom
codex/csw-126-local-review-history

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve bounded prior-review context across repeated local ClawSweeper runs, mirroring hosted review history
  • scope exact-item history by repository and item, and committed-range history by repository, resolved base, and ancestry
  • retain the last completed review through failed reruns so an unreviewed head is never promoted as reviewed
  • keep the existing severity, proof, readiness, freshness, and stopping criteria unchanged

Problem

Hosted review carries the latest durable ClawSweeper result into the next review as previousClawSweeperReview. Local review did not: --local-range started without prior review state, and exact --local-only runs did not reuse earlier local results. Repeated local runs were independent reviews, so they could not reliably reconcile fixed findings, earlier dispositions, or genuinely late findings.

The implementation now reuses the same bounded hosted representation and parser. History is reconciliation context only; every prompt still requires an independent full inspection.

Implementation

  • render each completed local report into the hosted durable-comment/history format, including the existing eight-cycle bound
  • parse subsequent local runs through the hosted structured previous-review parser
  • key exact-item history by canonical repository slug and item number
  • validate legacy numeric-report bootstrap front matter against both repository and item before reuse
  • key committed-range history by canonical repository slug and resolved merge-base SHA
  • require the prior reviewed SHA to be an ancestor of the current committed-range head
  • advance persisted history only for review_status: complete; a failed rerun retains the prior completed body
  • document persistence and invalidation rules

ClawSweeper feedback disposition

  • Accepted P2 — cross-repository exact bootstrap: a same-number numeric report from another repository could seed prior findings. Fixed by validating repository and item front matter before rendering bootstrap history; focused matching, cross-repository, and cross-item assertions added.
  • Accepted P2 — failed-head attribution: a failed local rerun could replace completed history with current-head markers plus older findings. Fixed by advancing history only after a completed report; success → failure → success coverage proves the recovery prompt retains the last completed SHA.
  • Rank-up proof move: completed with current-head Docker-backed Crabbox focused behavior and broad pnpm check receipts below.
  • Rejected findings: none.

Validation

Current head: 98280ac678bc997d8a62d396605ae0e2df76ce63
Base: a1795973a9e6bb00b73cd6adc21a4ea02ca78ced

  • pnpm run build:all
  • node --test --test-name-pattern="local exact review history is keyed by repository and item" test/command.test.ts
  • node --test --test-name-pattern="exact local bootstrap rejects" test/review-command-workflow.test.ts
  • node --test --test-name-pattern="carries hosted-shaped review history" test/local-range-review.test.ts
  • node --test test/review-prompt-context.test.ts test/context.test.ts — 30/30 passed
  • pnpm run lint:src
  • pnpm run lint:scripts
  • focused oxfmt --check on all changed files
  • git diff --check origin/main..HEAD
  • pnpm run check in Docker-backed Crabbox — static checks, all builds, all lint lanes, changed coverage, and 248-file full coverage passed

The success → failure → success regression was also run with only the persistence guard temporarily reverted to the prior behavior: it failed because the third prompt received the failed head. Restoring the committed guard made the same regression pass; the worktree was clean afterward.

Real Behavior Proof

  • Claim: a repeated local review receives only compatible completed prior state in the hosted bounded representation; failed or unrelated runs cannot advance or contaminate that state.
  • Exercised surface: production exact --local-only bootstrap decision; production review --local-range CLI, Git-backed history discovery, prompt construction, hosted rendering/parsing, base/ancestry invalidation, failure retention, and clean-checkout behavior.
  • Scenario: deterministic local-range runs cover initial success, a descendant Codex failure, recovery success, changed base, and unrelated branch. The recovery prompt retains the first completed SHA and finding, not the failed head. Exact-item assertions cover matching identity plus same-number cross-repository and cross-item rejection.
  • Focused environment: exact head 98280ac678bc997d8a62d396605ae0e2df76ce63; Node v24.15.0; provider=local-container; image mcr.microsoft.com/playwright:v1.60.0-noble; lease cbx_d31caedc3ba6 (stopped).
  • Focused result: exact history identity 1/1, bootstrap identity 1/1, success/failure/recovery lifecycle 1/1, prompt/context 30/30, build:all, source/script lint, and focused formatting all passed; 14.060 s total.
  • Broad environment: same exact head/provider/image; lease cbx_20ece4f25f1f (stopped).
  • Broad result: pnpm run check passed, including static checks, all builds, all lint lanes, changed coverage, and 248-file full coverage; 261.755 s total.
  • Limits: the deterministic Codex boundary proves state transitions, target isolation, prompt admission, and failure recovery. It does not promise a fixed live-model convergence rate; model output remains nondeterministic. No GitHub write, hosted queue, gate, deployment, or production mutation was used for proof.
  • Staleness: earlier proof receipts for head e969dbba2f... are superseded. Only the two current-head leases above support this revision.

Review closeout

  • final dirty codex review --uncommitted: clean after each accepted fix
  • final codex review --base origin/main: no actionable correctness defects
  • final local pnpm run review -- --local-range --target-repo openclaw/clawsweeper --base origin/main: review_status: complete, patch correct, confidence 0.89, no findings; it identified only the then-missing current-head proof, now supplied above
  • Codex's read-only Windows sandbox could not open the TypeScript shim (EPERM); the same builds and tests passed directly and in the exact-head Linux containers above

Risks, rollback, and OpenClaw Bay impact

  • Prior findings can anchor a model, so the prompt continues to require full independent inspection; history is not a finding allowlist.
  • History remains bounded to eight cycles, and malformed, cross-item, cross-repository, changed-base, unrelated-branch, and incomplete-run state is excluded.
  • Rollback is a normal revert of this PR's commits; no migration or hosted-state cleanup is required.
  • OpenClaw Bay impact: none. This changes only local review persistence under local artifact/Git paths; hosted publication, queues, workflows, gates, deployments, and Bay behavior are unchanged.
  • Maintainer decision: no product or rollout decision is required; ordinary code-review judgment remains.
  • Release note: repeated local reviews now remember compatible completed earlier results, making fix verification and late-finding classification align with hosted review more closely.

@clawsweeper

clawsweeper Bot commented Aug 12, 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 merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 7:03 AM ET / 11:03 UTC.

ClawSweeper review

What this changes

The PR persists compatible completed local-review history for exact-item and committed-range reruns so subsequent prompts can reconcile earlier findings.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for normal maintainer review: current main does not contain this local-history behavior, and the submitted implementation is coherent with sufficient focused proof.

Priority: P2
Reviewed head: 98280ac678bc997d8a62d396605ae0e2df76ce63

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong current-head behavior proof and focused coverage support a normal maintainer review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies current-head Docker-backed deterministic traces for identity isolation, failure retention, recovery, and broad validation.
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 current-head Docker-backed deterministic traces for identity isolation, failure retention, recovery, and broad validation.
Evidence reviewed 5 items Not implemented on current main: The PR head is not an ancestor of current main, and the main-branch README describes unique local-range artifact directories without persisted review history.
Scoped persistence and admission checks: The branch keys exact history by repository/item and range history by repository/base, then admits range history only when the reviewed SHA is an ancestor of the current head.
Failure-retention behavior: History advances only when the generated report has review_status complete; a failed rerun retains the prior completed rendered body.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s local review commands construct Codex prompts from Git and artifact state, then emit reports for later inspection. This change stores completed review context locally and supplies it to compatible later runs while rejecting unrelated, incomplete, or failed state.

flowchart LR
A[Local review command] --> B[Artifacts and Git history]
B --> C[Identity and ancestry checks]
C --> D[Previous completed review]
D --> E[Codex review prompt]
E --> F[New local report]
F --> B
Loading

Before merge

  • Resolve merge risk (P1) - Merging adds persisted local review state that influences later prompts, so the repository/item, base, ancestry, parser, and completed-review gates remain compatibility-critical.
  • Complete next step (P2) - No discrete repair is indicated; this PR is ready for ordinary maintainer review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Changed surface 11 files, +401/-13 lines The change spans local command flow, persistence helpers, docs, and focused tests.
Lifecycle coverage 1 success→failure→recovery test; 2 exact-bootstrap isolation checks These cases cover the primary risk of failed or unrelated state being reused.
Current-head proof 2 Docker-backed Crabbox receipts The PR body records focused and broad validation for the reviewed head.

Merge-risk options

Maintainer options:

  1. Accept bounded local review history (recommended)
    Merge the scoped persistence behavior with its repository/item, base, ancestry, and completed-review guards intact.

Technical review

Best possible solution:

Keep local history as a bounded compatibility layer using the existing hosted comment renderer and parser, with incompatible or incomplete state excluded before prompt construction.

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

Yes: the checked-in deterministic test defines a current-head success, failure, recovery, changed-base, and unrelated-branch path for this behavior.

Is this the best way to solve the issue?

Yes: reusing the established hosted review-comment representation avoids a parallel history format while retaining bounded compatibility checks.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This changes local review-state persistence with bounded operator impact.
  • merge-risk: 🚨 session-state: Persisted prior-review context can affect later finding reconciliation and readiness assessment.
  • 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 current-head Docker-backed deterministic traces for identity isolation, failure retention, recovery, and broad validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies current-head Docker-backed deterministic traces for identity isolation, failure retention, recovery, and broad validation.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main path history records a recent review-command workflow change. (role: recent area contributor; confidence: medium; commits: 06bc47a5bde8; files: src/clawsweeper-review-command-workflow.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 (2 earlier review cycles)
  • reviewed 2026-08-12T09:56:45.623Z sha e969dbb :: needs changes before merge. :: [P2] Validate the bootstrap report's repository before reusing it
  • reviewed 2026-08-12T10:58:07.923Z sha 98280ac :: needs maintainer review before merge. :: none

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 12, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 12, 2026
@brokemac79
brokemac79 marked this pull request as ready for review August 12, 2026 11:00
@brokemac79
brokemac79 merged commit f0dd69f into main Aug 12, 2026
19 checks passed
@brokemac79
brokemac79 deleted the codex/csw-126-local-review-history branch August 12, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. 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