fix(queue): dedupe unchanged pull request edits - #857
Conversation
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed July 26, 2026, 11:41 AM ET / 15:41 UTC. ClawSweeper reviewWhat this changesThis PR adds a seven-day durable fingerprint cursor that suppresses duplicate unchanged pull-request edit reviews while preserving enqueueing for changed review-relevant state and compatible fallback deliveries. Merge readinessClose this PR as superseded by #706. Priority: P2 Review scores
Verification
How this fits togetherExact-review ingress receives GitHub pull-request events and turns them into durable queue requests for ClawSweeper reviews. This change sits before queue dispatch, using source-authority ordering and a Durable Object cursor to prevent duplicate review revisions without suppressing meaningful edits. flowchart TD
A[GitHub pull request edit] --> B[Webhook classification]
B --> C[Review-relevant tuple]
C --> D[Source-authority reservation]
D --> E[Durable semantic cursor]
E -->|unchanged| F[Deduped response and metric]
E -->|changed or incomplete| G[Exact-review queue]
G --> H[Durable review request]
Decision needed
Why: The implementation is a focused compatibility change at the workflow-to-Worker admission boundary; source inspection from the supplied diff supports the mechanics, but accepting that runtime contract is an owner decision rather than a mechanical repair choice. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Close this PR as superseded by #706. Do we have a high-confidence way to reproduce the issue? Yes in source and local runtime proof: repeated complete Is this the best way to solve the issue? Yes, conditionally: a bounded fingerprint cursor at ingress is the narrowest place to stop duplicate review requests while retaining meaningful edits and fail-open handling for incomplete payloads. The remaining question is whether the fallback source-authority reservation is the accepted production contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ea92d0bfc12. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
b5f725a to
d417f28
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d417f28 to
a9e0ecd
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
Deduplicate semantically unchanged
pull_request.editedexact-review ingress before a second durable review request is created.Problem
Distinct GitHub
pull_request.editeddeliveries can represent the same review-relevant state. Delivery-ID idempotency alone retains both requests and creates a second durable review revision.Implementation
review.semantic_deduped_totaland an explicitsemantic_edited/unchanged_pull_request_editresponse reason.This remains limited to same-route
pull_request.editedsemantic deduplication. It does not change #706’s cross-route ingress coalescing, terminalisation, publisher batching, or state-writer behavior.Compatibility with current main
Rebased onto current
origin/mainat2ea92d0bfc126b92d174e642fdbeabc3d392c9b3after merged #855, #859, #863, #866, #867, #706, and #858. #855 and #863 do not overlap this ingress surface. #859/#866/#867 make Cloudflare/Durable Object canonical for exact-review records; this change continues to use the queue’s authenticated source-authority and SQLite DO interfaces only. It does not implement or alter the Cloudflare migration, canonical record projection, publication, or materializer paths.Current-main reconciliation with #706
#706, now merged, coalesces one proven direct-webhook/target-dispatcher pair using a route-tagged opaque ingress fingerprint. Its durable receipt is distinct from this PR’s same-route edited-state cursor:
pull_request.editedreview tuple for the same PR: head/base, draft state, normalized content/request configuration, and target.queue_claim, keeping the outer payload within GitHub’s ten-property limit. Incomplete or non-edited fallback deliveries keep the existing direct-enqueue behavior, so retries cannot obtain a newer source-authority sequence.Why #859 does not supersede this PR
The fresh ClawSweeper comment proposes closing this PR as superseded by #859. I do not believe that conclusion matches the implementation boundary, so this section records the evidence for maintainer review. It is not a request to merge or close either PR.
4288d557fff1) is already an ancestor of this branch and currentmain; this PR was rebased on top of it.pull_request.editedreview request at ingress.mainstill carries only pull-request head SHA, update time, and source-authority sequence. It has no base SHA, draft state, normalized content/request digest, semantic-edit cursor, orunchanged_pull_request_editreason. A later source-authority sequence can therefore create a newer review revision for an otherwise unchanged edit.Accordingly, #859 is a prerequisite architecture change, not a functional replacement for this PR’s acceptance requirement: exactly one durable request for a truly unchanged
pull_request.editedevent. The PR remains open pending a maintainer decision; no re-review, merge, or close is requested here.Validation
test/dashboard-worker.test.ts: 231 passed, 0 failed.test/repair/comment-webhook.test.ts: 27 passed, 0 failed.test/sweep-workflow.test.tsassertion: 1 passed, 0 failed.actionlintis not installed on this host.The unfiltered combined workflow-source suite has six unrelated native-Windows baseline failures because its Linux/Bash helper checks invoke unavailable
/bin/bashthrough WSL. Per the platform-scope gate, that is an intentionally Linux-hosted integration (category 3); no platform, CI, shell, or workflow-policy change was made for it.Redacted Worker / Durable Object runtime proof
Synthetic local Wrangler proof exercised the real local Worker, its signed internal routes, and the SQLite-backed Durable Object. It did not contact GitHub or production.
The initial local run also exercised changed base and draft inputs; both returned
202 { queued: true }. All payload data was synthetic; the durable metric contained one semantic dedupe and the latest changed state remained queued.Risks and rollout
The semantic path fails open when the required edited-PR fields are absent or invalid, preserving existing enqueue behavior. Cursor retention matches delivery receipt retention (seven days). The durable cursor and metric contain fingerprints/counts only, not raw review content.
The fallback addition touches
.github/workflows/sweep.yml, so GitHub OAuth/workflow-scope configuration remains a deployment risk. It uses the existing HMAC secret and source-authority API only; no gate, secret, permission, state-writer, or publication behavior changed.Related work
Codex review closeout
The first post-rebase
codex review --base origin/mainfound one accepted P2: the local/repository-dispatch fallback did not propagate the semantic tuple or reserve source authority. This PR now carries the tuple through that fallback and uses the existing authenticated source-authority route.After the remedy and focused proof:
codex review --uncommitted: clean; no accepted/actionable findings.codex review --base origin/main: clean; “The semantic edited-event deduplication, authority watermark handling, and fallback ingress changes are internally consistent and covered by focused tests.”For the current-main rebase, the first dirty-patch review accepted two compatibility findings: the fallback tuple exceeded GitHub’s repository-dispatch top-level property limit, and non-edited retry deliveries could receive newer source authority. The tuple now travels in
queue_claim, and source authority is limited to complete edited tuples. Focused proof was rerun after both fixes.codex review --uncommitted: clean; no accepted/actionable findings.codex review --base origin/main: clean; no actionable defects found.