Repository navigation
fix(review): clean up superseded review-started placeholder comments - #710
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 017736150e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (error instanceof GitHubRuntimeBudgetError) throw error; | ||
| // A failed sweep must never fail the publish; the next apply retries it. | ||
| console.error( |
There was a problem hiding this comment.
Retry failed sweeps when the durable comment already matches
When comment enumeration or a placeholder DELETE fails transiently, this function swallows the error and the apply run still records the durable comment as synchronized. On the next apply, that comment body and metadata already match, so needsReviewCommentBodySync is false and the only call to this cleanup routine is skipped; for close proposals the report may also be archived immediately. Thus the promised retry never occurs and the stale placeholder can remain permanently. Persist a cleanup-pending state or invoke the sweep even when no durable-body write is needed.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 5:43 PM ET / 21:43 UTC. Summary Reproducibility: yes. in source, with medium confidence: a cleanup list or DELETE failure followed by an apply where the durable comment is already synchronized skips the proposed cleanup trigger. A live GitHub retry sequence was not provided as real-behavior proof. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Run the stale-placeholder sweep independently of whether the durable review body needs rewriting, retain the existing lease and bot-author safeguards, add a retry-path regression test, and omit the release-owned changelog edit. Do we have a high-confidence way to reproduce the issue? Yes in source, with medium confidence: a cleanup list or DELETE failure followed by an apply where the durable comment is already synchronized skips the proposed cleanup trigger. A live GitHub retry sequence was not provided as real-behavior proof. Is this the best way to solve the issue? No: sweeping only after a durable-comment write does not reliably solve transient cleanup failures. The narrow maintainable fix is to retry or persist cleanup independently of body synchronization. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d7e01ce59f9d. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
…penclaw#710) * fix(review): clean up superseded review-started placeholders * fix(review): drop lease PATCH reuse; sweep placeholders only at publish * fix(review): sweep placeholders from the pre-mutation comment snapshot
Stops stale "ClawSweeper status: review started." placeholder comments from piling up on reviewed items.
Motivating case: openclaw/openclaw#110918 (2026-07-18) — after the durable review comment (created 19:32Z) was updated in place at 22:13Z, two stale placeholders from failed retry attempts (21:41Z, 22:06Z) remained as separate comments. Correctness was unaffected (placeholder recovery keys on the latest bot comment), but the clutter is user-visible on busy PRs.
Change
After
upsertReviewCommentsuccessfully publishes the durable review comment in the apply flow,cleanupSupersededReviewPlaceholderCommentsdeletes superseded placeholder comments viaDELETE /repos/{owner}/{repo}/issues/comments/{id}— the same issues:write surface the existing expired-lease reap already uses.Safety rails (
supersededReviewPlaceholderCommentIds):canPatchReviewComment);<!-- clawsweeper-review item=N -->marker is an additional exclusion;Why no placeholder reuse on retry
Refreshing a surviving placeholder in place (PATCH) was considered and rejected: the review-start lease election picks the lowest server-assigned comment id, so it needs a distinct comment per contender. Two racing workers PATCHing the same comment could both validate ownership and both proceed. Acquisition keeps POSTing a fresh comment; a source comment and a structural test now pin that down. Accumulation stays bounded because every durable-comment publish sweeps the leftovers (a placeholder's lease TTL is ~review timeout + 10 min, so earlier failed attempts are provably expired by then).
Tests
supersededReviewPlaceholderCommentIdsunit coverage: deletes expired/legacy bot placeholders only; keeps unexpired leases, non-bot authors, keep-listed ids, and never the durable review comment (including a durable body that opens with the placeholder line).Build, lint, format, and all touched suites green (
review-comment-rendering,clawsweeper-action-ledger,review-placeholder-recovery). Fullpnpm run checkruns tripped only the known host-load timing flake infailed-review-retry(2.2s runtime-budget test, host load avg 200+ from concurrent workers; same class #709 hardens) — passes on isolated rerun. Autoreview (Codex) clean on the branch diff.Changelog: one-line Fixed entry under Unreleased.