Repository navigation
fix(ledger): publish successful shard artifacts after workflow reruns - #1061
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 7:33 PM ET / 23:33 UTC. ClawSweeper reviewWhat this changesThe PR permits the sweep publisher to import successful review-ledger artifacts retained from earlier attempts of the same workflow run while keeping all other producer identity checks strict. Regression provenancePossible regression — probable (reproduction; reviewed change; failure trace). No predecessor PR is attributed. Merge readinessThis PR remains necessary: current main still uses exact attempt matching, while the proposed bounded retry-only admission preserves the other immutable provenance checks. No actionable patch finding was identified. Priority: P2 Review scores
Verification
How this fits togetherReview shards emit authenticated ledger artifacts during a sweep workflow. The publisher imports those artifacts before publishing durable review results, including when GitHub Actions reruns retain successful earlier shards. flowchart LR
A[Review shards] --> B[Immutable ledger artifacts]
B --> C[Actions rerun]
C --> D[Publisher provenance gate]
D --> E[Durable review results]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the strict immutable identity checks, merge the bounded exception only for retained review artifacts, and verify one safe sweep rerun or backfill after landing. Do we have a high-confidence way to reproduce the issue? Yes: current-main source establishes the exact-attempt rejection path, and the supplied current-head built-CLI proof recreates retained-attempt rejection, bounded acceptance, and later-attempt rejection. Is this the best way to solve the issue? Yes: preserving immutable producer identity and granting the upper-bound exception only to the retry collector is narrower and safer than weakening every importer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5bfa2d9f256d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review The PR body now includes the requested redacted current-head Docker-backed Crabbox trace from lease |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Fixes an issue where rerunning a partially failed ClawSweeper sweep could leave completed reviews unpublished. GitHub retains successful review-shard artifacts from the first attempt, but the attempt-2 publisher required every shard to claim
run_attempt=2; it rejected the valid retained attempt-1 ledger before publication.This was observed in run 31223072940 attempt 2, where the publisher reported
expected 2, got 1even though the review shard for openclaw/openclaw#120368 had completed and uploaded its review artifact.Why This Change Was Made
The ledger importer remains exact by default. It now also supports an explicit positive maximum-attempt provenance constraint, and only the sweep publisher's downloaded review-artifact handoff uses it. Repository, commit SHA, workflow, producer job, and workflow run ID must still match exactly; malformed constraints and artifacts from later attempts fail closed.
The sibling GitHub-read amplification exposed by the same incident was independently repaired and landed in #1060. This PR is based on that commit and owns only the retained-artifact provenance defect.
User Impact
Operators can rerun failed sweep jobs without losing successful reviews from earlier attempts of the same immutable workflow run. Exact command-manifest imports, current-job imports, and all other ledger provenance checks retain their previous strict behavior.
OpenClaw Bay is unaffected: this changes ledger import admission and one workflow caller, not dashboard or status data contracts.
Evidence
v24.19.0: all builds, the two ledger provenance tests, the two CLI validation tests, and the workflow provenance assertion.git diff --check origin/main...HEADpassed.origin/mainpassed with no actionable findings (0.99 confidence).pnpm run checkpassed formatting, all three builds, all lint lanes, the changed coverage gate, and the changed ledger/workflow tests. Its full-suite tail hit seven unrelatedtest/repair/target-validation.test.tsfixture failures because their isolated package mirrors could not resolve pinned[email protected]; exact-head hosted CI is the authoritative follow-up for that environment-only gap.Production LOC: +46/-5 (net +41) | Tests: +90/-0. The production growth introduces the explicit bounded provenance contract, validates it fail-closed at the CLI/runtime boundary, and binds the sole retry-aware workflow consumer to it.
Real Behavior Proof
dist/clawsweeper.js publish-action-eventscommand, and the real action-ledger shard writer/importer inside Docker-backed Crabbox.31223072940, producer jobreview, and attempt 1. The built publisher then ran as jobpublish, attempt 2, first in exact mode and then with the new maximum-attempt constraint.cbx_a2bd315ceba0(pearl-lobster), imagenode:24-bookworm, Nodev24.19.0, fresh PR checkout at0e1dc0fe7fa9c0afaaf7379979061a27fa90fe9c; no credentials or hydration. The uploaded proof script installed the frozen lockfile, built all TypeScript surfaces, ran the built CLI scenario, and ran the focused runtime/workflow tests.{ "schema": "clawsweeper.rerun-ledger-proof", "schema_version": 1, "head": "0e1dc0fe7fa9c0afaaf7379979061a27fa90fe9c", "immutable_identity": { "repository": "openclaw/clawsweeper", "sha": "0e1dc0fe7fa9c0afaaf7379979061a27fa90fe9c", "workflow": "sweep.yml", "job": "review", "run_id": "31223072940" }, "retained_attempt": { "producer_run_attempt": 1, "publisher_run_attempt": 2, "exact_mode": "rejected: expected 2, got 1", "bounded_mode": "accepted", "created_shards": 1 }, "future_attempt": { "producer_run_attempt": 3, "publisher_max_run_attempt": 2, "bounded_mode": "rejected: expected at most 2, got 3" } }leaseStopped: true; no container remains.Root Cause and Provenance
The authenticated importer compared every producer field for exact equality. That is correct for ordinary and manifest-bound imports, but the sweep publisher is a retry collector: GitHub reruns preserve successful artifacts from prior attempts under the same immutable run ID. The publisher supplied its current attempt as though it were the producer attempt, conflating collector generation with artifact generation.
The exact-attempt validation was introduced in
7ecb1fdc631ed17f9a9a20ae010ee1e087e3693cas part of #521. Blame identifies @vincentkoc as code author and #521 merger; the defect became observable in the August 7 rerun above.Best-Fix Assessment
Best-fix verdict: best owner-boundary repair. The importer owns provenance semantics, while the workflow caller owns whether it is an exact producer handoff or a retry collector.
Alternatives considered: removing the attempt check would weaken all imports and was rejected; rewriting downloaded shards to the collector attempt would forge provenance and was rejected; rerunning every successful review shard would waste model work and still encode the wrong artifact-ownership contract.
Remaining uncertainty: no post-merge deployed rerun has exercised the new workflow source yet. The safe canary/backfill is tracked as the landing follow-up.