Skip to content

perf(review): superseded exact-review runs keep consuming Actions and leave stale placeholders #747

Description

@snowzlmbot

First submitted: July 21, 2026, 5:01 AM (US Eastern Time) / 09:01 UTC.
Last body edit: July 21, 2026, 8:19 AM (US Eastern Time) / 12:19 UTC.
Latest head commit: Not applicable (issues do not have a head commit).

Problem

ClawSweeper can start more than one exact-review Actions run for the same issue or pull request during a rapid revision sequence. When a newer source revision arrives after an older run has acquired a queue lease, the durable queue currently advances the item revision but leaves the older lease and Actions run active. The older run can continue consuming runner time and can leave a review-start placeholder for an older head visible until normal expiry or later cleanup.

This makes the visible review state difficult to interpret: a completed or in-progress review may refer to an older pull request head while a newer revision is already waiting for review. It also creates avoidable Actions usage during CI-fix and review-fix loops.

Steps to reproduce

  1. Use a pull request monitored by ClawSweeper with exact event dispatch enabled.
  2. Push or otherwise create a source revision that enqueues an exact review.
  3. Before the first review run completes, create a newer source revision for the same pull request.
  4. Observe the exact-review queue and the ClawSweeper workflow runs for that item.
  5. Repeat the sequence while a review-start placeholder exists.

A deterministic queue-level reproduction is to enqueue one ordinary source event, claim its item, then enqueue a second source event with supersedesInProgress=true for the same item before completion. The expected replacement revision is pending with a fresh debounce deadline; the current behavior keeps the old active lease unless it later expires.

Actual behavior

  • The newer event advances the durable revision, but an active leased or dispatching review is not immediately revoked.
  • The old Actions run can continue until it reaches a terminal state or the normal lease/reconciliation path handles it.
  • The old run's dedicated review-start placeholder can remain visible even after the newer head is the only revision that should be reviewed.
  • Rapid source events can trigger repeated review work before the source revision has settled.
  • The visible final review does not consistently identify the exact pull request head captured by that review.

Public examples of repeated same-item runs include:

Expected behavior

  • The first non-command source revision waits for a short debounce window so rapid edits can coalesce.
  • A later source revision that supersedes an active exact review immediately invalidates the old queue lease and starts a fresh debounce window for the latest decision.
  • The old claimed Actions run is cancelled by exact run id when possible. Workflow-level item concurrency provides a second cancellation path when the API cancellation races the run lifecycle.
  • A stale run cannot claim, complete, or publish after its lease tuple has been replaced.
  • Only ClawSweeper-owned, dedicated placeholders for the same item and a different head are removed; same-head election comments, durable review comments, untrusted comments, and malformed markers remain untouched.
  • Every visible durable PR review identifies the reviewed head.

Evidence

  • Source evidence: dashboard/exact-review-queue.ts currently keeps active leases when a newer source revision arrives; the queue already has revision/lease tuple guards that can make supersession fail closed.
  • Source evidence: .github/workflows/sweep.yml currently uses non-cancelling exact-item workflow concurrency for the event review job.
  • Related merged work: #710 cleans up provably superseded placeholders during durable publication, but does not revoke an active leased run when a newer source revision arrives.
  • Related work: #674 introduced item-level execution isolation, but active leased-run supersession and exact run cancellation remain separate concerns.
  • The implementation is available in #749 at code head 1aecfb402a13d16fb546fdf94eaf8dd0b76f2242.
  • Isolated after-fix lifecycle evidence on the dedicated evidence branch: old same-item run 29829301765 was cancelled; different-key sibling run 29829299161 completed success; latest-revision run 29829343136 completed success with build:all, five affected regression suites, lint, formatting, and a completed review-state artifact for code head 1aecfb402a13d16fb546fdf94eaf8dd0b76f2242.

Impact

This affects review latency, Actions runner consumption, and the reliability of human-visible review comments during rapid PR iteration. It does not change review analysis rules, close/merge policy, or durable publication authorization.

Environment

  • Repository: openclaw/clawsweeper
  • Workflow: .github/workflows/sweep.yml
  • Queue: exact-review Durable Object queue
  • Runtime: GitHub Actions and the deployed ClawSweeper dashboard worker

Labels considered

bug, impact:ux-friction, merge-risk: 🚨 automation, and P2.

Severity / Priority

Suggested priority: medium. The issue is operationally visible and wastes CI capacity, but the existing revision and publication guards reduce the risk of an unsafe final GitHub mutation.

Workaround

Maintainers can wait for the latest review run to finish and remove stale review-start placeholders through the existing cleanup/reconciliation paths. This does not prevent the older run from consuming capacity before it reaches a terminal state.

Additional context

The intended change is deliberately limited to trigger timing, active-run supersession, stale placeholder cleanup, and reviewed-head traceability. It does not alter the core review decision logic or broaden GitHub write permissions beyond the existing Actions cancellation and comment mutation surfaces. The proposed fix and its rollback/validation details are maintained in #749.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions