Skip to content

fix(ts): preserve the provider error as cause on ContextWindowOverflowError - #6152

Open
YeChenglin8888 wants to merge 1 commit into
strands-agents:mainfrom
YeChenglin8888:agent-tasks/6062
Open

YeChenglin8888 wants to merge 1 commit into
strands-agents:mainfrom
YeChenglin8888:agent-tasks/6062

Conversation

@YeChenglin8888

Copy link
Copy Markdown

Human Overview

Fixed context-window overflow error translation dropping the original provider error cause across providers; added ErrorOptions support and regression tests.

Description

ContextWindowOverflowError only accepted a message, so every provider that translates a context-overflow response dropped the original provider error (e.g. SageMaker's LogStreamArn). The constructor now accepts ErrorOptions like ModelThrottledError/ModelError, and all translation sites pass { cause }.

Related Issues

Closes #6062

Type of Change

Bug fix

Testing

Added two cases in errors.test.ts (cause preserved / undefined without options). Verified: new tests fail on main, vitest run --project unit-node on 8 affected test files → 1073 passed / 2 skipped; full unit-node suite 5212 passed (a few worker files hit a Windows spawn UNKNOWN environment issue and pass when re-run individually). tsc --noEmit, eslint, prettier --check clean on changed files.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
Extended context (optional)

Prepared with AI assistance and reviewed locally; per team/AI_USAGE_POLICY.md the human overview above is provided by the contributor.

@YeChenglin8888
YeChenglin8888 requested a review from a team as a code owner November 14, 2026 06:41
@github-actions github-actions Bot added area-context Session or context related area-model Related to models or model providers typescript Pull requests that update typescript code bug Something isn't working labels Nov 14, 2026

This branch has not been deployed

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

Labels

area-context Session or context related area-model Related to models or model providers bug Something isn't working typescript Pull requests that update typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] TS: ContextWindowOverflowError drops the original provider error as cause

1 participant