-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: Agent max_retry_limit config is silently ignored; tool failures have no retry/backoff path
#2081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Agent max_retry_limit config is silently ignored; tool failures have no retry/backoff path
#2081
Changes from all commits
a622e64
a4df5c6
d7dabae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -724,6 +724,9 @@ class ExecutionConfig: | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Retry settings | ||||||||||||||||||||||||||||||||||||||
| max_retry_limit: int = 2 | ||||||||||||||||||||||||||||||||||||||
| retry_initial_delay: float = 1.0 # seconds | ||||||||||||||||||||||||||||||||||||||
| retry_backoff_factor: float = 2.0 | ||||||||||||||||||||||||||||||||||||||
| retry_jitter: float = 0.1 # fraction of computed delay | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Tool call limits (loop protection) | ||||||||||||||||||||||||||||||||||||||
| max_tool_calls_per_turn: int = 10 | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -766,7 +769,7 @@ class ExecutionConfig: | |||||||||||||||||||||||||||||||||||||
| parallel_tool_calls: bool = False | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def __post_init__(self) -> None: | ||||||||||||||||||||||||||||||||||||||
| """Post-initialization processing with deprecation warnings.""" | ||||||||||||||||||||||||||||||||||||||
| """Post-initialization processing with deprecation warnings and validation.""" | ||||||||||||||||||||||||||||||||||||||
| # Handle context_compaction serialization round-trip | ||||||||||||||||||||||||||||||||||||||
| if isinstance(self.context_compaction, dict): | ||||||||||||||||||||||||||||||||||||||
| from ..context.policy import ContextCompactionPolicy | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -807,6 +810,14 @@ def __post_init__(self) -> None: | |||||||||||||||||||||||||||||||||||||
| ExecutionConfig._context_compaction_warned = True | ||||||||||||||||||||||||||||||||||||||
| finally: | ||||||||||||||||||||||||||||||||||||||
| del frame | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| # Validate retry configuration parameters | ||||||||||||||||||||||||||||||||||||||
| if self.retry_initial_delay <= 0: | ||||||||||||||||||||||||||||||||||||||
| raise ValueError("ExecutionConfig.retry_initial_delay must be positive.") | ||||||||||||||||||||||||||||||||||||||
| if self.retry_backoff_factor < 1.0: | ||||||||||||||||||||||||||||||||||||||
| raise ValueError("ExecutionConfig.retry_backoff_factor must be >= 1.0.") | ||||||||||||||||||||||||||||||||||||||
| if self.retry_jitter < 0: | ||||||||||||||||||||||||||||||||||||||
| raise ValueError("ExecutionConfig.retry_jitter must be non-negative.") | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+771
to
+820
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new validation checks the three delay fields but not
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def to_dict(self) -> Dict[str, Any]: | ||||||||||||||||||||||||||||||||||||||
| """Convert to dictionary.""" | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -815,6 +826,9 @@ def to_dict(self) -> Dict[str, Any]: | |||||||||||||||||||||||||||||||||||||
| "max_rpm": self.max_rpm, | ||||||||||||||||||||||||||||||||||||||
| "max_execution_time": self.max_execution_time, | ||||||||||||||||||||||||||||||||||||||
| "max_retry_limit": self.max_retry_limit, | ||||||||||||||||||||||||||||||||||||||
| "retry_initial_delay": self.retry_initial_delay, | ||||||||||||||||||||||||||||||||||||||
| "retry_backoff_factor": self.retry_backoff_factor, | ||||||||||||||||||||||||||||||||||||||
| "retry_jitter": self.retry_jitter, | ||||||||||||||||||||||||||||||||||||||
| "code_execution": self.code_execution, | ||||||||||||||||||||||||||||||||||||||
| "code_mode": self.code_mode, | ||||||||||||||||||||||||||||||||||||||
| "code_sandbox_mode": self.code_sandbox_mode, | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__post_init__returns early (lines 784, 786, 801) whenevercontext_compaction is False(the default) and the caller is internal library code — which is the case for everyExecutionConfig()created during agent startup. The threeraise ValueErrorguards at lines 815–820 are therefore never reached in practice, so callers can passretry_initial_delay=-1.0orretry_backoff_factor=0.5without error. Moving the validation before thecontext_compactionguard block ensures it always runs.