Skip to content

fix(review): recover orphaned review-started placeholders via the reconcile sweep - #661

Merged
steipete merged 2 commits into
mainfrom
fix/review-placeholder-recovery
Jul 17, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/review-placeholder-recovery

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Why

Public incident (openclaw/openclaw#88312, complained about on X): a "ClawSweeper status: review started" placeholder sat un-edited for 13+ hours. Root cause chain: the item's review artifact was terminal-dropped as stale, and its follow-up source_drift_requeue was shed by the backpressure gate during the 400+-item backlog spike — the item left the queue while its placeholder stayed up, with nothing due to touch it until the weekly cadence.

What

A recovery watchdog riding the existing 15-minute reconcile sweep:

  • Bounded discovery: search open target-repo items with the placeholder marker in comments (48h lookback, capped pages/checks).
  • Orphan predicate: latest clawsweeper-bot comment still contains the placeholder marker AND its most recent activity (max of created/updated) is older than 2h — a placeholder freshly re-touched by an active recovery run is never flagged (regression-tested against the exact #88312 timeline).
  • Recovery: HMAC-signed enqueue with sourceAction review_placeholder_recovery — deliberately NOT in the low-priority shed set, verified by a queue test that it is admitted at soft-limit depth (unknown actions are conservatively admitted). Enqueue dedupe/merge makes it idempotent against live items.
  • Caps: 20 checks / 5 recoveries per run; per-candidate fail-open; one summary log line. Tunables in docs/limits.md.

Review history

Codex build + 219 tests green (orphan detection incl. active-recovery boundary, runner with mocked search/comments/enqueue, caps, queue-admission). Two consciously documented exceptions: (1) the autoreview bundle scanner fail-closes on the module's own repeated HMAC-template string — a self-referential false positive; the diff contains only env reads and computed signatures (grep-verified, no literal secret), and the module half was line-by-line reviewed by the maintainer-side session including one real bug found and fixed there (orphan age must use latest activity, not created_at). (2) The workflow-half review's only finding re-claims actions/checkout@v7 does not exist — rejected with repo evidence (53 workflows run v7 in production daily).

@steipete
steipete requested a review from a team as a code owner July 17, 2026 22:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40c051ecfe

ℹ️ 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".

const comments: ReviewPlaceholderComment[] = [];
for (let page = 1; page <= COMMENT_MAX_PAGES; page += 1) {
const pageComments = await github<ReviewPlaceholderComment[]>(
`/repos/${repo}/issues/${number}/comments?sort=created&direction=desc&per_page=${COMMENT_PAGE_SIZE}&page=${page}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fetch newest issue comments before applying the cap

For issues/PRs that already have more than 200 comments before ClawSweeper posts the placeholder, this fetch will not see the placeholder: GitHub documents the issue-specific comments endpoint as ordered by ascending ID, and the sort/direction parameters are not supported there (https://docs.github.com/rest/issues/comments#list-issue-comments). Because the recovery only reads the first two pages, high-activity items found by search can be skipped or evaluated against an old bot comment instead of the latest one; use an endpoint/query that really returns newest comments first or paginate from the end before capping.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 849f5c2 into main Jul 17, 2026
9 of 10 checks passed
@steipete
steipete deleted the fix/review-placeholder-recovery branch July 17, 2026 22:43
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
…oncile sweep (openclaw#661)

* feat(review): placeholder-recovery module and tests

* ci(reconcile): run placeholder recovery on the 15-minute sweep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant