Skip to content

Comments

fix retry for invalid model response errors#778

Merged
mikasenghaas merged 2 commits intomainfrom
fix-retries
Jan 24, 2026
Merged

fix retry for invalid model response errors#778
mikasenghaas merged 2 commits intomainfrom
fix-retries

Conversation

@mikasenghaas
Copy link
Member

@mikasenghaas mikasenghaas commented Jan 24, 2026

Description

actually catches and retries InvalidModelResponseError + adjust semantics for retry count in logs

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes


Note

Improves the retry wrapper to correctly surface and retry on model response errors and to provide clearer retry logs.

  • Extends maybe_retry with error_types (defaults to InfraError and InvalidModelResponseError) and raises from state["error"] for dict/list results via reraise_error_from_state
  • Tenacity retry now uses the configurable error_types; _raise_error_from_state removed
  • Enhanced retry logging with ErrorChain, print_time, caller name, next sleep, and clearer attempt semantics
  • Adds required imports in async_utils.py

Written by Cursor Bugbot for commit 45b2087. This will update automatically on new commits. Configure here.

@mikasenghaas mikasenghaas requested a review from rasdani January 24, 2026 14:30
@mikasenghaas mikasenghaas marked this pull request as ready for review January 24, 2026 14:30
Copy link
Contributor

@rasdani rasdani left a comment

Choose a reason for hiding this comment

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

nice!

@mikasenghaas mikasenghaas merged commit 7d96639 into main Jan 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants