fix(site): auto-select MCP server after successful OAuth - #28155
fix(site): auto-select MCP server after successful OAuth#28155ibetitsmike wants to merge 3 commits into
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cee56c1c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83894d4116
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
When an MCP server requires OAuth, the chat MCP picker showed an "Auth" button, and after completing the popup flow the user still had to reopen the picker and flip the enable switch manually. Clicking Auth already expresses the intent to use the server, so the extra step was unnecessary.
This change auto-selects the server when its OAuth popup reports success.
AgentChatInputtracks the flow it started as{popup, serverID}; amcp-oauth2-completepostMessage changes the selection only when it comes from that popup and names that server, and only for a server that exists in the fetched list, is enabled, and is not already selected. The correlation deliberately survives popup close: coderd's callback page posts the message and then closes itself, so the close poll can observe the closed popup before the queued message is dispatched. Selection persistence is unchanged (parent callbacks on the chat page and create form store it as before), and failed or aborted auth flows post no message, so they cannot select anything.Covered by five Storybook interaction stories: successful auto-enable through a real menu-open and Auth click with a mocked popup, auto-enable when the popup closes before the message is dispatched, no duplicate selection, unsolicited-message rejection (no Auth click), and mismatched-server rejection (completion names a different server than the one authenticated). Each behavior story was verified red-green against the code it guards.
Dogfood UAT ran with a full OAuth round trip (local OAuth2 stub) on both the chat page and the create form, plus aborted-popup, manual toggle, force_on, and disconnect regression checks; all passed. Codex review ran three rounds; both findings (gate selection on the initiating popup, exercise the real Auth interaction) are fixed and resolved, with a clean verdict on the final head.