-
Notifications
You must be signed in to change notification settings - Fork 14.3k
feat: add managed Amazon Bedrock login #31326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
celia-oai
wants to merge
9
commits into
codex/managed-bedrock-api
Choose a base branch
from
codex/managed-bedrock-login-v2
base: codex/managed-bedrock-api
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b6fe9ad
app-server: add managed Bedrock login
celia-oai 07c6a17
Remove redundant managed Bedrock login tests
celia-oai d0f7e2c
app-server: reload config for account reads
celia-oai 4ae5e8a
app-server-test-client: add managed Bedrock login
celia-oai 86f038f
app-server-test-client: fold Bedrock into test-login
celia-oai 9a80356
app-server-test-client: require Bedrock login arguments
celia-oai 01f9bf1
app-server-test-client: wait for Bedrock login notifications
celia-oai a228c77
app-server: migrate Bedrock tests to server builder
celia-oai 259bfa2
app-server: configure Bedrock before saving auth
celia-oai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
codex-rs/app-server/src/request_processors/bedrock_auth.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| use super::config_processor::map_error as map_config_error; | ||
| use crate::config_manager::ConfigManager; | ||
| use codex_app_server_protocol::ConfigValueWriteParams; | ||
| use codex_app_server_protocol::JSONRPCErrorError; | ||
| use codex_app_server_protocol::MergeStrategy; | ||
| use codex_model_provider::AMAZON_BEDROCK_PROVIDER_ID; | ||
|
|
||
| pub(super) async fn set_user_model_provider_to_bedrock( | ||
| config_manager: &ConfigManager, | ||
| ) -> Result<(), JSONRPCErrorError> { | ||
| write_user_model_provider( | ||
| config_manager, | ||
| serde_json::json!(AMAZON_BEDROCK_PROVIDER_ID), | ||
| /*expected_version*/ None, | ||
| ) | ||
| .await | ||
| } | ||
|
|
||
| async fn write_user_model_provider( | ||
| config_manager: &ConfigManager, | ||
| value: serde_json::Value, | ||
| expected_version: Option<String>, | ||
| ) -> Result<(), JSONRPCErrorError> { | ||
| config_manager | ||
| .write_value(ConfigValueWriteParams { | ||
| key_path: "model_provider".to_string(), | ||
| value, | ||
| merge_strategy: MergeStrategy::Replace, | ||
| file_path: None, | ||
| expected_version, | ||
| }) | ||
| .await | ||
| .map(|_| ()) | ||
| .map_err(map_config_error) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a higher-precedence config layer such as
-c model_provider=openaior managed config already controlsmodel_provider,ConfigManager::write_valuereturnsOkOverridden; this discards that status, sologin_amazon_bedrock_v2can report a successful Bedrock login after replacingauth.jsoneven though the effective provider is still notamazon-bedrock. In that stateaccount/readand subsequent model requests use the old provider withBedrockApiKeyauth and fail, so the login should either fail before saving auth or verify the effective provider actually switched.Useful? React with 👍 / 👎.