Skip to content

Commit 29c442d

Browse files
authored
fix(ci): recheck ClawSweeper PR ack marker before posting (#120990)
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.
1 parent 7cf4f9a commit 29c442d

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

‎.github/workflows/clawsweeper-dispatch.yml‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,27 @@ jobs:
160160
echo "::notice::Skipping ClawSweeper pull request acknowledgement because no target credential is configured."
161161
exit 0
162162
fi
163+
has_ack_marker() {
164+
jq -e \
165+
--arg marker_prefix "clawsweeper-pr-ack:" \
166+
--arg marker_suffix " item=$ITEM_NUMBER -->" \
167+
'any(.[]; (.body // "") as $body | ($body | contains($marker_prefix)) and ($body | contains($marker_suffix)))' \
168+
<<< "$1" >/dev/null
169+
}
170+
comments="$(GH_TOKEN="$ACK_TOKEN" gh api \
171+
"repos/$TARGET_REPO/issues/$ITEM_NUMBER/comments?per_page=100")"
172+
if has_ack_marker "$comments"; then
173+
echo "ClawSweeper pull request acknowledgement already exists."
174+
exit 0
175+
fi
176+
# opened and ready_for_review can fire seconds apart for the same
177+
# pull request, and both runs can list comments before either
178+
# acknowledgement is visible. Wait, then recheck right before
179+
# posting; a superseding run cancels this one while it sleeps.
180+
sleep 15
163181
comments="$(GH_TOKEN="$ACK_TOKEN" gh api \
164182
"repos/$TARGET_REPO/issues/$ITEM_NUMBER/comments?per_page=100")"
165-
if jq -e \
166-
--arg marker_prefix "clawsweeper-pr-ack:" \
167-
--arg marker_suffix " item=$ITEM_NUMBER -->" \
168-
'any(.[]; (.body // "") as $body | ($body | contains($marker_prefix)) and ($body | contains($marker_suffix)))' \
169-
<<< "$comments" >/dev/null; then
183+
if has_ack_marker "$comments"; then
170184
echo "ClawSweeper pull request acknowledgement already exists."
171185
exit 0
172186
fi

0 commit comments

Comments
 (0)