Repository navigation
fix(mcp): preserve authorized sessions during login - #122129
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
obviyus
marked this pull request as ready for review
August 11, 2026 16:11
obviyus
enabled auto-merge (squash)
August 11, 2026 16:14
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 12, 2026
Follow-up to openclaw#122115: startMcpOAuthAuthorization suppressed stored tokens unconditionally, forcing a browser authorization on every mcp login even with a valid session. Suppression is again gated on a recorded authorization-required challenge; start returns a closed authorized|redirect result and the CLI early-returns the already-logged-in outcome. Co-authored-by: Ayaan Zaidi <[email protected]>
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.
What Problem This Solves
#122115 extracted the OAuth login dance into
startMcpOAuthAuthorization, but setsuppressStoredTokens: trueunconditionally — soopenclaw mcp login <server>with a valid stored session now forces a browser authorization instead of completing immediately. Default-path regression relative to pre-#122115 behavior (main suppressed stored tokens only when a recorded challenge required interactive auth).Why This Change Was Made
Restores the exact pre-refactor condition:
suppressStoredTokensonly when the store'spendingAuthorizationChallengerecordsrequiresAuthorization.startMcpOAuthAuthorizationnow returns a closed result —{status:"authorized"}(valid/refreshable session, no browser, store untouched) or{status:"redirect", authorizationUrl, redirectUrl, state}— and the CLI early-returns the already-logged-in outcome onauthorized.User Impact
openclaw mcp loginwith a valid session completes without opening a browser, as before #122115. Challenge-recorded and cold-login paths unchanged.Evidence
startreturnsauthorized, store row unchanged) and CLI loopback (no browser flow for valid session); the coordinator test fails pre-fix (returnsredirect).node scripts/run-vitest.mjs src/agents/mcp-oauth src/cli/mcp-cli— 61 passed.