Skip to content

webhook: runtime settle-violation detector + idempotent delivery outcome#203

Merged
brownjuly2003-code merged 2 commits into
mainfrom
fix/p3-webhook
Jul 19, 2026
Merged

webhook: runtime settle-violation detector + idempotent delivery outcome#203
brownjuly2003-code merged 2 commits into
mainfrom
fix/p3-webhook

Conversation

@brownjuly2003-code

Copy link
Copy Markdown
Owner

Closes the two known webhook-dispatch limitations documented in serving-bridge.md:

  • P3(a) — settle invariant is no longer silent. The dispatcher now runs a sampled behind-frontier probe and increments agentflow_webhook_settle_violations_total when a row becomes visible behind the settle watermark (i.e. the operator-set AGENTFLOW_WEBHOOK_SETTLE_SECONDS is smaller than real visibility lag + clock skew). Silent at settle=0 (explicit opt-out). Both stores.
  • P3(b) — no more double-counted attempts on commit-ack loss. record_webhook_delivery_outcome is idempotent per delivery_id (last_outcome_id guard), so a retry after a dropped commit-ack can no longer inflate attempts by 2 and trigger premature dead-lettering. Both adapters, schema migration 2.

Verified locally: ruff check + format clean, 99 passed (2 new test files). Live PG/CH suites run in CI.

🤖 Generated with Claude Code

JuliaEdom and others added 2 commits July 18, 2026 03:42
…outcome

Two P3 limitations left documented by the post-11.07 review, closed together
(they share the webhook delivery path); the P3 DuckDB DST-fold delay is left
documented as an accepted narrow limit.

P3(a) — the settle watermark's operator invariant (AGENTFLOW_WEBHOOK_SETTLE_SECONDS
> writer stamp-to-visibility lag + clock skew) was enforced only implicitly: a
violation silently dropped the late-visible row behind the keyset frontier. Add
a cheap sampled runtime detector that probes the bounded band immediately behind
the frontier (a newest_first window under a new symmetric max_processed_at bound
on fetch_pipeline_events, once per interval — no per-pass cost, no journal-wide
scan) for rows the scan never marked seen, and raises the new
agentflow_webhook_settle_violations_total counter with a
webhook_settle_invariant_violation warning. Reads only fetch_pipeline_events and
the in-memory seen-set, so it runs on both DuckDB and ClickHouse serving stores;
silent under the settle=0 opt-out.

P3(b) — record_webhook_delivery_outcome did a non-idempotent read-modify-write of
attempts, so the PostgreSQL adapter's transient-error retry could count one
failure twice (attempts+2 -> premature dead-letter) when an UPDATE committed but
its commit-ack was lost. Thread the delivery round's delivery_id through and
record it on the queue row (last_outcome_id); a repeat outcome write no-ops.
Embedded and PostgreSQL adapters both stamp/guard on the id; PostgreSQL adds
migration 2 for the column. Store-level regression test is red on the pre-fix
path, green on the fix; detector tests cover fire / settle=0 silence / no false
positive on already-delivered rows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ixes

serving-bridge.md: the settle-invariant violation is no longer silent (runtime
detector + agentflow_webhook_settle_violations_total), and delivery outcomes are
idempotent per round (no attempts+2). The DuckDB autumn DST-fold delivery-delay
paragraph is left unchanged (still an accepted limit). CHANGELOG: unreleased P3
follow-ups entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

DORA Metrics

  • Window: last 30 days
  • Branch: main
  • Deployment frequency: 101 total / 23.57 per week
  • Lead time for changes: avg 0.37h / median 0.0h
  • Change failure rate: 74.26% (75/101)
  • MTTR: 20.13h across 5 incident(s)

@brownjuly2003-code
brownjuly2003-code merged commit 11a0115 into main Jul 19, 2026
26 checks passed
@brownjuly2003-code
brownjuly2003-code deleted the fix/p3-webhook branch July 19, 2026 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants