mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
fix: show correct Bedrock runtime endpoint in /status (#20275)
## Why `/status` was showing the configured `ModelProviderInfo.base_url` for Amazon Bedrock, which can be stale or misleading because the actual Bedrock Mantle endpoint is derived at runtime from the resolved AWS region. This made sessions report the wrong provider endpoint even though requests used the correct runtime URL. ## What changed - Added `ModelProvider::runtime_base_url()` so provider implementations can expose the request-time base URL through the shared runtime provider abstraction. - Moved Bedrock region-to-Mantle URL resolution into `amazon_bedrock::mantle::runtime_base_url()`, keeping region resolution private to the Mantle module. - Overrode `runtime_base_url()` for Amazon Bedrock so it returns the resolved Mantle endpoint instead of the configured default. - Resolved and cached the runtime provider base URL during TUI startup, then used that cached value when rendering `/status`. - Added status coverage that verifies Bedrock displays the runtime URL and ignores the configured Bedrock `base_url` when they differ. ## Verification model provider is resolved correctly in local build: <img width="696" height="245" alt="Screenshot 2026-04-29 at 5 01 36 PM" src="https://github.com/user-attachments/assets/a13c10a5-3720-41ab-8ace-3c4bc573f971" />
This commit is contained in:
1 parent
93d53f655b
commit
31f8813e3e
15 files changed
+149
-17
No files matched your search
@@ -106,6 +106,11 @@ pub trait ModelProvider: fmt::Debug + Send + Sync {
|
||||
.to_api_provider(auth.as_ref().map(CodexAuth::auth_mode))
|
||||
}
|
||||
|
||||
/// Returns the provider base URL that will be used at request time.
|
||||
async fn runtime_base_url(&self) -> codex_protocol::error::Result<Option<String>> {
|
||||
Ok(self.info().base_url.clone())
|
||||
}
|
||||
|
||||
/// Returns the auth provider used to attach request credentials.
|
||||
async fn api_auth(&self) -> codex_protocol::error::Result<SharedAuthProvider> {
|
||||
let auth = self.auth().await;
|
||||
@@ -333,6 +338,22 @@ mod tests {
|
||||
assert_eq!(provider.capabilities(), ProviderCapabilities::default());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn configured_provider_runtime_base_url_uses_configured_base_url() {
|
||||
let provider = create_model_provider(
|
||||
provider_for("https://example.test/v1".to_string()),
|
||||
/*auth_manager*/ None,
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
provider
|
||||
.runtime_base_url()
|
||||
.await
|
||||
.expect("runtime base URL should resolve"),
|
||||
Some("https://example.test/v1".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_model_provider_builds_command_auth_manager_without_base_manager() {
|
||||
let provider = create_model_provider(
|
||||
|
||||
Reference in new issue
Block a user