Exception: Assistant::Cancelled

Inherits:
StandardError
  • Object
show all
Defined in:
app/services/assistant/cancelled.rb

Overview

Raised when the user clicks Stop and the cancellation must propagate up
the entire chat call stack — past the LLM tool loop, past ChatService,
back to AssistantChatWorker which discards the partial response.

The first defense is RubyLLM::Tool::Halt returned from ToolLoopGuard's
preflight. That short-circuits the in-flight tool loop. This exception
is the second line of defense, raised from postflight when the cancel
flag flips DURING a tool execution (e.g. several parallel tool calls
were dispatched in one assistant turn and the user clicked Stop while
they were running).

Instance Method Summary collapse

Constructor Details

#initialize(message = 'User cancelled this request.') ⇒ Cancelled

Returns a new instance of Cancelled.



15
16
17
# File 'app/services/assistant/cancelled.rb', line 15

def initialize(message = 'User cancelled this request.')
  super
end