#766 Comprehensive review fixes: webhook crash-safety, dedup, disconnect cleanup, security hardening

closed high Created 2026-06-22 01:59 · Updated 2026-06-22 01:59

Description

Edit
3-reviewer pass (security/correctness/consistency) fixes. CORRECTNESS: dispatch_reaction never raises out of a webhook (try/except->None) + compile reaction DSL once (cache); gmail history.list now pages nextPageToken + returns status, webhook advances watermark ONLY on 200/404 (404=re-baseline, transient=ack-without-advance) - no more silent message loss/duplicate sends; renewal COALESCEs history_id (preserve watermark); telegram update_id dedup (last_update_id col) - no duplicate replies on retry. AGENTS: load_rules LEFT JOINs agents and excludes paused (status authoritative, fixes added-to-paused-agent + partial-pause). DISCONNECT: gmail users.stop + delete watch row + gmail rules; telegram delete its rules. IDEMPOTENCY: gmail checkpoint = sha256(to|subject|body); telegram = sha256(text) (was non-deterministic hash()). SECURITY: gmail_push_watches.email UNIQUE (no cross-tenant collision) + clear error; validate agent_id ownership + FK ON DELETE CASCADE; Vault fallback path allow-list (shared/+tenants/ only, reject ..); hmac.compare_digest on webhook tokens; html.escape OAuth page; generic telegram setWebhook error. CLEANUP: drop dead rules column; _agent_predicate uuid try/except; input validation (channel/match/agent_id/name-len). DEFERRED (documented): rate limiting (user: not now), Pub/Sub OIDC verify, X-Tenant-ID/JWT cross-tenant (platform-level; API-key path safe), response-envelope unify (papered by _unwrap), schedule->agent linking + per-agent run attribution. Validated: telegram dedup (2 forges->1 reaction), validation 400s, management 200, reaction fires post-fix. App checkpoint fixes need app re-publish to go live.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...