Webhook notifications on agent completion

t-539.6·WorkTask·
·
·
Parent:t-539·Created2 weeks ago·Updated2 weeks ago

Description

Edit

Add webhook notifications from agentd to Ava on agent completion.

Current state:

  • Daemon.hs has webhook_url field in SpawnRequest
  • pi_rpc.py sends webhooks but we're removing it
  • No actual webhook implementation in Daemon.hs

Target state:

  • agentd sends HTTP POST to webhook URL on:
  • Agent started
  • Agent completed (success)
  • Agent failed (error)
  • Agent stopped (manual)
  • Payload includes: run_id, status, summary, cost, duration

Implementation: 1. Add webhook sending in monitorPiAgent when process exits 2. Parse agent output for summary/cost info 3. HTTP POST with JSON payload 4. Retry logic for transient failures 5. Timeout to avoid blocking

Webhook payload:

{
  "run_id": "pi-abc123",
  "event": "completed",
  "status": "success",
  "summary": "Fixed the bug in Foo.hs",
  "cost_cents": 42,
  "duration_seconds": 120,
  "timestamp": "2026-02-03T19:00:00Z"
}

Timeline (4)

🔄[human]Open → InProgress2 weeks ago
🔄[human]InProgress → Done2 weeks ago
💬[human]2 weeks ago

Webhook coverage expanded: send 'started' on spawn, 'failed' on worktree/spawn errors and process exit failure, 'completed' on agent_end, 'error' on extension_error, and 'stopped' on stop. Agentd redeployed to include changes.