#18290 · @Protocol-zero-0 · opened Mar 19, 2026 at 9:40 PM UTC · last updated Mar 21, 2026 at 8:15 PM UTC

fix(ui): wrap fork dialog with PlatformProvider context

appfix
79
+1364 files

Score breakdown

Impact

9.0

Clarity

9.0

Urgency

9.0

Ease Of Review

9.0

Guidelines

8.0

Readiness

9.0

Size

9.0

Trust

6.0

Traction

5.0

Summary

This PR fixes a critical crash when using the Fork feature by correctly providing the PlatformProvider context to the dialog. It's a small, focused fix addressing a severe regression.

Open in GitHub

Description

Issue for this PR

Closes #18250

Type of change

  • [x] Bug fix
  • [ ] New feature
  • [ ] Refactor / code improvement
  • [ ] Documentation

What does this PR do?

Clicking the Fork button crashes with Platform context must be used within a context provider because dialog.show() uses createRoot() to render the dialog, which creates a new SolidJS root that doesn't inherit parent context providers.

The fix wraps <DialogFork /> with <PlatformProvider> in the fork command's onSelect handler, passing the current platform value from the parent scope. This is the same pattern used elsewhere in the codebase when rendering components in isolated roots.

How did you verify your code works?

  • Confirmed dialog.show() uses createRoot() which creates an isolated context
  • Verified PlatformProvider / usePlatform follow the createSimpleContext pattern
  • Change is minimal (8 lines) and follows existing patterns in the codebase

Checklist

  • [x] I have tested my changes locally
  • [x] I have not included unrelated changes in this PR

Made with Cursor

Linked Issues

#18250 [DESKTOP/WebUI] Forking not possible

View issue

Comments

PR comments

Protocol-zero-0

Follow-up update: I aligned the remaining call sites on this branch with the generated SDK signature ( instead of the old key), refreshed local dependencies, and re-ran the full repo typecheck successfully before pushing. This should clear the current typecheck failure once CI finishes rerunning.

Protocol-zero-0

Follow-up update: I aligned the remaining auth.set call sites on this branch with the generated SDK signature, refreshed local dependencies, and re-ran the full repo typecheck successfully before pushing. CI is rerunning now, and this should clear the current typecheck failure once the new checks finish.

Protocol-zero-0

Another follow-up: I narrowed the compatibility fix to the app-side call sites only. The branch now keeps the runtime body payload, isolates the current mixed auth.set typings in the app client, and passes the full repo typecheck locally before push.

Changed Files

packages/app/src/components/dialog-connect-provider.tsx

+22
@@ -383,11 +383,11 @@ export function DialogConnectProvider(props: { provider: string }) {
setFormStore("error", undefined)
await globalSDK.client.auth.set({
providerID: props.provider,
auth: {
body: {
type: "api",
key: apiKey,
},
})
} as any)
await complete()
}

packages/app/src/components/dialog-custom-provider.tsx

+22
@@ -131,11 +131,11 @@ export function DialogCustomProvider(props: Props) {
const auth = result.key
? globalSDK.client.auth.set({
providerID: result.providerID,
auth: {
body: {
type: "api",
key: result.key,
},
})
} as any)
: Promise.resolve()
auth

packages/app/src/pages/session/use-session-commands.tsx

+81
@@ -15,6 +15,7 @@ import { DialogSelectFile } from "@/components/dialog-select-file"
import { DialogSelectModel } from "@/components/dialog-select-model"
import { DialogSelectMcp } from "@/components/dialog-select-mcp"
import { DialogFork } from "@/components/dialog-fork"
import { PlatformProvider, usePlatform } from "@/context/platform"
import { showToast } from "@opencode-ai/ui/toast"
import { findLast } from "@opencode-ai/util/array"
import { createSessionTabs } from "@/pages/session/helpers"
@@ -49,6 +50,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
const terminal = useTerminal()
const layout = useLayout()
const navigate = useNavigate()
const platform = usePlatform()
const { params, tabs, view } = useSessionLayout()
const info = () => {
@@ -487,7 +489,12 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
description: language.t("command.session.fork.description"),
slash: "fork",
disabled: !params.id || visibleUserMessages().length === 0,
onSelect: () => dialog.show(() => <DialogFork />),
onSelect: () =>
dialog.show(() => (
<Platf

packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx

+11
@@ -265,7 +265,7 @@ function ApiMethod(props: ApiMethodProps) {
if (!value) return
await sdk.client.auth.set({
providerID: props.providerID,
auth: {
body: {
type: "api",
key: value,
},