ClawSweeper reprocessed stale re-review commands on closed PR
## Summary
ClawSweeper appears to have reprocessed old @clawsweeper re-review comments on a closed OpenClaw PR, then posted fresh command acknowledgements several days after the PR was closed.
This looks like a command-router/idempotency issue around stale review commands on closed pull requests.
Evidence
Target PR:
- PR: https://github.com/openclaw/openclaw/pull/83523
- Linked issue: https://github.com/openclaw/openclaw/issues/83507
- PR title:
fix(gateway): emit session_start hook on agent.send auto-rotation (#83507) - PR state: closed, unmerged
- Closed at:
2026-05-19T05:02:03Z
After the PR had been closed for more than four days, ClawSweeper posted new command-ack comments on that closed PR:
| Time UTC | Event |
|---|---|
2026-05-23T18:14:04Z |
ack for old re-review comment 4479220614 |
2026-05-23T18:14:04Z |
ack for old re-review comment 4480734472 |
2026-05-23T18:14:05Z |
ack for old re-review comment 4481244444 |
2026-05-23T18:14:06Z |
ack for old re-review comment 4481810203 |
ClawSweeper also updated an older status comment on the closed PR:
- Comment
4481261952, originally created2026-05-18T19:30:48Z, updated at2026-05-23T19:00:40Z.
The comments are visible on https://github.com/openclaw/openclaw/pull/83523.
Actual behavior
Old @clawsweeper re-review comments on a closed, unmerged PR were acknowledged/reprocessed days after closure.
Expected behavior
ClawSweeper should ignore stale or already-handled command comments on closed PRs, or at minimum avoid posting new acknowledgements/work for a PR that is no longer open.
A closed PR should not become active-looking again because old command comments were picked up later.
Impact
This can confuse humans and automation during issue triage:
- closed/stale PRs can look active again
- issue duplicate detection can become noisy when deciding whether the linked issue is available to work on
- old command comments may trigger unnecessary background work or status churn
- issue queues that rely on ClawSweeper-linked PR state may be harder to reason about
Reproduction shape
A minimal repro appears to be:
- Have an open PR with multiple
@clawsweeper re-reviewcomments. - Let ClawSweeper process at least some of those commands.
- Close the PR unmerged.
- Later run or trigger the command router/backfill path.
- Observe whether ClawSweeper creates fresh command acknowledgements for old command comments on the closed PR.
Possible remediation
A few possible guards:
- before acknowledging or dispatching a command, re-fetch the issue/PR and no-op if it is closed unless the command is explicitly allowed on closed items
- treat commands created before
closed_atas stale for closed PRs - dedupe command handling by source comment id even if the source comment later has an updated timestamp
- for closed PRs, avoid creating new public ack/status comments unless the command itself was made after closure and is explicitly supported
Duplicate check
I searched openclaw/clawsweeper open and closed issues for combinations of:
8352383507re_reviewre-reviewcommand-ackclosed PR
I did not find an obvious existing issue for this exact behavior.
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 24, 2026, 7:09 PM ET / 23:09 UTC.
Summary Keep open. Current main still has a source-reproducible path that can create a public router response for a re-review command on a closed item, and https://github.com/openclaw/clawsweeper/pull/188 is the open closing PR that should land or be replaced before this issue closes.
Reproducibility: yes. from source inspection rather than a live run: current main still routes closed-item re_review commands to a public comment action, while the stale-command guard only covers automerge/autofix.
Next step A same-repo open PR already references this issue with closing syntax, so ClawSweeper should not queue a second autonomous fix branch.
Review details
Best possible solution:
Land or replace https://github.com/openclaw/clawsweeper/pull/188 with a narrow router/webhook guard plus regression coverage for pre-close and post-close re-review commands on closed PRs.
Do we have a high-confidence way to reproduce the issue?
Yes, from source inspection rather than a live run: current main still routes closed-item re_review commands to a public comment action, while the stale-command guard only covers automerge/autofix.
Is this the best way to solve the issue?
Yes. The narrow maintainable solution is to no-op stale pre-close re-review commands for closed PRs before public ack/comment dispatch while preserving supported fresh commands on open items.
Remaining risk / open question:
- The linked fix is still open and unmerged, so current main can still make closed PRs look newly active when stale re-review commands are routed.
Codex review notes: model gpt-5.5, reasoning high; reviewed against ac80f70fc906.
Label changes
Label changes:
- remove
clawsweeper:queueable-fix: Current issue advisory state no longer selects this label. - remove
clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.
Label justifications:
P2: This is a normal-priority command-router idempotency bug with limited but real triage noise.impact:message-loss: The report is about stale command handling creating misleading or duplicate command acknowledgements on closed pull requests.
Evidence reviewed
What I checked:
- Current router still comments on closed re-review commands:
classifyCommandtreatsre_reviewon a non-open issue/PR asreadywith a planned comment action, which matches the reported stale acknowledgement behavior. (src/repair/comment-router.ts:429, ac80f70fc906) - Existing stale-command guard is limited to automerge/autofix:
staleAutomergeActivationReasononly applies toautofixandautomerge, so current main does not extend that pre-close/closed-PR guard tore_review. (src/repair/comment-router-core.ts:1668, ac80f70fc906) - Webhook fast ack path lacks a closed-item state guard: The webhook accepts author read-only re-review commands and then creates a fast ack plus dispatches the comment router without checking whether the item is already closed. (
src/repair/comment-webhook.ts:168, ac80f70fc906) - Current tests only cover stale automerge activation: The current regression test around stale closed commands covers automerge after merge, not stale pre-close
re_reviewcommands on closed PRs. (test/repair/comment-router-core.test.ts:484, ac80f70fc906) - Open linked fix PR owns the remaining work: The provided GitHub context shows https://github.com/openclaw/clawsweeper/pull/188 is open, unmerged, and uses closing syntax for this issue; local object history shows its merge candidate changes
src/repair/comment-router-core.ts,src/repair/comment-router.ts,src/repair/comment-webhook.ts, and related tests. (bd4461816899) - History provenance for the current behavior: Blame ties the current closed-item
re_reviewcomment fallback insrc/repair/comment-router.tsto commit 2b08d2ec97b9ce059b3e0f861d9603a2a15c2a7b, with later adjacent edits in the same command-router area by Tak Hoffman. (src/repair/comment-router.ts:429, 2b08d2ec97b9)
Likely related people:
- Peter Steinberger: Blame ties the re-review command classification and current closed-item comment fallback to the initial scheduler/import commit, and the hosted webhook intake was also added in this area by Peter. (role: introduced behavior; confidence: medium; commits: 2b08d2ec97b9, c028d7905c2a; files:
src/repair/comment-router.ts,src/repair/comment-webhook.ts) - Takhoffman: Recent commits touched adjacent command-router behavior, and the open linked fix PR currently owns the proposed repair path for this issue. (role: recent adjacent contributor; confidence: medium; commits: 3f1affe587c6, 922e772ccf18; files:
src/repair/comment-router.ts,src/repair/comment-router-core.ts,src/repair/comment-webhook.ts)
How this review workflow works
- 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-reviewcomments, 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-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto 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 explainto ask for more context, or@clawsweeper stopto stop active automation.