Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/active_agent/providers/concerns/exception_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def with_exception_handling(&block)
yield
rescue => exception
rescue_with_handler(exception) || raise
nil # Discard handler return value to prevent polluting raw_response
end

Comment on lines +58 to 60
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes with_exception_handling to always return nil when an exception is handled, which alters the existing contract where the handler’s return value is propagated. There is a current unit test that asserts the handler return value is returned (test/providers/concerns/exception_handler_test.rb:57-66), so this PR will fail CI unless the tests (and any other callers) are updated. If you want to avoid a behavior change in this concern, consider keeping with_exception_handling returning the handler result and instead change the BaseProvider call sites to not assign the method’s return value to raw_response (so raw_response stays nil on exceptions).

Suggested change
nil # Discard handler return value to prevent polluting raw_response
end
end

Copilot uses AI. Check for mistakes.
# Bubbles up exceptions to the Agent's rescue_from if a handler is defined.
Expand Down
Loading