Skip to content

fix: emit chat.completed webhooks for successful API and streaming chats #17

Description

@EvanProgramming

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.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions