fix: auto-save config when OAuth completes for openai-codex/claude-code providers #10820
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.
Related GitHub Issue
Closes: #10819
Roo Code Task Context (Optional)
This PR was created by Roomote to address issue #10819. Feedback and guidance are welcome.
Description
When using OAuth-based providers (openai-codex or claude-code) in the welcome screen, users would:
Root cause: After OAuth completes,
postStateToWebview()in the backend overwrites the local webviewapiConfigurationwith the backend state. However, at this point the backend state does not haveapiProvider: "openai-codex"set yet because the user had not clicked Finish to save it. This causescheckExistKey()to returnfalse, keepingshowWelcome = true.Solution: Add
useEffecthooks inWelcomeViewProvider.tsxthat detect when OAuth completes for these providers and automatically save the configuration. This follows the existing pattern already used for Roo provider authentication (lines 53-76 in the same file).Key implementation details:
selectedProvider === "custom"ANDapiConfiguration?.apiProvider === "openai-codex"ANDopenAiCodexIsAuthenticatedupsertApiConfigurationmessage to save the configclaude-codeprovider withclaudeCodeIsAuthenticatedcheckExistKey()to returntrueand dismiss the welcome screenTest Procedure
Previously, step 4 would fail - the welcome screen would remain visible even after OAuth succeeded.
Pre-Submission Checklist
Screenshots / Videos
N/A - This is a logic fix that affects the OAuth flow, not a visual change.
Documentation Updates
Additional Notes
This fix also applies to the
claude-codeprovider which uses the same OAuth pattern. The implementation mirrors the existing Roo provider authentication handling in the same file.Get in Touch
@roomote
Important
Adds
useEffecthooks inWelcomeViewProvider.tsxto auto-save configuration when OAuth completes foropenai-codexandclaude-code, dismissing the welcome screen.useEffecthooks inWelcomeViewProvider.tsxto auto-save config when OAuth completes foropenai-codexandclaude-codeproviders.selectedProvider === "custom",apiConfiguration?.apiProvider, and authentication status to trigger config save.upsertApiConfigurationmessage to save config, dismissing welcome screen.openai-codexwithopenAiCodexIsAuthenticated.claude-codewithclaudeCodeIsAuthenticated.This description was created by
for 6fbe59e. You can customize this summary. It will automatically update as commits are pushed.