[rmcp-client] Preserve refresh tokens omitted by refresh responses - #26520
Closed
anp-oai wants to merge 3 commits into
Closed
[rmcp-client] Preserve refresh tokens omitted by refresh responses#26520anp-oai wants to merge 3 commits into
anp-oai wants to merge 3 commits into
Conversation
Contributor
Author
|
handing this off for now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Some OAuth providers successfully refresh an access token without returning a new
refresh_token. Codex should treat that omission as keeping the existing refresh token, not revoking it.User-visible behavior
Before
Codex could erase a still-valid existing refresh token when a provider omitted
refresh_tokenfrom a successful refresh response. A later refresh would then fail and force the user through a fresh login.After
Codex preserves the existing refresh token when a successful response omits it. If the provider explicitly returns a replacement, that replacement wins. The preserved or replaced token remains available across repeated refreshes and client recreation.
Implementation
Add a narrow RMCP credential store that carries forward only an omitted refresh token before the running authorization manager updates its state. Codex persistence therefore observes the same corrected credentials.
Deterministic integration coverage exercises persistence across client recreation and three refreshes on one live client: omission, explicit replacement, then another omission using and preserving the replacement. It also asserts exact OAuth and MCP request counts.
Deferred scope
This PR does not change pre-existing concurrent persistor rollback behavior or future reauthorization and scope-upgrade semantics.
Validation not covered by CI
just test -p codex-rmcp-client omitted_refresh_token_preserves_running_manager_state -- --nocapturejust test -p codex-rmcp-client --test streamable_http_oauth_startup