Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Group Bedrock API key entry with other AWS sign-in methods (#56023)

alexsong-oaid6a5c9d17e82
diff --git a/codex-rs/tui/src/onboarding/bedrock.rs b/codex-rs/tui/src/onboarding/bedrock.rs
index d1ea4d2464..16c6f91129 100644
--- a/codex-rs/tui/src/onboarding/bedrock.rs
+++ b/codex-rs/tui/src/onboarding/bedrock.rs
@@ -153,25 +153,18 @@ impl BedrockState {
if !self.environment_credentials.is_empty() {
methods.push(BedrockMethod::Environment);
}
- methods.extend([BedrockMethod::OtherMethods, BedrockMethod::ApiKey]);
+ methods.push(BedrockMethod::OtherMethods);
return methods;
}
if detected && !self.environment_credentials.is_empty() {
- return vec![
- BedrockMethod::Environment,
- BedrockMethod::OtherMethods,
- BedrockMethod::ApiKey,
- ];
+ return vec![BedrockMethod::Environment, BedrockMethod::OtherMethods];
}
- let mut methods = vec![
+ vec![
BedrockMethod::ManualProfile,
BedrockMethod::AccessKeys,
BedrockMethod::EnvironmentInstructions,
- ];
- if detected {
- methods.push(BedrockMethod::ApiKey);
- }
- methods
+ BedrockMethod::ApiKey,
+ ]
}
pub(super) fn is_text_entry_active(&self) -> bool {
@@ -635,7 +628,7 @@ impl BedrockState {
if matches!(self.view, BedrockView::EnvironmentInstructions) {
""
} else {
- "Use another profile, access keys, or environment variables"
+ "Use another profile, access keys, environment variables, or a Bedrock API key"
}
.to_string(),
),
diff --git a/codex-rs/tui/src/onboarding/bedrock_tests.rs b/codex-rs/tui/src/onboarding/bedrock_tests.rs
index 8f9f240587..7292b90b7f 100644
--- a/codex-rs/tui/src/onboarding/bedrock_tests.rs
+++ b/codex-rs/tui/src/onboarding/bedrock_tests.rs
@@ -83,7 +83,7 @@ fn render_visible_at(state: &BedrockState, area: Rect) -> String {
}
#[test]
-fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
+fn discovery_prioritizes_profiles_and_groups_other_sign_in_methods() {
let discovering = BedrockState::discovering(RequestId::Integer(1));
insta::assert_snapshot!(render_visible(&discovering), @r###"
> Set up Amazon Bedrock
@@ -126,7 +126,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
BedrockMethod::Profile(0),
BedrockMethod::Environment,
BedrockMethod::OtherMethods,
- BedrockMethod::ApiKey,
],
),
(
@@ -143,17 +142,12 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
BedrockMethod::Profile(1),
BedrockMethod::Environment,
BedrockMethod::OtherMethods,
- BedrockMethod::ApiKey,
],
),
(
Vec::new(),
vec![environment],
- vec![
- BedrockMethod::Environment,
- BedrockMethod::OtherMethods,
- BedrockMethod::ApiKey,
- ],
+ vec![BedrockMethod::Environment, BedrockMethod::OtherMethods],
),
(
Vec::new(),
@@ -186,7 +180,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
BedrockMethod::Profile(0),
BedrockMethod::Environment,
BedrockMethod::OtherMethods,
- BedrockMethod::ApiKey,
]
);
insta::assert_snapshot!(render_visible(&profile_and_bearer), @r###"
@@ -202,10 +195,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
Use your existing Amazon Bedrock API key
3. Other AWS sign-in methods
- Use another profile, access keys, or environment variables
-
- 4. Bedrock API key
- Enter a Bedrock API key
+ Use another profile, access keys, environment variables, or a
+ Bedrock API key
Press enter to continue
@@ -218,6 +209,7 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
BedrockMethod::ManualProfile,
BedrockMethod::AccessKeys,
BedrockMethod::EnvironmentInstructions,
+ BedrockMethod::ApiKey,
]
);
insta::assert_snapshot!(render_visible(&profile_and_bearer), @r"
@@ -234,6 +226,9 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
3. Environment variables
Configure AWS credentials in your environment, then return here
+ 4. Bedrock API key
+ Enter a Bedrock API key
+
Press enter to continue
Press esc to go back
@@ -253,10 +248,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
Use your existing AWS credentials
2. Other AWS sign-in methods
- Use another profile, access keys, or environment variables
-
- 3. Bedrock API key
- Enter a Bedrock API key
+ Use another profile, access keys, environment variables, or a
+ Bedrock API key
Press enter to continue
@@ -288,10 +281,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
us-west-2
3. Other AWS sign-in methods
- Use another profile, access keys, or environment variables
-
- 4. Bedrock API key
- Enter a Bedrock API key
+ Use another profile, access keys, environment variables, or a
+ Bedrock API key
Press enter to continue
@@ -314,8 +305,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
2. Other AWS sign-in methods
- 3. Bedrock API key
-
Press enter to continue
Press esc to go back
@@ -365,7 +354,7 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
.flat_map(|row| (area.left()..area.right()).map(move |column| (column, row)))
.map(|position| buffer[position].symbol())
.collect::<String>();
- assert!(visible.contains("Bedrock API key"));
+ assert!(visible.contains("Other AWS sign-in methods"));
assert!(visible.contains("Press enter to continue"));
assert!(visible.contains("Press esc to go back"));