Skip to content

feat: Add support for automatic AWS sso refresh when using AWS Bedrock#18988

Open
yiftizur wants to merge 3 commits intoanomalyco:devfrom
yiftizur:feature/aws-bedrock-auto-refresh
Open

feat: Add support for automatic AWS sso refresh when using AWS Bedrock#18988
yiftizur wants to merge 3 commits intoanomalyco:devfrom
yiftizur:feature/aws-bedrock-auto-refresh

Conversation

@yiftizur
Copy link
Copy Markdown

@yiftizur yiftizur commented Mar 24, 2026

Issue for this PR

Closes #7045

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR adds support for automatic AWS SSO token renewal when using AWS Bedrock
Similar to the Claude Code functionality - https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Tested it manually with our AWS Bedrock profile
added unit tests and validated all tests pass

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

When SSO tokens expire, OpenCode will now automatically run the configured
refresh command (e.g., 'aws sso login') and retry the request.

Implements the same approach as Claude Code:
https://code.claude.com/docs/en/amazon-bedrock#advanced-credential-configuration

Configuration example:
{
  "provider": {
    "amazon-bedrock": {
      "options": {
        "awsAuthRefresh": "aws sso login --profile myprofile"
      }
    }
  }
}
- Add comprehensive error classification with AWSErrorType enum
- Support web identity token errors (EKS IRSA) for auto-refresh
- Add user feedback via toast notifications during refresh
- Detect non-interactive environments and warn appropriately
- Add guidance for bearer token users (auth.json requires manual refresh)
- Export validateCommand and parseCommand for testing
- Add 45 unit tests for error classification and command parsing
- Update documentation with detailed behavior explanation
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Add support for automatic AWS sso refresh when using AWS Bedrock doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@yiftizur yiftizur changed the title Add support for automatic AWS sso refresh when using AWS Bedrock feat: Add support for automatic AWS sso refresh when using AWS Bedrock Mar 24, 2026
@github-actions github-actions bot removed needs:title needs:compliance This means the issue will auto-close after 2 hours. labels Mar 24, 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: support awsAuthRefresh configuration on bedrock

1 participant