Skip to content

Auto-disable marketplace app webhooks after sustained failures #6885

Closed

Description

@beastoin

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

  1. Circuit breaker for chat tools / MCP — immediate UX fix, prevents 120s hangs
  2. Redis failure tracking + 3-day auto-disable for marketplace apps — biggest production impact (10K errors/day)
  3. Developer + user notifications — communication layer
  4. Developer webhook auto-disable — per-user scope, lower blast radius
  5. Observability (Prometheus + admin dashboard) — monitoring

Activity

  1. added
    p1
    on Apr 20, 2026
  2. beastoin commented on Apr 20, 2026

    @beastoin
    CollaboratorAuthor

    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:

    Webhook type Redis key Timeout
    audio_bytes users:{uid}:developer:webhook:audio_bytes 15s
    audio_bytes_websocket users:{uid}:developer:webhook:audio_bytes_websocket — (WS)
    realtime_transcript users:{uid}:developer:webhook:realtime_transcript 15s
    memory_created users:{uid}:developer:webhook:memory_created 30s
    day_summary users:{uid}:developer:webhook:day_summary 30s

    Same 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):

    Consecutive failures Action
    10 Log warning
    50 Send push notification to the user: "Your developer webhook for [type] has failed 50 times. Check your endpoint URL."
    100 Auto-disable that specific webhook type. Notify user: "Your [type] webhook has been disabled after 100 consecutive failures. Re-enable in Developer Settings after fixing your endpoint."

    Disable mechanics:

    • Set users:{uid}:developer:webhook_status:{type} to disabled in Redis (already exists as a boolean)
    • Add users:{uid}:developer:webhook_disabled_reason:{type} with reason + timestamp
    • User re-enables via Developer Settings in the app (no health-check needed since it's their own endpoint)

    This is lower-stakes than marketplace apps (only affects the developer themselves), so shorter thresholds and simpler recovery.

  3. beastoin commented on Apr 20, 2026

    @beastoin
    CollaboratorAuthor

    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()

    • Called during RAG/chat when user has apps with chat_tools enabled
    • Calls app_tool.endpoint (developer-hosted HTTP endpoint) with 120s timeout
    • Fires on every chat message that triggers the tool
    • No failure tracking, no circuit breaker — if endpoint is dead, user gets "Error: Timeout" in chat after 120s wait

    5. MCP server calls

    File: backend/utils/retrieval/tools/app_tools.py → call_mcp_tool()

    • Called when app has mcp_server_url configured
    • JSON-RPC calls to developer-hosted MCP server
    • Same fire-and-forget pattern, no failure tracking

    6. Setup completion checks

    File: backend/routers/oauth.py line 144, backend/routers/apps.py line 1743

    • GET setup_completed_url?uid={uid} — called when user enables/authorizes an app
    • If the endpoint is dead, user gets HTTP 503 and can't enable the app
    • Less critical (user-initiated, not background), but should still track

    7. Chat tools manifest fetch

    File: backend/routers/apps.py → _process_chat_tools_manifest()

    • GET chat_tools_manifest_url — called when app is created/updated
    • Fetches the .well-known/omi-tools.json manifest from developer server
    • Less critical (admin-time only), but dead URL means tools silently not loaded

    Full trigger inventory

    # Trigger File Frequency Timeout Circuit breaker?
    1 Memory creation webhook app_integrations.py Per conversation 30s ✅ yes
    2 Realtime transcript webhook app_integrations.py Every 1s batch 10s ✅ yes
    3 Realtime audio bytes webhook app_integrations.py Every 4s batch 15s ✅ yes
    4 Chat tool endpoint app_tools.py Per chat message 120s ❌ no
    5 MCP server call app_tools.py Per chat message varies ❌ no
    6 Setup completion check oauth.py, apps.py On app enable varies ❌ no
    7 Chat tools manifest fetch apps.py On app create/update varies ❌ no
    8 Developer: memory_created webhooks.py Per conversation 30s ✅ yes
    9 Developer: realtime_transcript webhooks.py Every 1s batch 15s ✅ yes
    10 Developer: audio_bytes webhooks.py Every 4s batch 15s ✅ yes
    11 Developer: day_summary webhooks.py Daily 30s ✅ yes

    Note: 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:

    1. Triggers 1-3 (marketplace webhooks) — highest frequency, affects all users with the app
    2. Triggers 4-5 (chat tools / MCP) — 120s timeout per failed call, worst UX
    3. Triggers 8-11 (developer webhooks) — per-user only
    4. Triggers 6-7 (setup/manifest) — user-initiated, lowest frequency
  4. beastoin commented on Apr 20, 2026

    @beastoin
    CollaboratorAuthor

    Production data (from mon, last 7 days)

    Scale of the problem

    • 10,000+ integration errors/day (hitting Cloud Logging limits)
    • 4,537 DNS resolution failures in 7 days ("Name or service not known" — domains that no longer exist)
    • 457 "No address associated" errors — removed ngrok/Railway/Replit deployments

    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

    App ID Failures (24h)
    01K7BHKJR79KQQW7ZZGZX7GCGD 412
    01JQPWPQC46799F0HZV0PV7J7H 258
    01JQKWV79WD9RQG8NJTT3Y6V2M 216

    Error patterns

    1. HTTP 404/500 from dead endpoints (Railway, Replit, ngrok, custom domains)
    2. DNS failures — domains no longer resolve at all
    3. JSON parse errors ("Expecting value: line 1 column 1") — endpoint returns empty/HTML instead of JSON
    4. Misconfigured apps — "is not proactive_notification or data invalid"

    Impact

    At 10K errors/day with timeouts of 10-30s per call, this represents:

    • ~28-83 hours of wasted TCP connection time per day across all pods
    • Thread pool saturation during peak hours
    • Cloud Logging quota burn on noise
    • Every error is a user whose app integration silently does nothing

    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.

  5. added
    retrieval-action
    on Apr 22, 2026
  6. added a commit that references this issue on May 23, 2026
    f9bf3a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p1retrieval-action

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions