Skip to content

feat: add managed Amazon Bedrock login#31326

Closed
celia-oai wants to merge 11 commits into
mainfrom
codex/managed-bedrock-login-v2
Closed

feat: add managed Amazon Bedrock login#31326
celia-oai wants to merge 11 commits into
mainfrom
codex/managed-bedrock-login-v2

Conversation

@celia-oai

@celia-oai celia-oai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Why

The app-server protocol can describe a Codex-managed Amazon Bedrock login, but clients still need the server-side implementation to onboard users without manipulating auth.json or config.toml themselves.

Because a managed Bedrock API key is primary CodexAuth state, login should use the existing auth persistence and reload lifecycle. This keeps credential replacement, account reporting, and login notifications consistent with the other supported login methods instead of introducing a separate provider-specific credential cache.

What changed

  • Implement the experimental amazonBedrock branch of account/login/start.
  • Trim and validate the API key and region, using the model provider's shared list of Bedrock Mantle regions.
  • Reject login when external ChatGPT auth is active or ChatGPT login is forced, while continuing to allow the existing API-login policy.
  • Cancel any pending ChatGPT login, persist the Bedrock key as primary Codex auth, and set the user-level model_provider to amazon-bedrock without overriding a command-line provider selection.
  • Reload the shared AuthManager, and reload config for account reads so account/read and auth-status responses immediately reflect the selected Bedrock provider.
  • Emit the standard account/login/completed and account/updated notifications.
  • Add integration coverage for capability gating, validation, auth replacement, policy enforcement, provider overrides, persistence, notifications, and active Bedrock account reporting.

Operational notes

Managed Bedrock login replaces the currently stored primary Codex login. Existing loaded sessions retain their provider selection, so clients should restart the app-server before sending further model requests. This will be fixed in a followup.

Validation

  • just test -p codex-app-server -E 'test(/suite::v2::account/)' — 40 passed
  • Manual end-to-end test against Amazon Bedrock in us-east-2: ran target/debug/codex-app-server-test-client with test-login --amazon-bedrock, observed successful account/login/start, account/login/completed, and account/updated responses, confirmed config.toml selected amazon-bedrock, confirmed auth.json persisted only the managed Bedrock API-key auth and region with no OpenAI API key, and successfully completed a model request through a fresh target/debug/codex process. real events log:
> {
>   "id": "0a464d89-409f-49ab-9a4d-6979ebb26bc2",
>   "method": "account/login/start",
>   "params": {
>     "apiKey": "<redacted>",
>     "region": "us-east-2",
>     "type": "amazonBedrock"
>   },
>   "trace": {
>     "traceparent": "00-00b281562d823eca87c80aa12d40a3c0-b801b56390c177e9-01",
>     "tracestate": "dd=s:2;t.oai_ft:1"
>   }
> }
< {
<   "method": "remoteControl/status/changed",
<   "params": {
<     "environmentId": null,
<     "installationId": "55297f82-9485-4db0-8792-f903c50ab831",
<     "serverName": "com-92114",
<     "status": "disabled"
<   }
< }
< {
<   "id": "0a464d89-409f-49ab-9a4d-6979ebb26bc2",
<   "result": {
<     "type": "amazonBedrock"
<   }
< }
< account/login/start response: AmazonBedrock
< {
<   "method": "account/login/completed",
<   "params": {
<     "error": null,
<     "loginId": null,
<     "success": true
<   }
< }
< account/login/completed notification: AccountLoginCompletedNotification { login_id: None, success: true, error: None }
< {
<   "method": "account/updated",
<   "params": {
<     "authMode": "bedrockApiKey",
<     "planType": null
<   }
< }

Stack

  1. feat: add managed Bedrock login API #31327 — managed Bedrock experimental API (base: main)
  2. feat: add managed Amazon Bedrock login #31326 — managed Bedrock login (base: codex/managed-bedrock-api)
  3. feat: implement managed Bedrock logout #31325 — managed Bedrock logout (base: codex/managed-bedrock-login-v2)

@celia-oai
celia-oai force-pushed the codex/managed-bedrock-api branch from e8a19f9 to 35ebf5d Compare July 7, 2026 19:17
@celia-oai
celia-oai force-pushed the codex/managed-bedrock-login-v2 branch 2 times, most recently from fc7cbe0 to fa240d8 Compare July 8, 2026 00:16
@celia-oai celia-oai changed the title [codex] Implement managed Bedrock login feat: Implement managed Bedrock login Jul 8, 2026
@celia-oai celia-oai changed the title feat: Implement managed Bedrock login app-server: add managed Amazon Bedrock login Jul 8, 2026
@celia-oai celia-oai changed the title app-server: add managed Amazon Bedrock login feat: add managed Amazon Bedrock login Jul 8, 2026
@celia-oai
celia-oai force-pushed the codex/managed-bedrock-api branch from 159f579 to 7da3ba3 Compare July 8, 2026 23:49
@celia-oai
celia-oai force-pushed the codex/managed-bedrock-login-v2 branch 2 times, most recently from 6702939 to 01f9bf1 Compare July 9, 2026 00:33
@celia-oai

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown
Contributor

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: a228c77c7b

ℹ️ 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".

Comment thread codex-rs/app-server/src/request_processors/bedrock_auth.rs
Comment thread codex-rs/app-server/src/request_processors/account_processor.rs Outdated
@celia-oai
celia-oai marked this pull request as ready for review July 9, 2026 22:14

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

Copy link
Copy Markdown
Contributor

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: a74bbdc5b8

ℹ️ 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".

Comment thread codex-rs/app-server/src/request_processors/account_processor.rs
Comment thread codex-rs/app-server/src/request_processors/account_processor.rs
Comment thread codex-rs/app-server/src/request_processors/bedrock_auth.rs
Comment thread codex-rs/app-server/src/request_processors/bedrock_auth.rs
@celia-oai
celia-oai requested a review from pakrym-oai July 9, 2026 23:36
celia-oai added a commit that referenced this pull request Jul 10, 2026
## Why

App-server clients can report whether Amazon Bedrock is using
AWS-managed credentials or a Codex-managed API key, but they do not have
a matching API for creating the managed login. This PR defines that
experimental wire contract independently from its implementation.

Managed Bedrock API keys are already a primary `CodexAuth` mode. The API
therefore describes a normal Codex login that replaces the current
stored auth rather than introducing provider-scoped credential storage.

## What changed

- Add the experimental `amazonBedrock` variant to `account/login/start`.
- Accept an API key and AWS region and return a matching discriminated
response.
- Gate the request behind the app-server `experimentalApi` capability.
- Regenerate the JSON and TypeScript protocol schemas.
- Document the login contract, notifications, primary-auth replacement
semantics, restart boundary, and non-transactional durable writes.

## Impact

This PR defines the API shape but does not implement login behavior. The
next PR adds validation, persistence through the existing Codex auth
lifecycle, provider selection, and notifications.

## Validation

- `just test -p codex-app-server-protocol`

## Stack

1. **#31327 Managed Bedrock experimental API** — base: `main`
2. #31326 Managed Bedrock login — base: `codex/managed-bedrock-api`
3. #31325 Managed Bedrock logout — base:
`codex/managed-bedrock-login-v2`
Base automatically changed from codex/managed-bedrock-api to main July 10, 2026 00:05
@celia-oai
celia-oai force-pushed the codex/managed-bedrock-login-v2 branch from f554c58 to c31ae26 Compare July 10, 2026 00:06
@celia-oai celia-oai closed this Jul 13, 2026
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.

1 participant