clawsweeper icon indicating copy to clipboard operation
clawsweeper copied to clipboard

ClawSweeper reprocessed stale re-review commands on closed PR

Open brokemac79 opened this issue 6 months ago • 1 comments

## 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 created 2026-05-18T19:30:48Z, updated at 2026-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:

  1. Have an open PR with multiple @clawsweeper re-review comments.
  2. Let ClawSweeper process at least some of those commands.
  3. Close the PR unmerged.
  4. Later run or trigger the command router/backfill path.
  5. 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_at as 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:

  • 83523
  • 83507
  • re_review
  • re-review
  • command-ack
  • closed PR

I did not find an obvious existing issue for this exact behavior.

brokemac79 avatar May 23 '26 21:05 brokemac79

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:

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-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.

clawsweeper[bot] avatar May 23 '26 21:05 clawsweeper[bot]