Repository navigation
Description
Problem
When a marketplace app developer abandons their app or their webhook endpoint goes down, the backend continues sending data to the dead URL on every trigger event for every user who has that app enabled.
Production impact (last 7 days, from monitoring)
- 10,000+ integration errors/day (hitting Cloud Logging limits)
- 4,537 DNS resolution failures in 7 days — domains that no longer exist
- ~28-83 hours of wasted TCP connection time per day across all pods
- Thread pool saturation during peak hours, Cloud Logging quota burned on noise
Top failing endpoints (24h sample):
| Domain | Failures | Error | Root cause |
|---|---|---|---|
| `plugins-hhibjajaja-uc.a.run.app` | 718 | 404 | Dead Cloud Run service |
| `audio.soundbrain.cc` | 313 | 500 | Server errors |
| `n8n.thebenjamins.xyz` | 206 | 404 | Dead n8n instance |
| `omi-github.up.railway.app` | 201 | 404 | Dead Railway deploy |
| `omi-lie-detector-production.up.railway.app` | 186 | 404 | Dead Railway deploy |
Top failing app IDs (24h): `01K7BHKJR79KQQW7ZZGZX7GCGD` (412), `01JQPWPQC46799F0HZV0PV7J7H` (258), `01JQKWV79WD9RQG8NJTT3Y6V2M` (216)
Error patterns: HTTP 404/500 from dead endpoints (Railway, Replit, ngrok), DNS failures (domains don't exist), JSON parse errors (empty body instead of JSON), misconfigured proactive_notification apps.
Current gaps
- No failure tracking — webhook failures logged at `info` level and silently discarded
- No auto-disable — broken apps stay enabled forever, wasting resources
- No developer notification — developers don't know their webhooks are failing
- No user notification — users don't know their installed app is broken
Complete trigger inventory
All outbound calls from backend to developer-controlled endpoints:
Marketplace app triggers
| # | Trigger | File | Frequency | Timeout | Circuit breaker? |
|---|---|---|---|---|---|
| 1 | Memory creation webhook | `utils/app_integrations.py` → `trigger_external_integrations()` | Per conversation | 30s | Yes |
| 2 | Realtime transcript webhook | `utils/app_integrations.py` → `trigger_realtime_integrations()` | Every 1s batch | 10s | Yes |
| 3 | Realtime audio bytes webhook | `utils/app_integrations.py` → `trigger_realtime_audio_bytes()` | Every 4s batch | 15s | Yes |
| 4 | Chat tool endpoint | `utils/retrieval/tools/app_tools.py` → `_call_tool_endpoint()` | Per chat message | 120s | No |
| 5 | MCP server call | `utils/retrieval/tools/app_tools.py` → `call_mcp_tool()` | Per chat message | varies | No |
| 6 | Setup completion check | `routers/oauth.py`, `routers/apps.py` | On app enable | varies | No |
| 7 | Chat tools manifest fetch | `routers/apps.py` → `_process_chat_tools_manifest()` | On app create/update | 10s | No |
Developer webhooks (per-user)
| # | Trigger | File | Frequency | Timeout | Circuit breaker? |
|---|---|---|---|---|---|
| 8 | memory_created | `utils/webhooks.py` | Per conversation | 30s | Yes |
| 9 | realtime_transcript | `utils/webhooks.py` | Every 1s batch | 15s | Yes |
| 10 | audio_bytes | `utils/webhooks.py` | Every 4s batch | 15s | Yes |
| 11 | day_summary | `utils/webhooks.py` | Daily | 30s | Yes |
Worst UX: Chat tools (#4) — when Claude picks a dead app's tool, the user's chat hangs for 120 seconds before showing an error. No circuit breaker, no fallback. Happens on every chat message where Claude selects that tool.
Storage: Marketplace app webhook URLs in Firestore `plugins_data` collection (`external_integration.webhook_url`). Developer webhook URLs in Redis (`users:{uid}:developer:webhook:{type}`).
Proposed solution
Modeled after Stripe's webhook lifecycle: track failures over time, warn the developer, then auto-disable after sustained failure. No retry queue needed — our triggers are real-time, not transactional.
1. Track failures per endpoint in Redis
app_webhook_health:{app_id} → {
first_failure_at: timestamp, // when consecutive failures started
last_failure_at: timestamp, // most recent failure
last_success_at: timestamp, // most recent success (resets the window)
consecutive_failure_days: int, // days with zero successes
last_status: int, // last HTTP status or 0 for connection error
last_error: string, // "HTTP 404" / "DNS resolution failed" / "Connection refused"
notified_day1: bool, // warning sent after day 1
notified_day2: bool // final warning sent after day 2
}
- On success (any 2xx): reset `first_failure_at`, `consecutive_failure_days` → 0. App is healthy.
- On failure: if `last_success_at` is >24h ago (or never), increment `consecutive_failure_days`.
- TTL: 7 days — auto-cleanup for healthy apps that never fail.
2. Graduated response (Stripe-style 3-day window)
| Continuous failure duration | Action |
|---|---|
| Day 1 (24h no success) | Send push notification to app developer: "Your app [name] webhook has been failing for 24 hours. Last error: [error]. Please check your endpoint." |
| Day 2 (48h no success) | Send final warning to developer: "Your app [name] will be disabled tomorrow if webhook failures continue. [X] users will be affected." |
| Day 3 (72h no success) | Auto-disable the app. Notify developer + all users who had it enabled. |
Any single successful delivery at any point resets the clock to zero. This is the same model Stripe uses — 3 continuous days of all-failure before disabling.
3. Disable mechanics
When auto-disabled:
- Write `disabled_reason` to the app's Firestore document:
{ "disabled_reason": "webhook_failures", "disabled_at": "2026-04-20T00:00:00Z", "disabled_error": "HTTP 404 - Not Found", "disabled_failure_duration_hours": 72, "disabled_affected_users": 47 } - Remove from all users' `enabled_plugins` Redis sets
- App remains visible in marketplace but shown as "Currently unavailable — webhook endpoint not responding"
- Developer can re-enable via app settings after fixing their endpoint → triggers a health-check ping to the webhook URL first. Must return 2xx to re-enable.
4. Developer notifications
- Day 1 warning: "Your app [name] webhook has been failing for 24 hours. Last error: HTTP 404. Please check your endpoint at [url]."
- Day 2 final warning: "Your app [name] will be disabled in 24 hours if failures continue. [X] users currently have this app enabled."
- Day 3 disabled: "Your app [name] has been disabled after 3 days of webhook failures. To re-enable, fix your endpoint and visit [app settings link]."
Use existing push notification system or email if developer email is on file.
5. User notifications
When an app is auto-disabled, send a one-time notification to each user who had it enabled:
"The app [name] has been temporarily disabled due to connectivity issues with the developer's server. The developer has been notified."
6. Developer webhooks (per-user scope)
Same 3-day model, but scoped per user per webhook type:
dev_webhook_health:{uid}:{type} → { first_failure_at, last_success_at, consecutive_failure_days, ... }
- Same Day 1 / Day 2 / Day 3 thresholds
- Notifications go to the developer-user themselves (it's their own webhook)
- Disable sets `users:{uid}:developer:webhook_status:{type}` to disabled in Redis
- Add `users:{uid}:developer:webhook_disabled_reason:{type}` with reason + timestamp
- User re-enables via Developer Settings (no health-check gate needed since it's their own endpoint)
7. Chat tools & MCP — add circuit breaker
Chat tools (#4) and MCP calls (#5) currently have no circuit breaker. Before implementing the 3-day auto-disable:
- Add `get_webhook_circuit_breaker(url)` to `_call_tool_endpoint()` and `call_mcp_tool()`
- This gives immediate relief: circuit opens after a few fast failures, preventing the 120s timeout on every chat message
- The 3-day auto-disable handles the longer-term cleanup
8. Observability
- Prometheus counter: `app_webhook_deliveries_total{app_id, trigger_type, status}` (success / failure / timeout / circuit_open)
- Admin dashboard endpoint: list apps sorted by failure rate
- Log webhook failures at `error` level, not `info`
Reference: Stripe's webhook model
| Aspect | Stripe | Proposed for Omi |
|---|---|---|
| Retry window | 72 hours with exponential backoff | No retries (real-time triggers) |
| Auto-disable trigger | 3 days continuous failure | 3 days continuous failure (same) |
| Warning mechanism | Email + dashboard status | Push notification at Day 1, Day 2 |
| Recovery | Manual re-enable in dashboard | Manual re-enable + health-check ping |
| Event retention | 30 days queryable via API | N/A (real-time, not transactional) |
| Missed events while disabled | Lost (not queued) | Lost (same — real-time nature) |
Implementation priority
- Circuit breaker for chat tools / MCP — immediate UX fix, prevents 120s hangs
- Redis failure tracking + 3-day auto-disable for marketplace apps — biggest production impact (10K errors/day)
- Developer + user notifications — communication layer
- Developer webhook auto-disable — per-user scope, lower blast radius
- Observability (Prometheus + admin dashboard) — monitoring
Activity
beastoin commentedon Apr 20, 2026
Developer webhooks — same treatment needed
The personal developer webhooks (
backend/utils/webhooks.py) have the same problem. These are per-user webhooks stored in Redis:audio_bytesusers:{uid}:developer:webhook:audio_bytesaudio_bytes_websocketusers:{uid}:developer:webhook:audio_bytes_websocketrealtime_transcriptusers:{uid}:developer:webhook:realtime_transcriptmemory_createdusers:{uid}:developer:webhook:memory_createdday_summaryusers:{uid}:developer:webhook:day_summarySame gaps: no failure tracking, no auto-disable, failures logged and discarded.
Proposed: same graduated model, adapted for per-user scope
Failure tracking in Redis:
```
dev_webhook_failures:{uid}:{type} → { consecutive_failures, last_failure_at, last_status }
```
Thresholds (lower than marketplace apps since these affect one user):
Disable mechanics:
users:{uid}:developer:webhook_status:{type}todisabledin Redis (already exists as a boolean)users:{uid}:developer:webhook_disabled_reason:{type}with reason + timestampThis is lower-stakes than marketplace apps (only affects the developer themselves), so shorter thresholds and simpler recovery.
beastoin commentedon Apr 20, 2026
Missing from original scope — additional outbound calls to app endpoints
Beyond the 3 webhook triggers + developer webhooks, there are more outbound calls to developer-controlled URLs that need the same failure tracking:
4. Chat tool endpoint calls
File:
backend/utils/retrieval/tools/app_tools.py→_call_tool_endpoint()chat_toolsenabledapp_tool.endpoint(developer-hosted HTTP endpoint) with 120s timeout5. MCP server calls
File:
backend/utils/retrieval/tools/app_tools.py→call_mcp_tool()mcp_server_urlconfigured6. Setup completion checks
File:
backend/routers/oauth.pyline 144,backend/routers/apps.pyline 1743GET setup_completed_url?uid={uid}— called when user enables/authorizes an app7. Chat tools manifest fetch
File:
backend/routers/apps.py→_process_chat_tools_manifest()GET chat_tools_manifest_url— called when app is created/updated.well-known/omi-tools.jsonmanifest from developer serverFull trigger inventory
app_integrations.pyapp_integrations.pyapp_integrations.pyapp_tools.pyapp_tools.pyoauth.py,apps.pyapps.pywebhooks.pywebhooks.pywebhooks.pywebhooks.pyNote: Triggers 1-3 and 8-11 already have circuit breakers (
get_webhook_circuit_breaker(url)) but no failure counter or auto-disable. Triggers 4-5 have no circuit breaker at all — a dead chat tool endpoint blocks the user's chat for 120s on every message.Priority
Highest impact for the auto-disable feature:
beastoin commentedon Apr 20, 2026
Production data (from mon, last 7 days)
Scale of the problem
Top failing endpoints (24h sample)
plugins-hhibjajaja-uc.a.run.appaudio.soundbrain.ccn8n.thebenjamins.xyzomi-github.up.railway.appomi-lie-detector-production.up.railway.appTop failing app IDs
01K7BHKJR79KQQW7ZZGZX7GCGD01JQPWPQC46799F0HZV0PV7J7H01JQKWV79WD9RQG8NJTT3Y6V2MError patterns
Impact
At 10K errors/day with timeouts of 10-30s per call, this represents:
These numbers strongly support implementing the graduated auto-disable proposed in this issue. Even just disabling the top 5 dead endpoints would eliminate ~1,600 errors/day.
fix: auto-disable webhooks after sustained failures (#7289)