Skip to content

feat: Bedrock support for Claude adapter#1

Merged
dafzthomas merged 28 commits intomainfrom
feat/claude-adapter-fixes
Mar 18, 2026
Merged

feat: Bedrock support for Claude adapter#1
dafzthomas merged 28 commits intomainfrom
feat/claude-adapter-fixes

Conversation

@dafzthomas
Copy link
Owner

Summary

Adds full AWS Bedrock support for the Claude Code adapter (claudeAgent provider), enabling Claude models to be used via Bedrock inference profiles instead of the default Anthropic API.

Bedrock model resolution

  • Friendly model slugs (e.g. claude-sonnet-4-6) cause a 400 from the Bedrock API — they must be mapped to Bedrock ARN/model IDs
  • resolveBedrockModel() in ClaudeAdapter.ts maps slugs to configured Bedrock ARN overrides (via UI settings or env vars), or omits the model to let the CLI use its built-in default
  • Applied in both startSession and sendTurn paths

Shell environment sync

  • Desktop syncShellEnvironment now syncs AWS/Bedrock env vars (AWS_PROFILE, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_BEDROCK_MODEL_*) from the login shell
  • Server exposes BedrockShellDefaults via serverGetConfig so the web UI can detect shell-based Bedrock configuration

Settings UI improvements

  • Auto-detects Bedrock enabled via shell environment variables
  • Shows shell defaults as input placeholders (region, profile, model ARNs)
  • Displays explanatory text when Bedrock is enabled via env rather than the UI toggle
  • Bedrock config fields shown when enabled by either method

Chat bar indicator

  • Shows a BEDROCK badge in the composer model picker when Bedrock is active
  • Provider label overrides now respond to both UI toggle and shell env detection

Configuration

To use Bedrock, either:

  1. Set CLAUDE_CODE_USE_BEDROCK=1 in your shell environment, or
  2. Enable the toggle in Settings → Claude Bedrock

Then configure Bedrock Model ARN overrides pointing to inference profiles your IAM role has access to (e.g. application inference profiles).

Test plan

  • bun run typecheck — 7/7 packages pass
  • bun run test — 490/490 tests pass
  • Verified SDK works with Bedrock when env is passed to query()
  • Verified model resolution: friendly slugs omitted, ARN overrides passed through
  • Verified shell env sync propagates AWS credentials to server child process
  • Verified BEDROCK badge appears in chat bar when Bedrock is active

juliusmarminge and others added 26 commits March 16, 2026 10:07
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
- drop `cursor` from provider/model contracts and runtime validation
- remove Cursor-specific UI options, settings, and model normalization paths
- update server/web tests and fixtures to cover Codex + Claude Code only
- Include Claude Code in available provider options in the picker
- Add Cursor as a disabled placeholder provider with icon mapping
- Update session-logic tests to assert provider availability and ordering
- Map Claude reasoning deltas, streamed tool input JSON, and tool results into runtime item/content events
- Classify Agent/read-only Claude tools for correct approval request types
- Add Claude CLI provider health checks and auth-status parsing coverage

Co-authored-by: codex <codex@users.noreply.github.com>
- Reject turn starts that request a provider switch from the thread-bound provider
- Reject models that do not belong to the thread provider and log start failures
- Add shared `inferProviderForModel` helper and tests; reuse it in web store inference
- Use thread provider as the preferred provider during command handling
- Update `ProviderModelPicker` to show direct model choices when provider is locked
- Add browser tests for locked/unlocked picker behavior and widen browser test glob
- derive `defaultModel` from `DEFAULT_MODEL_BY_PROVIDER` using harness provider
- replace hardcoded `gpt-5-codex` in seeded project and thread setup
- Persist selected provider and model in the composer draft before
  clearing content on send, so the draft survives shouldRemoveDraft
  and the provider selection is not lost between renders

- Use provider-aware DEFAULT_MODEL_BY_PROVIDER[selectedProvider]
  fallback instead of hard-coded DEFAULT_MODEL_BY_PROVIDER.codex
  in thread creation and plan implementation flows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Bedrock settings to app settings schema (useBedrock, awsRegion,
  awsProfile, bedrockModelOverride ARNs for Haiku/Sonnet/Opus)
- Add Bedrock settings UI section in settings page with toggle,
  region/profile inputs, and ARN override fields
- Wire Bedrock provider options through ChatView dispatch to server
- Pass Bedrock env vars (CLAUDE_CODE_USE_BEDROCK, AWS_REGION, etc.)
  to SDK query options in ClaudeAdapter
- Show "Bedrock" prefix on model names when Bedrock is enabled
- Show "Claude Bedrock" label in provider picker when Bedrock is enabled
- Add Bedrock fields to ClaudeProviderStartOptions contract

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add resolveBedrockModel() to ClaudeAdapter that maps friendly model
  slugs (e.g. claude-sonnet-4-6) to Bedrock ARN overrides when
  CLAUDE_CODE_USE_BEDROCK is enabled. Passing friendly slugs directly
  causes a 400 from the Bedrock API.
- Apply model resolution in both startSession and sendTurn paths;
  skip setModel() when resolved model is undefined to let the CLI
  use its built-in Bedrock default.
- Sync AWS/Bedrock env vars (AWS_PROFILE, AWS_REGION, credentials,
  CLAUDE_CODE_USE_BEDROCK, model overrides) from login shell in
  desktop syncShellEnvironment.
- Add BedrockShellDefaults schema to contracts and expose it via
  serverGetConfig so the web UI can detect shell-based Bedrock config.
- Settings UI auto-detects Bedrock enabled via shell env, shows
  shell defaults as placeholders, and displays explanatory text.
- ChatView passes bedrockShellDefaults to ProviderModelPicker for
  the Bedrock badge and provider label overrides.
- Show BEDROCK badge in the composer model picker button when
  Bedrock is active.
- Update wsServer tests to use expect.objectContaining to
  accommodate optional bedrockShellDefaults field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Mar 18, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f9d59ecef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- mockServiceWorker.js: keep newer version (2.12.11)
- appSettings.ts: keep Bedrock fields alongside new textGenerationModel
- model.ts: keep backward compat exports alongside new DEFAULT_GIT_TEXT_GENERATION_MODEL

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- resolveBedrockModel now only rewrites known friendly slugs (haiku,
  sonnet, opus) and passes through custom model IDs (e.g. ARNs) as-is
- sendTurn uses the session-scoped env (context.sessionEnv) instead of
  process.env, so UI-provided Bedrock overrides are respected
  consistently with startSession
- Store baseEnv as sessionEnv on ClaudeSessionContext for turn-time
  model resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dafzthomas dafzthomas merged commit 8922fe2 into main Mar 18, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants