Skip to content

fix(agents): provider-specific errors misclassified during failover #58837

Closed

Description

@aaron-he-zhu

Bug Description

classifyFailoverReason() in src/agents/pi-embedded-helpers/errors.ts relies on generic string matching that misclassifies errors from several providers. This causes the failover engine to choose wrong recovery strategies — for example, retrying with the same oversized context instead of triggering compaction, or treating a rate limit as an unknown error.

Examples of Misclassification

Provider Error Message Expected Actual
AWS Bedrock ThrottlingException: Too many concurrent requests rate_limit null (unclassified)
AWS Bedrock ModelNotReadyException: model is not ready overloaded null
Groq model_is_deactivated model_not_found null
Together AI concurrency limit has been reached rate_limit null
Google Vertex INVALID_ARGUMENT: exceeds the maximum input tokens context overflow null

Impact

Expected Behavior

Provider-specific error patterns should be normalized to the existing FailoverReason enum so the failover engine can make correct decisions regardless of which provider returned the error.

Affected Code

  • src/agents/pi-embedded-helpers/errors.ts:1002 — classifyFailoverReason()
  • src/agents/pi-embedded-helpers/failover-matches.ts — generic pattern matchers

Activity

  1. locked as resolved and limited conversation to collaborators on Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions