chat

Interrupt Chat

Stop an in-flight chat run via the cooperative interrupt flag.

Stopping resolves the chat's active_workflow_id (liveness from the DBOS status row) and raises the single cooperative stop signal. The workflow observes it at its next node boundary and finalizes normally — persisting the sanitized partial turn, stamping last-edit, capturing the trace, and emitting the interrupted terminal — while in-flight tools observe the same flag at their checkpoints and bail BEFORE committing DB side-effects. No hard DBOS cancel is issued here: a hard cancel skips finalization and is only seen at the next step boundary (tools would commit after Stop); it survives solely as the run monitor's escalation backstop for wedged runs.

Args: request: The interrupt request containing project_id and reason (pre-validated).

Returns: ChatInterruptResponse with was_active True iff a live run was signalled.

Raises: HTTPException: 400 for an invalid project id; 500 for unexpected errors.

post/api/v1/chat/chat/interrupt

Request body

project_idstring required

The project ID to interrupt.

reasonstring

Reason for interruption (e.g., 'user_requested', 'timeout', 'error').

Response

Successful Response

successboolean required

Whether the interrupt was successful.

messagestring required

Status message.

was_activeboolean required

Whether the chat stream was active when interrupt was requested.

Changes