Skip to content

fix(opencode): handle AWS SSO session expiry with automatic re-login#23525

Open
bainos wants to merge 3 commits intoanomalyco:devfrom
bainos:fix/aws-sso-login
Open

fix(opencode): handle AWS SSO session expiry with automatic re-login#23525
bainos wants to merge 3 commits intoanomalyco:devfrom
bainos:fix/aws-sso-login

Conversation

@bainos
Copy link
Copy Markdown
Contributor

@bainos bainos commented Apr 20, 2026

Issue for this PR

Closes #23522

Type of change

  • Bug fix

What does this PR do?

Intercepts CredentialsProviderError by .name before the AI SDK wraps it, spawns aws sso login [--profile <name>], awaits exit 0,
retries credentials transparently — the AI SDK never sees an error and the session continues uninterrupted.

18 lines changed in 1 file (packages/opencode/src/provider/provider.ts).

How did you verify your code works?

Tested manually by removing ~/.aws/sso/cache and running a Bedrock prompt.

Related

#18988

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When fromNodeProviderChain throws CredentialsProviderError (expired or
uninitialized SSO session), spawn 'aws sso login [--profile <name>]',
await successful exit, then retry credential resolution transparently.
The AI SDK never sees an error and the session continues uninterrupted.

Detects by error .name (stable SDK contract) not message string.
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue contributor labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: AWS SSO session expiry silently blocks Bedrock requests

1 participant