From 4b5ccfa24ca479d6fbf6d35fe71aeab28f593af8 Mon Sep 17 00:00:00 2001 From: Adam Perry Date: Fri, 5 Jun 2026 23:08:28 +0000 Subject: [PATCH] fix(rmcp): reject expired OAuth fallback token --- codex-rs/rmcp-client/src/rmcp_client.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codex-rs/rmcp-client/src/rmcp_client.rs b/codex-rs/rmcp-client/src/rmcp_client.rs index 90b09d724c..d16a4a9e55 100644 --- a/codex-rs/rmcp-client/src/rmcp_client.rs +++ b/codex-rs/rmcp-client/src/rmcp_client.rs @@ -770,6 +770,12 @@ impl RmcpClient { matches!(auth_err, AuthError::NoAuthorizationSupport) }) => { + if initial_tokens.token_response.0.expires_in() == Some(Duration::ZERO) + { + return Err(anyhow!( + "stored OAuth access token for MCP server `{server_name}` is expired and OAuth metadata discovery is unavailable" + )); + } let access_token = initial_tokens .token_response .0