Skip to content

feat(webhook_out): a turn-finished event, so a gateway needs no polling after an allow #962

Closed

Description

@ajianaz

What problem does this solve?

Found while building the gateway receiver (codecoradev/tole-gateway#19, issue tole-gateway#16). tole's outbound webhook events are approval_requested, approval_resolved and cron_run_finished. There is no event for "the turn that was waiting on an approval resumed and finished". approval_resolved fires at decision time, before the turn continues. So after an Allow a receiver still has to read GET /sessions/{id}/status and the log entries to learn the answer. The gateway can only stop polling for a further approval, not for the final answer, and tole-gateway#16 cannot be met in full.

Proposed solution

Add one event type, for example turn_finished, to the existing outbox and signing path (#911): sent when a serve session's turn ends (Final, Cancelled, ProviderFailed, BudgetExhausted, a new approval stop), carrying only ids and a status word, never transcript text. Opt-in per destination in the user config events list, like the approval events, so nothing changes for an existing destination.

Constraints (from #911, unchanged)

  • Destinations stay in user config only; no request or session can name one.
  • The payload carries no secret, no tool output and no prompt text (the receiver reads the transcript through the authenticated serve API).
  • Same v2 HMAC signing, same outbox and retry rules; the real-binary leak check covers the new event.
  • docs/threat-model.md row and the docs/webhook-delivery-design.md event table updated.

Alternatives considered

  • Keep polling in the gateway: works today, costs one request per second per waiting session.
  • Put the final text in the event: rejected, it widens what leaves the machine.

Acceptance criteria

  • turn_finished is opt-in per destination and absent by default.
  • The payload is ids and a status word only (test).
  • The real-binary serve e2e shows it signed, delivered and retried like the approval events.
  • Threat-model row, design doc table, CHANGELOG.

Related: #911, tole-gateway#16, tole-gateway#19.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions