Add AWS credential export commands for Amazon Bedrock (#44028)

## What changed

Support `model_providers.amazon-bedrock.aws.credential_export` with `command`, `args`, and `timeout_ms` to supply SigV4 signing credentials from a command's JSON output. Accept both flat credential-process output and nested STS `Credentials` objects.

Cache credentials in memory, refresh before expiration, and share exports across sessions with matching AWS configuration. On recoverable authentication failures, run the optional `aws.auth_refresh` command before exporting fresh credentials, coalescing concurrent recovery attempts.

Bound command execution time and output size, and keep credential values out of errors. Reject combining `aws.credential_export` with `aws.profile`. Bedrock setup and login reject changes while an exporter is configured, preserving configuration and saved credentials.

## Testing

Add coverage for output formats, expiration, credential precedence, caching, concurrent recovery, command failures, and secret redaction. Integration tests verify request signing with rotated credentials, bounded recovery attempts, and setup/login rejection across configuration layers.

GitOrigin-RevId: 4ef799f88ab5e3b2578f8f41a5e56e4f30e2cd81
This commit is contained in:
alexsong-oai authored and copyberry committed 2026-09-09 03:17:48 +00:00
1 parent 2ce38ae6d8
commit fe52d795c9
26 files changed
+1790 -89

No files matched your search

@@ -286,7 +286,8 @@ async fn cached_legacy_resume_revalidates_history_across_migration_settings() ->
[(false, false), (false, true), (true, false), (true, true)]
{
let codex_home = tempfile::tempdir().expect("tempdir");
let config = build_config(&codex_home).await;
// Keep the large setup futures off the test thread's stack.
let config = Box::pin(build_config(&codex_home)).await;
let legacy_thread_id = ThreadId::from_string(
&create_fake_rollout(
codex_home.path(),
@@ -314,7 +315,8 @@ async fn cached_legacy_resume_revalidates_history_across_migration_settings() ->
let maintenance_guard =
codex_rollout::try_acquire_rollout_maintenance_lock(codex_home.path())?
.expect("acquire rollout maintenance lock");
let mut app_server = crate::start_embedded_app_server_for_picker(&startup_config).await?;
let mut app_server =
Box::pin(crate::start_embedded_app_server_for_picker(&startup_config)).await?;
app_server.remember_thread_history_mode(legacy_thread_id, ThreadHistoryMode::Legacy);
let local_settings = crate::local_settings::LocalSettings::from(&resume_config);
let next_request_id = app_server.next_request_id;