fix: handle conversation is nil

This commit is contained in:
Shivam Mishra
2025-08-04 15:42:43 +05:30
parent 25b545200e
commit 73c2690526
@@ -27,7 +27,9 @@ class Captain::Assistant::AgentRunnerService
process_agent_result(result)
rescue StandardError => e
ChatwootExceptionTracker.new(e, account: @conversation.account).capture_exception
# when running the agent runner service in a rake task, the conversation might not have an account associated
# for regular production usage, it will run just fine
ChatwootExceptionTracker.new(e, account: @conversation&.account).capture_exception
Rails.logger.error "[Captain V2] AgentRunnerService error: #{e.message}"
Rails.logger.error e.backtrace.join("\n")