Skip to content

fix(dispatch): recheck pull request ack marker before posting - #1083

Merged
steipete merged 2 commits into
mainfrom
steipete/vibrant-easley-b03e79
Aug 9, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/vibrant-easley-b03e79

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Problem

A PR created as draft and marked ready within seconds can receive two receipt acks from the target dispatcher. Observed on openclaw/openclaw#120974 (2026-08-09): clawsweeper-pr-ack:opened at 07:15:20Z and clawsweeper-pr-ack:ready_for_review at 07:15:29Z, despite the idempotency check.

Root cause

The idempotency check already matches any clawsweeper-pr-ack: marker for the item, but it runs once at step start. The opened and ready_for_review runs can both list comments before either acknowledgement is visible (interleaved runs across the concurrency-group handoff, or comment-list read lag), so both proceed to POST.

Fix

The "Acknowledge received pull request" step now rechecks immediately before posting: after a clean first check it sleeps 15s, re-lists, and exits if any marker appeared. This closes both race directions:

  • a sibling ack posted in the meantime becomes visible before we POST;
  • if a superseding ready_for_review event arrives while the opened run is sleeping, the existing concurrency group's cancel-in-progress cancels the sleeping run before it ever posts, leaving exactly one poster.

The step stays continue-on-error and the marker format is unchanged. docs/target-dispatcher.md template stays byte-identical to the live workflow (enforced by test/target-dispatcher-workflow.test.ts), plus a short prose note on the race guard.

Proof

  • npx tsx --test test/clawsweeper.test.ts test/target-dispatcher-workflow.test.ts — 79/79 pass, including the byte-identity assertion.
  • bash -n on the extracted step script; actionlint clean; pnpm run check:static (incl. format:check over workflows) clean.
  • Marker-function probe: existing opened marker dedupes; wrong-item / empty / null-body payloads still post.

Follow-up: propagating the fixed step byte-identically to openclaw/openclaw's customized dispatcher copy (step there matched the pre-fix canonical step exactly).

A PR created as draft and marked ready within seconds fires opened and
ready_for_review runs that can both list comments before either
acknowledgement is visible, double-posting the receipt ack (observed on
openclaw/openclaw#120974). The ack step now waits 15s after a clean
first check and rechecks for any existing clawsweeper-pr-ack marker
immediately before posting; a superseding ready_for_review event cancels
a still-sleeping opened run through the existing concurrency group.
@steipete
steipete requested a review from a team as a code owner August 9, 2026 08:01
@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

steipete added a commit to openclaw/openclaw that referenced this pull request Aug 9, 2026
Propagates the canonical dispatcher step from openclaw/clawsweeper#1083
byte-identically: the acknowledgement step waits 15s after a clean
marker check and rechecks immediately before posting, so near-simultaneous
opened and ready_for_review runs (draft PR marked ready within seconds,
as on #120974) post exactly one receipt ack.
@steipete
steipete merged commit 8ee296b into main Aug 9, 2026
8 checks passed
@steipete
steipete deleted the steipete/vibrant-easley-b03e79 branch August 9, 2026 08:04
steipete added a commit to openclaw/openclaw that referenced this pull request Aug 9, 2026
Propagates the canonical dispatcher step from openclaw/clawsweeper#1083
byte-identically: the acknowledgement step waits 15s after a clean
marker check and rechecks immediately before posting, so near-simultaneous
opened and ready_for_review runs (draft PR marked ready within seconds,
as on #120974) post exactly one receipt ack.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
…20990)

Propagates the canonical dispatcher step from openclaw/clawsweeper#1083
byte-identically: the acknowledgement step waits 15s after a clean
marker check and rechecks immediately before posting, so near-simultaneous
opened and ready_for_review runs (draft PR marked ready within seconds,
as on openclaw#120974) post exactly one receipt ack.
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