Skip to content

fix(publication): stop retrying reviews superseded by newer results - #1249

Merged
steipete merged 2 commits into
mainfrom
fix/publisher-superseded-terminal-20260825
Aug 31, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/publisher-superseded-terminal-20260825

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

An exact-review artifact can be obsolete even when its source revision has not changed: a newer review lease has already published the authoritative durable comment. Apply correctly refuses to overwrite it, but the publisher treats that refusal as an unapplied failure, wasting confirmation retries and potentially dead-lettering work that should simply finish.

This change carries a structured newerReviewTupleVerified result from the apply guard to the publisher. It requires a trusted durable review, non-placeholder lease owners, the same source revision, positive safe-integer lease comment IDs, and a strictly newer live lease. Exactly one verified stale result completes as superseded / remote_newer_tuple, before mutation planning, state publication, or any fresh review.

This is the structured alternative to #1250. Human-readable reason text remains diagnostic. Equal, unsafe, missing-owner, mixed, and otherwise unproven results cannot authorize terminal supersession; legacy tupleless artifacts and guarded-open behavior retain their existing paths. There is no new retry policy.

The maintainer refresh incorporates current main, adds safe-integer and mixed-result controls, and replaces the fake apply-CLI publisher test with a regression that passes the real apply result through the real publisher. Scheduler documentation now describes the existing selected-comment publication path correctly. Contributor credit is retained.

Behavior proof

Candidate head: f88abbfbdbbf9ab4f31d89dd309e257227d18617. Baseline: 9f343df8bfd7e852a7e10601a6a9ea7345af6f60.

Provider: AWS Crabbox; lease cbx_066739d7d833; image ami-0461d919be7deb53c; Node v24.18.1, pnpm 11.10.0. The fresh checkout had no instance role (IMDS credential endpoint 404), no Tailscale, and no production credentials.

The controlled scenario supplies an issue artifact with lease 9100 and a trusted durable review on the same source revision with lease 9200. The compiled dist/repair/publish-event-result.js invokes the real apply-artifacts and apply-decisions CLI processes, using isolated item/closed/report/snapshot paths, selected item 74490, --skip-dashboard, and comment-only mode. Only GitHub transport is substituted; requests and attempted writes are captured.

The standalone process replay used these commands in separate baseline and candidate directories:

PROOF_SOURCE_SHA=9f343df8bfd7e852a7e10601a6a9ea7345af6f60 node .artifacts/stale-publication-proof.mjs before
node .artifacts/stale-publication-proof.mjs after

The temporary driver derives its issue/report and GitHub transport fixture from the maintained apply CAS regression and launches the built publisher directly; it does not substitute the apply CLI. The same fixture runs against baseline and candidate, with equal-lease and unknown-owner controls. The maintained regression additionally introduces the newer comment after apply preflight, checks unsafe IDs, and drives the resulting artifact through the built publisher. Reproduce that cross-module regression with:

pnpm run build:all
node --test --test-name-pattern='issue apply CAS and publisher' test/apply-label-sync.test.ts
node --test test/repair/event-apply-proof.test.ts test/repair/exact-review-batch-cli.test.ts
Scenario Baseline Candidate
Verified newer durable lease Exit 1, permanent failure Exit 0, superseded, no mutation plan or fresh review
Equal lease Exit 1, permanent failure Same; no terminal supersession
Unknown owner Exit 1, permanent failure Same; no terminal supersession

All six process runs recorded zero GitHub mutation calls. Proof run: run_0cbe78a7941a; artifacts: stale-publisher-before.json, stale-publisher-after.json, API call traces, publisher logs, batch JSON, and GitHub outputs. The exact candidate tree is 9e896984ffded8a6aac49f927ecb325ea543af8d. The baseline used an archive of the stated main SHA; the candidate proof ran before commit and its source tree is carried unchanged into the candidate head.

Proof limits: the CLI, record handling, apply guard, structured result, and publisher completion execute production code. GitHub transport is controlled and no real repository is mutated. This does not claim that every pending publication belongs to this bug class or that all legacy backlog will drain. The terminal batch-completion contract is separately covered by its existing compiled CLI regression.

Validation and review disposition

  • Full pnpm run check passed: 4,145 passing, 8 skipped (4,153 total tests).
  • The focused producer/publisher matrix and event/batch proof tests passed.
  • The original contributor head was checked independently before integration.
  • Fresh pre-commit and committed-branch Codex Autoreview against the stated baseline both completed with no accepted/actionable P0 findings; that is the configured review scope.

The prior review's request for a producer-to-publisher proof is addressed by exercising both real CLI stages, with the invalid controls preserved. The workflow's existing superseded completion and lease release remain the owners of terminal queue cleanup. Historical live-verification timeout output on the older head is superseded by this current runtime proof and checks.

OpenClaw Bay needs no change: this uses the existing superseded terminal outcome and remote_newer_tuple reason, with no observer schema, route, or browser action changes. Bay remains observer-only.

@clawsweeper

clawsweeper Bot commented Aug 26, 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. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 9:39 PM ET / August 31, 2026, 01:39 UTC.

ClawSweeper review

What this changes

This PR marks an exact-review publication as superseded only when apply verifies a strictly newer durable review tuple for the same revision, avoiding retries of an obsolete artifact.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: current main does not contain this introduced terminal-publication behavior, and this MEMBER-authored PR has a focused, fail-closed implementation with no actionable correctness finding.

Priority: P2
Reviewed head: f88abbfbdbbf9ab4f31d89dd309e257227d18617

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The patch is narrowly guarded, covers the producer-to-publisher boundary and invalid controls, and introduces no actionable review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate. Its body nonetheless records a current-head AWS Crabbox run through the compiled apply and publisher commands with controlled GitHub transport, invalid controls, and zero attempted mutations.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate. Its body nonetheless records a current-head AWS Crabbox run through the compiled apply and publisher commands with controlled GitHub transport, invalid controls, and zero attempted mutations.
Evidence reviewed 7 items Fail-closed tuple verification: The new verifier requires a trusted durable comment, non-placeholder owners, equal revision, positive safe-integer lease IDs, and a strictly greater live lease ID.
Stale-result provenance is rechecked: The apply guard emits terminal supersession evidence only when the stale reason and independently parsed durable tuple agree.
Producer-to-publisher regression coverage: The focused test exercises the real apply-decision command followed by the built publisher for verified, equal, unknown-owner, and unsafe-ID tuple cases, asserting no external mutation.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s apply lane compares a queued review artifact with the durable GitHub review comment before publishing it. The repair publisher then turns the verified apply result into a queue completion, retry, or failure outcome.

flowchart LR
A[Exact review artifact] --> B[Apply review guard]
B --> C[Durable review comment]
C --> D{Verified newer tuple?}
D -->|yes| E[Superseded completion]
D -->|no| F[Existing retry or apply path]
E --> G[Queue lifecycle completion]
Loading

Before merge

  • Resolve merge risk (P1) - A false-positive verification would terminally stop retrying an exact-review artifact; the implementation constrains this to one result with a complete, same-revision, strictly newer durable tuple.
  • Complete next step (P2) - No mechanical repair is needed; a maintainer must make the normal merge decision for this MEMBER-authored automation change.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Runtime and regression scope runtime +131/-18, tests +267/-95, docs/release notes +12/-6 Most changed lines establish the producer-to-publisher safety matrix for a narrowly scoped queue-completion outcome.
Files affected 13 files The change crosses apply guards, durable-comment state, publisher completion, and their focused tests.

Root-cause cluster

Relationship: canonical
Canonical: #1249
Summary: This PR is the structured current proposal for the stale exact-review publication outcome.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the scoped terminal outcome (recommended)
    Merge with the current full-tuple guard and regression matrix, which preserve nonterminal handling for ambiguous results.
  2. Request rollout observation
    Require an initial production queue observation if maintainers want confirmation of the new superseded completion beyond the controlled publisher trace.

Technical review

Best possible solution:

Land the structured durable-tuple signal while retaining the existing retry or failure path for every tuple that is equal, incomplete, unsafe, mixed, or otherwise unproven.

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

Yes: the current focused regression defines a same-revision artifact with lease 9100 and a durable review with lease 9200, then carries the real apply result into the built publisher. I did not execute it because this review is read-only.

Is this the best way to solve the issue?

Yes: carrying an explicit verification result avoids using diagnostic reason text as terminal authority, while the verifier preserves retries for every ambiguous tuple shape.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded reliability repair for exact-review publication automation.
  • merge-risk: 🚨 automation: The new terminal outcome changes whether an obsolete exact-review artifact is retried or completed.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate. Its body nonetheless records a current-head AWS Crabbox run through the compiled apply and publisher commands with controlled GitHub transport, invalid controls, and zero attempted mutations.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: 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)

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-08-26T00:32:17.474Z sha b44bb38 :: needs maintainer review before merge. :: none

Refresh against main, retain structured tuple evidence, reject unsafe or mixed results, and replace the fake apply CLI fixture with producer-to-publisher regression coverage.

Co-authored-by: Vincent Koc <[email protected]>
@steipete
steipete marked this pull request as ready for review August 31, 2026 01:35
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

The PR body now records current-head AWS Crabbox proof through the real compiled apply and publisher commands, before/after behavior, invalid controls, zero attempted GitHub mutations, full check results, and the prior finding disposition. Please review the current head and body.

@clawsweeper

clawsweeper Bot commented Aug 31, 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.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 31, 2026
@steipete
steipete merged commit c377cfc into main Aug 31, 2026
17 of 18 checks passed
@steipete
steipete deleted the fix/publisher-superseded-terminal-20260825 branch August 31, 2026 01:44
@steipete

steipete commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Landed as c377cfc. The merged tree is identical to the reviewed candidate, and Vincent's authorship is preserved. The overlapping proposal #1250 is closed as superseded.

The controlled real-command replay passed again on merged main in AWS Crabbox (cbx_066739d7d833, run run_9639435c1560). A verified newer same-revision tuple completed as superseded without a mutation plan or fresh review; equal-lease and unknown-owner controls remained failures. All three merged-main runs recorded zero GitHub mutation calls. The remote checkout ended clean on main, and the lease is released.

The full check passed with 4,145 passing tests and 8 skipped. Current-head CI passed at https://github.com/openclaw/clawsweeper/actions/runs/33348039463, and the fresh hosted review and its publication passed at https://github.com/openclaw/clawsweeper/actions/runs/33348117326. The review found no actionable defects; the terminal-outcome risk is covered by the complete-tuple guard and negative-case matrix.

The naturally scheduled merged-main batch https://github.com/openclaw/clawsweeper/actions/runs/33348684758 exercised the new terminal path on openclaw/clawhub#3543 and openclaw/clawhub#3554. Both logged a verified newer durable review tuple is already live. Finalization reported materialized: 1, superseded: 2, quarantined: 0. The run then failed on the existing exact_review_queue_unavailable heartbeat/fetch error, so this is positive proof of the changed publication path, not a claim of a completely healthy batch lifecycle.

A separate pre-merge publication failure, https://github.com/openclaw/clawsweeper/actions/runs/33348262322, returned exact_review_queue_unavailable for canonical-record setup, heartbeat, telemetry, and completion. This PR does not claim to fix that intermittent backend availability problem or clear every pending publication. A bounded post-merge Worker log sample observed 3,392 invocations with no HTTP 5xx or queue-error log entries; that sample did not reproduce or identify the root cause.

The other observed merged-main batch, https://github.com/openclaw/clawsweeper/actions/runs/33348522578, completed with a successful workflow conclusion and materialized: 3, superseded: 1, quarantined: 0. Its best-effort telemetry and unfinished-member release steps still reported the same backend 500. The successful conclusion therefore confirms publication progress, not full queue health.

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. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants