Skip to content

fix: stop repeated review start comments after supersession - #1635

Merged
steipete merged 2 commits into
mainfrom
codex/stop-superseded-review-comment-retries
Sep 21, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/stop-superseded-review-comment-retries

Conversation

@steipete

@steipete steipete commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes repeated “review started” comments when an exact-review worker loses queue ownership before reserving its GitHub lease. Investigated from openclaw/openclaw#154935; the earlier workflow retried reservation five times and then completed as superseded without reviewing.

User Impact

Superseded workers stop before posting. A temporary queue outage retries the ownership check while reusing the same worker's active comment, avoiding a new notification on every attempt. Existing competing-worker and current-head guards remain in force.

Why This Change Was Made

Reservation previously posted a public comment before checking queue authority, then deleted and retried after rejection. The CLI now distinguishes terminal ownership rejection from unavailable queue checks. Exhausted service failures remain failures for queue recovery. The post-acquisition check still handles ownership changing during the GitHub write.

The temporary lease protocol remains intact because other review/apply lanes and publication provenance depend on its server-assigned comment identity. This change prevents the observed retry burst; it does not claim an atomic transaction between GitHub and the queue or eliminate legitimate new reviews' temporary comments.

OpenClaw Bay Impact

No Bay change is needed. This fixes reservation and retry behavior without adding lifecycle states, public fields, routes, or mutation controls. Existing superseded/failure reporting is retained.

Documentation Impact

Updated the active README and PR-review-comment contract to describe separate temporary lease comments, terminal supersession, and transient retry reuse. Corrected the placeholder's promise to edit itself into the final review. Added the maintainer changelog entry.

Evidence

  • Four focused suites: 245 passed, zero failures.
  • Full repository check: passed: 6,457 tests passed, 19 skipped, zero failures; the separate changed-coverage gate also passed all 13 tests.
  • Independent Codex review before commit and committed-branch review: both scoped-clean through P2, no accepted/actionable findings.

Real Behavior Proof

Claim and exercised surface: the production reservation shell from .github/workflows/sweep.yml, actual built reserve-review-lease CLI, real curl requests, and controlled loopback HTTP services exercise terminal and transient ownership decisions and observable comment writes.

Environment: AWS Crabbox, lease cbx_2898bf479ea0, image ami-0461d919be7deb53c, Linux, Node 24.18.1, repository-pinned pnpm 12.4.1. Runtime proof head: 548bf854428a052fcacd197eb1f9a62129b6a0d1. Current PR head: f0ae3edde2d6d02c2c126d9daead9191852fddec; the only subsequent change relocates an unchanged changelog bullet to resolve a concurrent insertion conflict. The production, workflow, and harness source hashes are unchanged.

Command:

pnpm run build:all
RESERVATION_PROOF_PROVIDER=aws \
RESERVATION_PROOF_LEASE=cbx_2898bf479ea0 \
RESERVATION_PROOF_IMAGE=ami-0461d919be7deb53c \
node scripts/e2e/review-reservation.mjs /tmp/review-reservation-proof

Observed result: all nine scenarios passed.

Scenario Outcome Comments created Comments deleted
Already superseded Superseded after one check 0 0
Valid owner Posted 1 0
Service failure before acquisition Recovered 1 0
Service failure after acquisition Recovered, same comment ID 1 0
Queue throttle after acquisition Recovered, same comment ID 1 0
Ownership lost after acquisition Superseded 1 1
Head changed after acquisition Superseded 1 1
Another worker holds lease Held; other's comment preserved 0 0
Queue remains unavailable Failed after five checks 0 0

Artifacts and trace: scripts/e2e/review-reservation.mjs reproduces the fixture and writes summary.json with exact source hashes plus per-scenario HTTP traces. The normalized outcomes above are included here for inspection. The regression test runs the same production workflow path.

Limits: queue and GitHub responses are controlled synthetic services. This is real workflow/CLI/HTTP execution, not a live production GitHub mutation or model review. A race after the preflight can still create one temporary owned lease, which the terminal path removes; it does not repeat the rejected acquisition.

@steipete
steipete requested a review from a team as a code owner September 21, 2026 16:32
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 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 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 Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 12:49 PM ET / 16:49 UTC.

ClawSweeper review

What this changes

The PR checks queue ownership before posting review-start comments, reuses the same worker’s lease during transient failures, and stops retrying superseded reservations.

Merge readiness

✅ Ready for maintainer review

The fix remains useful on current main. No actionable correctness or security defect was found, and the supplied production-path proof supports the reservation and retry behavior.

Priority: P2
Reviewed head: f0ae3edde2d6d02c2c126d9daead9191852fddec

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant production-path proof and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.
Evidence reviewed 7 items Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was present. Applied the narrow-change, production-proof, Bay-impact, and read-only review requirements.
Introduced behavior: The pinned merge-base-to-head diff adds preflight ownership validation, same-owner lease reuse, terminal supersession handling, and bounded service-error retries without changing workflow permissions or dependency sources.
Still necessary on main: Fetched main still posts before checking queue authority, treats unsuccessful authority checks alike, and deletes the acquired lease before requesting another attempt. The central correction is therefore absent from current main; no merged replacement was established.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s exact-review workflow reserves a temporary GitHub comment before starting a review. Queue ownership and the current item revision determine whether the worker proceeds, defers, retries, or stops.

flowchart TD
  A[Queued review worker] --> B[Check queue ownership]
  B -->|Superseded| C[Stop without posting]
  B -->|Unavailable| D[Bounded retry]
  B -->|Authorized| E[Acquire or reuse comment lease]
  E --> F[Recheck ownership and revision]
  F -->|Valid| G[Run review]
  F -->|Unavailable| D
  F -->|Superseded| H[Release owned lease and stop]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Net code growth Production/workflow +41 lines; tests/proof +289 lines The modest production increase supports distinct retry outcomes, while most growth supplies the production-path fixture.
Behavior coverage 9 controlled HTTP scenarios Proof covers successful reservation, transient recovery, supersession, competing ownership, and retry exhaustion.

Technical review

Best possible solution:

Preserve the existing temporary-lease protocol while making supersession terminal and transient ownership checks reuse the authorized worker’s comment.

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

Yes, from source: current main posts and deletes a lease after rejected queue checks, then the workflow retries that acquisition up to five times. This review did not execute a failing main run.

Is this the best way to solve the issue?

Yes. The patch repairs the existing reservation boundary without replacing the lease protocol, and its controlled production-path proof exercises both terminal rejection and transient recovery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cc0a49acc8d7.

Labels

Label changes:

  • add P2: This repairs repeated review notifications and incorrect retry handling within the exact-review workflow.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.
  • 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 (live_output): The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.

Label justifications:

  • P2: This repairs repeated review notifications and incorrect retry handling within the exact-review workflow.
  • 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 (live_output): The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied AWS Crabbox results exercise the actual reservation shell, built CLI, and curl against controlled HTTP services, showing zero posts for superseded workers and single-comment transient recovery across nine scenarios. Relevant production sources are unchanged at the reviewed head; live GitHub and model execution are outside the stated proof scope.

Evidence

What I checked:

  • Applicable repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was present. Applied the narrow-change, production-proof, Bay-impact, and read-only review requirements. (AGENTS.md:1, f0ae3edde2d6)
  • Introduced behavior: The pinned merge-base-to-head diff adds preflight ownership validation, same-owner lease reuse, terminal supersession handling, and bounded service-error retries without changing workflow permissions or dependency sources. (src/clawsweeper-review-comment-leases.ts:255, f0ae3edde2d6)
  • Still necessary on main: Fetched main still posts before checking queue authority, treats unsuccessful authority checks alike, and deletes the acquired lease before requesting another attempt. The central correction is therefore absent from current main; no merged replacement was established. (src/clawsweeper-review-comment-leases.ts:318, cc0a49acc8d7)
  • Queue contract and unsuccessful-run cleanup: The heartbeat handler rejects inactive or mismatched lease tuples with HTTP 409. The workflow’s existing unsuccessful-run cleanup locates and deletes comments by the current run’s owner marker, including when reservation never emitted a comment ID; retaining a lease during transient retries does not bypass that cleanup. (.github/workflows/sweep.yml:1932, f0ae3edde2d6)
  • Production-path proof: The captured PR body reports nine passing scenarios on AWS Crabbox lease cbx_2898bf479ea0, image ami-0461d919be7deb53c, Node 24.18.1. The inspected harness extracts the actual reservation workflow shell, invokes the built CLI and real curl, and records HTTP comment effects through controlled services. Results include zero posts for preflight supersession, one retained comment during transient recovery, owned deletion after post-acquisition supersession, preservation of another worker’s lease, and failure after five unavailable checks. These are controlled service observations, not live GitHub mutations. (scripts/e2e/review-reservation.mjs:48, 548bf854428a)
  • Proof remains applicable: The proof revision and reviewed head differ only in CHANGELOG.md. Tree inspection confirms identical workflow, lease implementation, and harness blobs; the supplied proof therefore covers the reviewed production changes. The PR body also explains that Bay’s public fields, lifecycle states, and routes are unchanged. (CHANGELOG.md:12, f0ae3edde2d6)

Likely related people:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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