Skip to content

Gather evidence fails gracefully on timeout#1103

Merged
sidnarayanan merged 5 commits intomainfrom
gather-evidence-timeouts
Sep 25, 2025
Merged

Gather evidence fails gracefully on timeout#1103
sidnarayanan merged 5 commits intomainfrom
gather-evidence-timeouts

Conversation

@sidnarayanan
Copy link
Copy Markdown
Collaborator

We basically never want to see this as a response to a gather evidence tool call:

Encountered exception during tool call: litellm.Timeout: APITimeoutError - Request timed out. Error_str: Request timed out.

We were previously bubbling up timeout errors all the way up to the tool call. Even one context failure would prevent all other successes from making it through. This PR catches and returns None if we timeout.

We may want to extend this to e.g. the BadRequestErrors, but sticking to Timeouts for now.

@cursor
Copy link
Copy Markdown

cursor bot commented Sep 24, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on October 5.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 24, 2025
@dosubot
Copy link
Copy Markdown

dosubot bot commented Sep 24, 2025

Related Documentation

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds graceful timeout handling to the map_fxn_summary function to prevent timeout errors from bubbling up to tool calls. Instead of allowing timeout exceptions to break the entire context creation process, the code now catches timeout errors and returns None, allowing other successful contexts to still be processed.

Key changes:

  • Added timeout-specific error handling with a new LLMContextTimeoutError exception
  • Refactored the error hierarchy with a base LLMContextError class
  • Enhanced error handling to differentiate between retryable and non-retryable errors

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/paperqa/core.py Added timeout exception handling, refactored error hierarchy, and improved error categorization
tests/test_paperqa.py Added comprehensive test for timeout resilience and various formatting improvements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Collaborator

@jamesbraza jamesbraza left a comment

Choose a reason for hiding this comment

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

Nice work, thanks!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 24, 2025
@sidnarayanan sidnarayanan merged commit 565cbb1 into main Sep 25, 2025
5 checks passed
@sidnarayanan sidnarayanan deleted the gather-evidence-timeouts branch September 25, 2025 02:43
@dosubot
Copy link
Copy Markdown

dosubot bot commented Sep 25, 2025

Documentation Updates

Checked 1 published document(s). No updates required.

How did I do? Any feedback?  Join Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants