Priority
P2 — registered webhooks only fire for the manual test endpoint.
Audit finding
_fire_webhooks() is implemented and /api/webhooks/test calls it, but neither /api/chat nor /api/chat/stream invokes it after a successful chat. A chat can therefore complete with no webhook notification despite the webhook API being configured.
Reproduction
With a registered chat.completed hook and _fire_webhooks replaced by a spy:
POST /api/chat -> 200
events after chat -> []
POST /api/webhooks/test -> 200
events after test -> [('test', ...)]
The real chat path completed; only the explicit test route produced an event.
Acceptance criteria
- Emit exactly one documented completion event after a successful non-streaming chat.
- Emit one event after the streaming generator reaches completion, with no event for an aborted/error stream.
- Include session/profile and a bounded reply/result or documented redacted payload.
- Webhook failures remain isolated from the user response and are logged/audited.
- Add endpoint tests for success, error, stream completion, and duplicate-event prevention.
Priority
P2 — registered webhooks only fire for the manual test endpoint.
Audit finding
_fire_webhooks() is implemented and /api/webhooks/test calls it, but neither /api/chat nor /api/chat/stream invokes it after a successful chat. A chat can therefore complete with no webhook notification despite the webhook API being configured.
Reproduction
With a registered chat.completed hook and _fire_webhooks replaced by a spy:
The real chat path completed; only the explicit test route produced an event.
Acceptance criteria