Skip to content

fix(publication): resume accepted tuple batch retries - #1152

Merged
steipete merged 4 commits into
mainfrom
steipete/tuple-protocol-rootcause
Aug 13, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/tuple-protocol-rootcause

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

Root-cause the two major tuple_protocol_invalid dead-letter fingerprints, repair the live batch retry path, and extend evidence-gated newer-head supersession to stale tuple failures without weakening current-head recovery.

Root cause

18100482292fa5b48fd215110a0be3a7d261257e337fdd57b748bee5482efac9 is exactly the digest of Error:invalid_direct_publication_plan. Before #1091, the Worker discarded validator detail, so this is an opacity bucket rather than one causal fingerprint. Nineteen of its 21 rows are mixed-case steipete/CodexBar publications. The adjacent first detailed row proves the old case-sensitive containment error (steipete/CodexBar versus records/steipete-codexbar/...), fixed by #1100. The two old lowercase rows lost their detail and are deliberately not guessed into that cause.

02bf7196a153893877e10306cc15656861a515b38c70dbc4fa16b6e9faea6e7a is exactly the digest of Error:invalid_direct_publication_plan: conflicting direct publication retry. It covers pre-#1143 runs for openclaw/openclaw#114173 and #121562 and post-#1143 command-originated protocol-v2 runs for #80396 and #82540, so it is one cause across both generations—not a protocol-v2 or command-intake shape bug. After the canonical tuple was accepted, a later batch attempt reran guarded apply. Refreshed current_item_* and apply_checked_at fields changed tuple bytes under the same fence/revision, and the immutable direct-plan guard rejected the replay before lifecycle post-effects could finish.

Fix design

  • On the batch-completion route only, an actively owned exact batch fence resumes from an existing terminal canonical receipt. The first accepted tuple remains authoritative and the batch can finish post-effects.
  • Non-batch direct publication keeps strict conflicting-plan rejection. Target-mismatched and unowned fences remain blocked.
  • tuple_protocol_invalid now enters fix(reconcile): supersede proven stale dead letters #1148's existing newer-head supersede path. The signed envelope/digest, repository, item number, PR type, complete status, exact live head, immediate live revalidation, ten-target cap, and 20-row cap are unchanged.
  • workflow_cancelled remains excluded. A tuple row on the current head never reaches supersession and remains eligible for ordinary fresh recovery.

Expected effect on the 30 tuple rows is evidence-dependent: proven older-head rows retire as superseded; current-head eligible rows re-review and publish through the repaired path (or the already-deployed mixed-case fix); unproven or ineligible rows stay open. There is no reason-only bulk resolution.

Proof

pr-behavior-proof

  • Claim: an accepted protocol-v2 command-shaped batch publication survives apply-only byte drift on retry, while direct conflicts and unowned fences stay rejected; stale tuple rows supersede only with newer-head canonical proof; current-head tuple rows recover.
  • Surface: HMAC-authenticated Worker publication endpoints plus the exact-review dead-letter operator CLI.
  • Scenario/fixture: loopback Worker/Durable Object, queue, GitHub, and canonical-record fixtures; real retained producer manifests/log evidence for the fingerprint diagnosis.
  • Observable result: RED reproduced HTTP 400 conflicting direct publication retry and the tuple reason exclusion. GREEN returned 202/deduped for the active batch, retained first canonical content, preserved direct HTTP 400, superseded only the proven tuple row, left workflow_cancelled open, and recovered the current-head tuple row.
  • Docker: Crabbox provider=local-container, lease cbx_e7a1213fcc2c (silver-barnacle-f1bf), image node:24-bookworm, committed source head 080904359d54c6e2cdf9b0e314bf44471c09d196; focused behavior 176/176 pass. The later container docs gate was blocked because bounded raw sync omitted 36 unrelated historical proof artifacts, recorded as a limit rather than a pass.
  • Full gate: complete host checkout pnpm run check passed 3,405 tests: 3,396 pass, 0 fail, 9 platform skips, with static/docs/build/lint/coverage green.
  • Reviews: pre-commit and final committed Codex autoreviews reported no accepted/actionable findings.
  • Artifacts: docs/proof/tuple-protocol-rootcause/ contains the behavior contract, RED/GREEN record, source-blind report, transcript, receipt, hashes, secret scan, and cleanup state.

OpenClaw Bay is unaffected. This is queue-owned publication replay and operator policy; Bay remains observer-only and gains no queue, workflow, GitHub, recovery, deploy, or rollback action.

No changelog change: this branch intentionally leaves release-owned history untouched.

@clawsweeper

clawsweeper Bot commented Aug 13, 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: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 12:17 AM ET / 04:17 UTC.

ClawSweeper review

What this changes

The PR allows an actively owned exact-review batch to reuse a terminal publication receipt after apply-only tuple drift, and lets evidence-proven stale tuple failures use existing newer-head supersession.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: the repair is not on current main, and the focused regressions plus committed Docker-backed loopback proof support the proposed boundary.

Likely related people

  • steipete — high confidence, introduced the adjacent supersession behavior and this repair.
  • Martin Cleary — medium confidence, recent contributor to the exact-review queue handoff path.

Priority: P2
Reviewed head: 5b67ae2dd54db3e25bafe8169dd549230068867b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, bounded repair with matching real-behavior proof and no actionable correctness or security finding.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.
Evidence reviewed 7 items Current main does not contain the repair: Current main unconditionally sends validated publication plans to the immutable receipt store, whose terminal-receipt conflict check rejects changed tuple bytes.
Narrow queue boundary: The branch bypasses immutable-plan comparison only for a deferred batch completion with active ownership and an existing published or superseded receipt; other paths still call the strict receipt store.
Supersession remains evidence-gated: Only tuple failures leave the excluded-reason set; the existing stale-head, canonical-evidence, immediate live revalidation, ten-target, and twenty-row guards remain in the reconciliation path.
Findings None None.
Security None None.

How this fits together

Exact-review workflows submit signed publication batches to the queue, which stores canonical report tuples and then completes lifecycle effects. A dead-letter operator separately reconciles failed publication rows against live pull-request heads and canonical records.

flowchart LR
  A[Exact-review workflow batch] --> B[Queue publication endpoint]
  B --> C{Active fence validation}
  C -->|Terminal receipt| D[Reuse canonical receipt]
  C -->|New tuple| E[Validate and store tuple]
  D --> F[Lifecycle post-effects]
  E --> F
  G[Dead-letter inventory] --> H[Evidence-gated supersede or recovery]
Loading

Before merge

  • Resolve merge risk (P1) - This intentionally expands automated terminal handling: an implementation mistake could mark an eligible stale tuple row superseded, although canonical evidence, live-head revalidation, and bounded target and row caps remain in force.
  • Complete next step (P2) - The open branch already contains the bounded repair and sufficient proof, so no separate repair job is warranted.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Runtime and tests production +20/-5; tests +103/-3 The behavioral change is small relative to focused regression coverage for both retry and reconciliation paths.
Committed proof 8 proof files, +652 lines The branch includes a behavior contract, red/green record, transcript, receipt, hashes, and cleanup record for the claimed runtime exercise.

Merge-risk options

Maintainer options:

  1. Accept the bounded reconciliation policy (recommended)
    Merge with the existing canonical-evidence, revalidation, target-cap, and row-cap controls that constrain automated tuple-row resolution.

Technical review

Best possible solution:

Land the narrow active-fence receipt reuse and retain the existing evidence and revalidation gates for every stale-head resolution.

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

Yes: the committed red/green record identifies current main 56cb78d and reproduces the changed-byte batch retry as HTTP 400, then exercises the repaired Worker and operator paths through loopback fixtures.

Is this the best way to solve the issue?

Yes: active batch ownership and a terminal canonical receipt are the narrowest boundaries for accepting apply-only byte drift, while direct conflicts remain strict and stale rows still need independent newer-head proof.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded reliability repair for exact-review publication and dead-letter automation.
  • add merge-risk: 🚨 automation: The PR changes queue retry completion and automatic stale dead-letter resolution behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.

Label justifications:

  • P2: This is a bounded reliability repair for exact-review publication and dead-letter automation.
  • merge-risk: 🚨 automation: The PR changes queue retry completion and automatic stale dead-letter resolution behavior.
  • 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 (linked_artifact): Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.
  • proof: sufficient: Contributor real behavior proof is sufficient. Committed local-container evidence exercises the signed Worker and Durable Object plus operator CLI, reports 176/176 focused passes, and hashes the code and tests unchanged through the PR head.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the merged evidence-gated stale-head supersession implementation and the current repair branch. (role: introduced adjacent reconciliation behavior; confidence: high; commits: ae36d608d017, 5b67ae2dd54d; files: scripts/exact-review-dead-letter-operator.mjs, dashboard/exact-review-queue.ts)
  • Martin Cleary: Current main’s most recent exact-review queue handoff update was authored by Martin Cleary. (role: recent area contributor; confidence: medium; commits: 56cb78d60734; files: dashboard/exact-review-queue.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
steipete merged commit 73ad372 into main Aug 13, 2026
18 checks passed
@steipete
steipete deleted the steipete/tuple-protocol-rootcause branch August 13, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. 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