Summary
After re-authenticating an OAuth-enabled MCP server, the currently running Codex agent/session can continue using a stale refresh token and still fail MCP initialization with invalid_grant until the app/session is restarted.
Expected behavior
After successful codex mcp login <server>, MCP handshakes in the active session should use fresh credentials immediately (or the runtime should force re-init of auth state).
Observed behavior
codex mcp login <server> reports success.
- MCP tool calls in the same running session continue failing with:
OAuth token refresh failed: invalid_grant: Invalid or expired refresh token
- Restarting the app/new session clears the issue.
Steps to reproduce
- Configure any OAuth-enabled MCP server.
- Let its refresh token become invalid/expired.
- In a running Codex session, trigger MCP usage and observe
invalid_grant failure.
- Run
codex mcp login <server> and complete OAuth successfully.
- Retry MCP usage in the same running session.
- Observe continued
invalid_grant until restart/new session.
Environment
- Codex CLI:
codex-cli 0.107.0
- Platform: macOS 26.3.1 (25D2128)
- Date observed: 2026-03-10
Notes
This appears to be runtime credential cache invalidation rather than OAuth login failure. A post-login cache refresh or MCP client reinitialization would likely resolve it.
Summary
After re-authenticating an OAuth-enabled MCP server, the currently running Codex agent/session can continue using a stale refresh token and still fail MCP initialization with
invalid_grantuntil the app/session is restarted.Expected behavior
After successful
codex mcp login <server>, MCP handshakes in the active session should use fresh credentials immediately (or the runtime should force re-init of auth state).Observed behavior
codex mcp login <server>reports success.OAuth token refresh failed: invalid_grant: Invalid or expired refresh tokenSteps to reproduce
invalid_grantfailure.codex mcp login <server>and complete OAuth successfully.invalid_grantuntil restart/new session.Environment
codex-cli 0.107.0Notes
This appears to be runtime credential cache invalidation rather than OAuth login failure. A post-login cache refresh or MCP client reinitialization would likely resolve it.