Skip to content

fix(webhook): retry failed direct deliveries - #82508

Open
alexgunsberg wants to merge 1 commit into
NousResearch:mainfrom
alexgunsberg:fix/webhook-delivery-idempotency
Open

fix(webhook): retry failed direct deliveries#82508
alexgunsberg wants to merge 1 commit into
NousResearch:mainfrom
alexgunsberg:fix/webhook-delivery-idempotency

Conversation

@alexgunsberg

@alexgunsberg alexgunsberg commented Aug 9, 2026

Copy link
Copy Markdown

Summary

  • reserve deliver_only webhook IDs in a separate in-flight set so concurrent duplicates still send once even when a downstream send outlives the normal TTL
  • commit successful IDs to the TTL cache only after downstream success
  • release failed, raised, or cancelled reservations so the provider can retry the same ID

Regression coverage

  • failed SendResult then same-ID retry succeeds
  • downstream exception then same-ID retry succeeds
  • cancellation releases the claim and re-raises, then same-ID retry succeeds
  • two concurrent same-ID requests produce one downstream send, including after the normal TTL expires
  • same-ID retry after a successful send remains suppressed

Verification

  • pytest tests/gateway/test_webhook_deliver_only.py -o addopts= -q — 9 passed
  • pytest tests/gateway/test_webhook_*.py -o addopts= -q — 54 passed
  • focused Ruff, py_compile, and git diff --check — passed

Prior art and scope

Related to #47293 by @necoweb3. That older branch currently conflicts with main and also changes agent-mode completion semantics; this current-main patch preserves credit here while staying narrowly scoped to the deliver_only transaction required by the production watcher.

No live gateway, config, secret, webhook subscription, or deploy state was modified. Do not merge before the independent exact-head review of a0dc9d76bc6c4e3beb865e999ae82d109d06fa08 passes.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/webhook Webhook / API server sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Aug 9, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #47293: both allow a webhook delivery ID to retry after failure. This PR is narrowly limited to the deliver_only transaction, while #47293 also changes normal agent-mode completion semantics.

@alexgunsberg
alexgunsberg force-pushed the fix/webhook-delivery-idempotency branch from 91d0a3c to 1fac89f Compare August 9, 2026 15:30
@alexgunsberg
alexgunsberg force-pushed the fix/webhook-delivery-idempotency branch from 1fac89f to a0dc9d7 Compare August 9, 2026 15:37
@alexgunsberg

Copy link
Copy Markdown
Author

Independent exact-head review: PASS at a0dc9d76bc6c4e3beb865e999ae82d109d06fa08 against base 2446c8bb6755ff5e6feff4d26e425661edd4019b. Two independent read-only reviewers found no remaining P1/P2 after adversarial TTL/in-flight and stale-cleanup interleaving checks. Local evidence: 9 focused deliver-only tests passed; 54 webhook tests passed; a broader reviewer run reported 105 webhook-selected gateway tests passed with 7 skipped. Ruff, py_compile, and git diff --check passed. No merge performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/webhook Webhook / API server sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants