Skip to content

Notify proactively when an agent run finishes (webhook / event feed) - investigation #579

Description

@serge-ivo

Problem

When an autonomous agent run (coding loop, browser task, delegated goal) finishes, there is no way for an external client to find out. The only way to learn the outcome is to poll coding_loop_status / check_instance_loop on demand. Nothing is pushed.

This is painful in practice. A run started from an MCP client (Claude, Codex, an IDE) may take many minutes. The human either sits there asking "is it done yet" or walks away and forgets. There is also no signal for the failure cases that matter most: a run that dies with a provider error, or one that stalls with a frozen lastProgressAt while still reporting running.

Related: we already have an observability gap on in-flight runs (no per-step trace queryable from outside). This ticket is about the terminal event - telling someone the run ended.

Investigation

This is an investigation ticket. Work out what it would take, do not build it yet.

  1. Establish where a run's lifecycle actually terminates server-side - the point where status becomes done/failed/cancelled, or where a stall would be detected. Cite file paths and line numbers. Is there a single choke point, or several per driver (coding, browser, delegation)?
  2. Determine what notification machinery already exists in the platform that could be reused - existing webhook or outbound HTTP infrastructure, the trigger/event system (create_instance_trigger, list_instance_trigger_events), the email path, any push/queue layer. Prefer extending something over inventing a new subsystem.
  3. Evaluate the delivery options and recommend one or more:
    • user-registered outbound webhook (URL per instance or per account) fired on run completion
    • an event feed an MCP client can long-poll or subscribe to, so a client can await completion without busy-polling
    • email or existing notification channel as a fallback for humans
  4. Define the payload: instance id, run id, driver, terminal status, stop reason, iteration count, spend, a short summary, and links to anything the run produced (commits, issue comments, PRs).
  5. Cover the operational questions: retries and backoff on delivery failure, at-least-once vs at-most-once, secret/signature so the receiver can verify the call, per-account rate limits, and whether a stalled run should fire a distinct event from a clean failure.
  6. Note the security angle - an arbitrary user-supplied URL is an SSRF surface. What restrictions are needed.
  7. Scope it: what is the smallest useful version, and what would a complete version cost.

Deliverable

One comment on this issue with the findings, a recommended design, and a phased scope proposal - smallest useful slice first. No implementation, no production code changes.

Activity

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

    P3: laterDesign, strategy, or deferred pending a decision or demandbackendBackend / Worker / API workenhancementNew feature or requestpipelinesPipelines, steps, triggers and the event pump — what CALLS a connector

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions