Skip to content

Outbound webhooks for automation events (start with run.failed) #828

Backlog

Description

@all-hands-bot

Summary

Add outbound webhooks to the Automation Service so workspace owners can receive signed HTTP callbacks for automation lifecycle events — starting with run.failed — and route failure notifications into any system they already use (PagerDuty, Teams, custom internal tooling, etc.).

Requested by @anton-osmond (customer-facing motivation: customers who don't use Slack need a flexible way to get failure notifications), and endorsed in Slack as "pretty helpful."

Motivation

Proposed UX (Canvas → Automate)

Add an Outbound webhooks section under Automate:

  1. Enter a destination URL.
  2. Choose all automations in the workspace or select specific ones.
  3. Pick which events to subscribe to — start with run.failed.
  4. A Send test button and a last delivery status indicator so users can verify the endpoint works before relying on it.

Proposed behavior (Automation Service)

  • Send a signed webhook when a run is recorded as failed, even if the sandbox never starts.
  • Payload includes: automation name, a short failure reason, and a link to the run.
  • If the endpoint is temporarily unavailable, retry delivery without rerunning the automation.

Scope / placement

Build this in the shared Automation Service and Canvas so the same setup works for both Enterprise and open-source deployments.

Related


OpenHands AI triage

The following comments and acceptance criteria were added by the OpenHands AI agent.

Triage

Scope (Automation Service only): Add organization-scoped outbound webhook endpoints so owners receive signed HTTP callbacks when a run reaches a terminal FAILED state, starting with the run.failed event. The design follows this repository's own precedents: org-owned webhook records with HMAC signing secrets (mirroring the CustomWebhook model and webhook_router.py), manage_automations as the permission for endpoint CRUD (same as inbound webhook routes), and the failure data that every terminal writer already persists via mark_run_terminal / mark_run_status (error_detail, status_detail in utils/run.py) — covering dispatch failures before the sandbox starts, callback-reported failures, and watchdog timeouts. Delivery is retried a bounded number of times on transient failures without rerunning the automation, with a per-endpoint delivery status and a test-delivery request, as the issue proposes.

Non-goals: the Canvas "Outbound webhooks" UI (owned by OpenHands/OpenHands per AGENTS.md; a needs-canvas-release follow-up if the API lands first), event types beyond run.failed, in-sandbox post-run callbacks (#208), the general user-notification service (#121/#407), changes to run-state transitions, and delivery guarantees beyond bounded retry of transient failures.

The only product detail this repository cannot decide alone is the run-link URL, which needs a deployment base URL. The service can take it from its existing AUTOMATION_-prefixed configuration pattern; the criteria treat the link as present when a base URL is configured and make documenting that requirement part of the work.

Desired Behavior

When a run is recorded as FAILED — whether the sandbox never started, the run reported failure through its callback, or the watchdog timed it out — every outbound webhook endpoint subscribed to run.failed and scoped to that automation (or to all automations in the organization) receives a signed HTTP POST containing the event type, the automation's name and ID, the run ID, a short failure reason, the run link (when a base URL is configured), and event/run timestamps. A temporarily unavailable endpoint gets bounded retries without the automation being rerun. Owners configure endpoints (destination URL, signing secret, automation scope, event subscription), can send a test delivery, and can see the last delivery status for each endpoint.

Acceptance Criteria

  • A user with manage_automations can create an outbound webhook endpoint (destination URL, signing secret, event subscription including run.failed, and scope of all automations or an explicit automation list); list, get, update, and delete work, and users missing manage_automations or from another organization are rejected with 403/404.
  • After creation, the signing secret is not returned in cleartext by list/get/update responses and is not written to logs, matching the existing custom_webhooks secret handling.
  • When a run is marked FAILED, each subscribed endpoint scoped to that automation receives an HTTP POST whose body includes event run.failed, the automation name and ID, the run ID, a short failure reason derived from the run's persisted failure detail, and event/run timestamps.
  • Each delivery is signed (HMAC-SHA256 over the raw body in a documented header), so a receiver holding the secret can verify the body and a receiver can reject an invalid signature.
  • A run that fails before the sandbox starts (dispatch failure) triggers a delivery, verified by a test that fails a run pre-dispatch and observes the delivery attempt.
  • When the endpoint is unreachable or answers non-2xx, delivery is retried a bounded number of times with backoff, the automation is not rerun, and each attempt's outcome is recorded.
  • The last delivery status (most recent attempt time and outcome) is retrievable per endpoint, and a test-delivery request sends a signed test payload and reports its result.
  • Deleting or disabling an endpoint stops its deliveries, and removing an automation that an endpoint is scoped to leaves no orphaned references and does not break the endpoint's other subscriptions.
  • New tables/columns behave identically on PostgreSQL and SQLite and ship in one coherent Alembic migration with a single head and an upgrade path from the released schema.
  • A page under docs/ documents endpoint setup, signature verification, and the run-link base-URL configuration requirement, and an integration test delivers a real run-failure event to a live local HTTP receiver rather than only asserting on mocks.

Activity

  1. added
    enhancement
    priority:medium
    ready-for-dev
    on Nov 30, 2026
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

    enhancementpriority:mediumready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions