Skip to content

fix(webhook): make intake fan-out-safe and structurally valid (Webhook Revolution) - #85618

Closed
andrexibiza wants to merge 5 commits into
NousResearch:mainfrom
andrexibiza:campaign/webhook-intake
Closed

fix(webhook): make intake fan-out-safe and structurally valid (Webhook Revolution)#85618
andrexibiza wants to merge 5 commits into
NousResearch:mainfrom
andrexibiza:campaign/webhook-intake

Conversation

@andrexibiza

Copy link
Copy Markdown
Contributor

Part of the Webhook Revolution campaign. Task 10. Closes #7448, #55829.

Fan-out-safe idempotency

Idempotency now keyed by (profile, route, delivery_id) and bound to a body hash. The same provider delivery sent to different routes executes each route once (#7448); a same-route retry returns 200 duplicate; a conflicting replay (same key, different body) returns 409.

Structurally valid raw payload

{__raw__} renders as a valid JSON envelope {"payload": <bounded>, "truncated": bool, "original_bytes": N} instead of raw character slicing that produced invalid JSON (#55829). Output always parses.

HTTP contract hardening

Rate-limit responses emit Retry-After. Prune cleans the body-hash cache alongside the TTL cache.

Verification (53 passed)

  • tests/gateway/test_webhook_http_contract.py — 4 new tests (cross-route execute, same-route dedupe, 409 conflict, JSON envelope).
  • test_webhook_adapter.py + test_webhook_integration.py + test_webhook_dynamic_routes.py + test_webhook_deliver_only.py + test_webhook_signature_rate_limit.py — no regression.
  • git diff --check clean; webhook.py 1455 lines (< 2000).

andrexibiza and others added 5 commits August 12, 2026 16:33
Task 10. Closes NousResearch#7448, NousResearch#55829.

- Idempotency keyed by (profile, route, delivery_id) and bound to a body
  hash. Same delivery on different routes executes each route once (NousResearch#7448);
  same-route retry returns 200 duplicate; conflicting replay (same key,
  different body) returns 409.
- Raw payload {__raw__} renders as a structurally valid JSON envelope
  {payload, truncated, original_bytes} instead of raw character slicing
  that produced invalid JSON (NousResearch#55829).
- Rate-limit responses emit Retry-After.
- Prune cleans the body-hash cache alongside the TTL cache.
- New HTTP-contract tests: fan-out dedupe, cross-route execute, 409
  conflict, raw-payload JSON envelope.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard platform/webhook Webhook / API server P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #85523. The same webhook idempotency and raw-payload repair is already open there; #85523 is the cleaner focused version.

@andrexibiza

Copy link
Copy Markdown
Contributor Author

Superseded by #85523 (same Task 10 intake work, cleaner branch). Closing duplicate.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists platform/webhook Webhook / API server sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webhook idempotency is keyed only by delivery ID, so the second route is skipped in valid multi-route fan-out

2 participants