Skip to content

agent: retry transient LLM failures in loop#857

Closed
pikaxinge wants to merge 1 commit intosipeed:mainfrom
pikaxinge:fix/issue-629-transient-llm-retry
Closed

agent: retry transient LLM failures in loop#857
pikaxinge wants to merge 1 commit intosipeed:mainfrom
pikaxinge:fix/issue-629-transient-llm-retry

Conversation

@pikaxinge
Copy link
Copy Markdown
Contributor

Summary

  • retry transient provider failures in the agent loop using existing error classification
  • keep context-window retry/compression behavior unchanged for context exhaustion
  • add explicit retry notice to non-internal channels during transient retries
  • add tests for transient retry success and non-retryable error behavior

Test Plan

  • go test ./pkg/agent -run 'TestAgentLoop_TransientLLMErrorRetry|TestAgentLoop_NonRetryableLLMError_NoRetry|TestAgentLoop_ContextExhaustionRetry'
  • go test ./pkg/...

Fixes #629

Copilot AI review requested due to automatic review settings February 27, 2026 08:45
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.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

})
}

if retry < len(transientBackoff) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

therre have two kinds retry?

  • time out、502/503、connection reset、TLS -> backoff retry ?
  • contains(token/context/invalidparameter/length) -> compression retry?

Copy link
Copy Markdown

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

This PR is superseded by #866, which extracts the retry logic into a shared pkg/utils/llm_retry.go engine and addresses the reviewer feedback from #594 (parent deadline capping, Retry-After parsing, jittered backoff, toolloop integration).

The core changes here (transient retry in agent loop, isTransientLLMError, isContextWindowError) are all present in #866 in a more complete form.

Recommend closing this in favor of #866.

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.

[BUG] Didn't retry if meet LLM call failed

4 participants