Skip to content

fix(worker): forget failed webhook delivery claims - #654

Merged
jeefy merged 1 commit into
mainfrom
fix/kv-failed-delivery-653
Nov 1, 2026
Merged

jeefy merged 1 commit into
mainfrom
fix/kv-failed-delivery-653

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

Description

Fixes #653

Delete a failed delivery's KV claim so GitHub redelivery executes the pull-request command again. Successful deliveries keep the same KV entry; done is therefore a no-op, matching the memory store.

Add a Worker regression covering a failed /close, successful redelivery, and subsequent deduplication. Adjust the wrangler bindings test to send an edited comment: its previous created-comment fixture failed with no commands configured, which correctly becomes redeliverable with this fix.

Testing

  • Reproduced the regression before the fix: the failed delivery retained delivery:d-close-fails = '1'.
  • npx vitest run __tests__/worker/worker.test.ts: 16 passed.
  • npx vitest run __tests__/worker --sequence.shuffle: 40 passed.
  • npm run typecheck.
  • npm run all: 228 files passed, 2,862 tests passed, 134 skipped.
  • The full suite emitted Node MaxListenersExceededWarning messages; all checks passed.

Checklist

  • Ran npm run all to build, lint, pack, and test.
  • Ran npm run pack; the committed action dist/ bundle is unchanged (Worker-only source change).
  • Commits are signed off (DCO).
  • No new dependencies.
  • Performed a self-review.
  • Documented the KV lifecycle in the store comment.
  • No user-facing documentation changes needed.

— hive: backend=copilot model=gpt-6.1-sol


🐝 Hive Agent: contributor | SHA: 51b9dbc

Delete failed KV delivery claims so pull-request commands can be redelivered, while retaining successful deliveries for deduplication. Cover the retry lifecycle and make the bindings dedupe fixture use a successful event.

Hive-Run: #653
Hive-Plan: failed-delivery-redelivery
Hive-Spec: issue-653#kv-claim-lifecycle
Assisted-by: Auto via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the tree at 51b9dbc, not just the diff. This looks correct to me.

Mechanism verified. src/adapters/app/webhook.ts:92-98 already calls forget(receiver, id) when run.failures.length > 0 and done otherwise — both via optional chaining (store.forget?.(id), webhook.ts:105). On main, kvDeliveryStore (src/server/worker.ts:51) implements only seen, which claims delivery:<id> with a 24h TTL, so the failure-path forget was a silent no-op and a failed delivery stayed deduplicated for a day — exactly the defect #653 describes. Adding forget → kv.delete closes that gap.

done as a no-op is consistent. Unlike redisDeliveryStore (src/adapters/app/redis.ts:24-35), where seen takes a short claim and done extends it to the full TTL, the KV seen already writes the full 24h TTL, so there is nothing for done to do. Same shape as memoryDeliveryStore (src/adapters/app/dedupe.ts:30-34), and the inline comment says so.

Tests. The new worker regression (worker.test.ts:286-303) exercises fail → claim dropped → redeliver succeeds → dedupe on the third attempt; the wranglerConfig.test.ts switch to an edited action is needed because its created-comment fixture now correctly becomes redeliverable when no commands are configured. Ran both files at this head: 25/25 pass.

No security, scope, or docs concerns — Worker-only, dist/ untouched, KV lifecycle documented in the store comment.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

@mrbobbytables

Copy link
Copy Markdown
Member Author

/kind feature


🐝 Hive Agent: contributor | SHA: 47e9a7aa

@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature. and removed needs-kind labels Nov 1, 2026
@jeefy
jeefy merged commit 137ae98 into main Nov 1, 2026
12 checks passed
@jeefy
jeefy deleted the fix/kv-failed-delivery-653 branch November 1, 2026 02:36
@jeefy jeefy mentioned this pull request Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] kvDeliveryStore never forgets a failed delivery, so a pull-request command that fails on the Worker is lost and cannot be redelivered

2 participants