GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(app): recover MCP sign-in and provider form steps that could get stuck by Hona · Pull Request #62102 · anomalyco/opencode Conversation
| ||||||||||||||||||||||||||||
| Dispose from | Effects |
|---|---|
waiting |
deadline.clear, poll.abort, cancel |
waiting with pasteAccepted |
deadline.clear, poll.abort, refresh (no cancel) |
submitting |
deadline.clear, poll.abort, submit.abort, cancel |
completing |
sync.clear |
failed |
none |
createMcpSignIn owns the deadline, poll and sync timers and one AbortController each for oauth.status and oauth.complete; results carry pollAttempt / submitAttempt / syncAttempt.onDone is split into onSync (reload the lists) and onClose.{ value, error, failed, submitting } store and the closure timer, deadline, disposed, settled.form-machine.ts, held inside ProviderConnectState as { status: "form"; form }:
type ProviderFormStep = | { kind: "external"; index; field; browser: unopened | opening{attempt, unlocked} | opened | failed } | { kind: "multiselect"; index; field; picked; customText } | { kind: "choice"; index; field; choice: none | preset | custom; error } | { kind: "text"; index; field; text; error }
formAnswer: hidden fields that apply take their default as they are reached, so later when conditions see them. A form with nothing to ask answers itself in select() and never mounts an empty step.external.open → form.open.browser { attempt, browser }. The controller races openBrowser against 5 s; false, a throw or a timeout reports opened: false, which shows the link to copy and enables "I finished".attempt and the form's browser attempt.formStore, onMount(() => advance({})), openLink and providerFormDefaults. AuthFormView now renders connect().form.| Before | After | |
|---|---|---|
| MCP lists fail to reload after sign-in | ![]() |
![]() |
| Browser does not open on a form step | ![]() |
![]() |
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" stroke="currentColor"> <style> .spin{transform-origin:40px 30px;animation:spin 1s linear infinite,hide 6s steps(1) infinite} .err{animation:show 6s steps(1) infinite} @keyframes spin{to{transform:rotate(360deg)}} @keyframes hide{0%{opacity:1}50%{opacity:0}} @keyframes show{0%{opacity:0}50%{opacity:1}} @media (prefers-reduced-motion:reduce){.spin{animation:none;opacity:0}.err{animation:none;opacity:1}} </style> <rect x="20" y="8" width="200" height="56" rx="2" stroke-opacity=".4"/> <line x1="32" y1="18" x2="120" y2="18" stroke-opacity=".6" stroke-width="3"/> <g class="spin"><circle cx="40" cy="30" r="5" stroke-opacity=".25" stroke-width="2"/><path d="M40 25a5 5 0 0 1 5 5" stroke-width="2"/></g> <line class="spin" x1="52" y1="30" x2="150" y2="30" stroke-opacity=".4" stroke-width="2" style="animation:hide 6s steps(1) infinite"/> <g class="err"> <line x1="32" y1="30" x2="180" y2="30" stroke-opacity=".8" stroke-width="2"/> <rect x="32" y="40" width="44" height="14" rx="2" stroke-opacity=".7"/> <line x1="40" y1="47" x2="68" y2="47" stroke-opacity=".7" stroke-width="2"/> </g> </svg>
form.browser.stop effect or separate external.timed-out event: the controller bounds openBrowser with a race and reports one opened: false result; stale results are rejected by attempt.ProviderFormState has no disposed variant; the connect machine owns the form's lifetime.submit.succeeded → refresh rows: the driver aborts oauth.complete whenever the machine leaves submitting, so those results never arrive.completing (nothing left to do in the browser).packages/ui/src/overlays/mcp-sign-in/machine.test.ts, form-machine.test.ts, and form composition cases in machine.test.ts.mcp-workspace-toggle.spec.ts: a pasted sign-in from the popover and the dialog. Enter twice sends one oauth.complete, a failed reload shows Try again, and the retry closes the dialog. It fails on dev.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The sign-in and form state machines look sound. I couldn't run the web app or the new Playwright spec here (no browser available). The unit tests in both packages pass, and both packages type-check clean with tsc --noEmit. Reading the base code confirms each stuck state you describe, and each one now has a way out: a stale or late result is rejected by its attempt number, closing the dialog cancels only an attempt nobody has finished, and a failed reload can be retried.
Public API is unchanged. Only internal component props (onDone → onSync/onClose) and translation keys change.
One structural point is in the inline comment: the MCP sign-in machine is duplicated byte for byte across app and gui-plugins.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,338 @@ | |||
| /** Delay between OAuth status polls while the attempt is pending or the server is unreachable. */ | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This file is byte-for-byte the same as packages/app/src/providers/connect/mcp-sign-in-machine.ts, and so is its test. The roughly 150-line effect driver in McpSignInDialog also nearly mirrors DialogMcpSignIn. Two copies of a state machine tend to drift when one gets fixed. gui-plugins can't import the app, but it already depends on @opencode/ui and @opencode/session-ui. Could the machine, and ideally the dialog, live in one of those so both callers share a single copy?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Moved the machine and its test into one copy in @opencode/ui (src/overlays/mcp-sign-in/machine.ts, exported as @opencode/ui/mcp-sign-in/machine like line-comment/machine), and shared the driver as createMcpSignIn (@opencode/ui/mcp-sign-in) with the SDK calls, platform and error formatting injected. The dialog markup stays in each package: its copy lives in the app catalog (dialog.mcp.signIn.*) and the plugin catalog (mcp.signIn.*), each with its own translations, and moving the dialog into ui would move that copy and every locale into the ui catalog.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The move works, and keeping the dialog markup in each package is the right call. The bot's concern was two copies of the state machine drifting apart, and that's fixed now that the machine and its effect driver exist in one place. The dialogs that are still separate are thin views over createMcpSignIn, so the only thing that can differ between them is copy. Moving them into @opencode/ui would also move both catalogs' strings and every locale into the ui catalog, which isn't worth it.
I checked this on pr/head (56785d090) in a temporary worktree:
packages/ui/package.json exports ./mcp-sign-in and ./mcp-sign-in/machine, next to ./line-comment/machine.mcp-sign-in-machine.ts copies and their tests are gone from both packages/app/src/providers/connect/ and packages/gui-plugins/src/details/.app/.../mcp-sign-in.tsx and gui-plugins/.../server-panel.tsx both import createMcpSignIn from @opencode/ui/mcp-sign-in.bun test src/overlays/mcp-sign-in in ui: 12 pass, 0 fail.tsc --noEmit reports no errors in ui, app or gui-plugins.I didn't run the e2e specs or try the dialogs by hand.
The local pr-62102 checkout is still on the older d6c956978, which had the duplicated copies. I didn't change it, and I left the existing uncommitted bun.lock change alone. I removed the temporary worktree afterwards.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0ff4956 to
56785d0
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The duplicated MCP sign-in machine is resolved. It now lives once in @opencode/ui, along with its test and driver, and each dialog keeps only its markup, wording and SDK calls. The new commits look sound.
Tests and type checks pass: the ui sign-in machine tests and the app connect tests, plus tsc --noEmit in ui, app and gui-plugins. I couldn't run the Playwright spec or the web app here (no browser available).
Public API is unchanged; the two new @opencode/ui/mcp-sign-in entry points are internal to the workspace.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
56785d0 to
f19c810
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No changes since my last review: the new head rebases the same commits onto a newer dev, and git range-diff shows every commit identical. Tests and type checks pass again on the new base: the ui sign-in machine tests, the app connect tests, and tsc --noEmit in ui, app and gui-plugins. Public API is unchanged, and there are no new concerns.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.