diff --git a/src/main/opencode/opencode-model-startup-plan.ts b/src/main/opencode/opencode-model-startup-plan.ts index ffdeb02d167..84b0599ce88 100644 --- a/src/main/opencode/opencode-model-startup-plan.ts +++ b/src/main/opencode/opencode-model-startup-plan.ts @@ -24,8 +24,6 @@ type StartupScope = { inputs: AgentStartupPlanInputs cwd: string isWsl?: boolean - /** TEMPORARY parity: the platform main checked this model on, when it differs. */ - modelCheckPlatform?: NodeJS.Platform hostIdentity?: string signal?: AbortSignal } @@ -51,20 +49,20 @@ export async function prepareOpenCodeModelStartupInputs( if (typeof model !== 'string' || model.trim().length === 0) { refuseModel() } - const platform = options.modelCheckPlatform ?? inputs.platform if ( Object.entries(inputs.sessionOptions ?? {}).some( ([key, value]) => key !== 'model' && value !== undefined ) || inputs.isRemote || options.isWsl || - platform !== process.platform || + inputs.platform !== process.platform || options.signal?.aborted ) { refuseModel() } const command = - inputs.cmdOverrides.opencode || getTuiAgentLaunchCommand(TUI_AGENT_CONFIG.opencode, platform) + inputs.cmdOverrides.opencode || + getTuiAgentLaunchCommand(TUI_AGENT_CONFIG.opencode, inputs.platform) const env: Record = {} for (const [key, value] of Object.entries({ ...process.env, ...inputs.agentEnv })) { if (value !== undefined) { diff --git a/src/main/runtime/agent-launch-scope-runtime.ts b/src/main/runtime/agent-launch-scope-runtime.ts index 4edcfedfaa7..fe16ea74cb5 100644 --- a/src/main/runtime/agent-launch-scope-runtime.ts +++ b/src/main/runtime/agent-launch-scope-runtime.ts @@ -69,22 +69,6 @@ export function agentLaunchProjectRuntime( return pathDecides ? undefined : runtime } -/** TEMPORARY parity: main checked an OpenCode model on the platform it quoted for, which in a - * `\\wsl$` repo not set to WSL was the Windows host. */ -export function openCodeModelCheckPlatform( - store: LaunchScopeRuntimeStore, - scope: TerminalWorkspaceLaunchScope, - platform: NodeJS.Platform -): NodeJS.Platform { - return scope.repo && !scope.connectionId && isWslUncPath(scope.path) - ? executionRuntimePlatform( - resolveLocalProjectRuntimeForWorktreeId(store, scope.id), - undefined, - process.platform - ) - : platform -} - /** The one runtime fact for an agent launched into this workspace. Throws, under * `PROJECT_RUNTIME_REPAIR_REQUIRED_CODE` and in the settings page's words, when its runtime needs * repair. */ diff --git a/src/main/runtime/opencode-wsl-folder-launch-host.test.ts b/src/main/runtime/opencode-wsl-folder-launch-host.test.ts index ad38c368385..32e8293a7d6 100644 --- a/src/main/runtime/opencode-wsl-folder-launch-host.test.ts +++ b/src/main/runtime/opencode-wsl-folder-launch-host.test.ts @@ -86,12 +86,13 @@ it('refuses an agent whose WSL distro is gone, under its own code', async () => expect(response).toMatchObject({ error: { code: PROJECT_RUNTIME_REPAIR_REQUIRED_CODE, message } }) }) -// TEMPORARY parity: in a `\\wsl$` repo set to Windows host, OpenCode's model is checked on Windows, -// as on main; its command is still written for Linux, where it runs. -it('checks an OpenCode model on Windows in a WSL-share repo set to Windows host', async () => { +// OpenCode runs in WSL in a `\\wsl$` repo, where Orca can't verify a model yet, so picking one is +// refused rather than checked on Windows. +it('refuses an OpenCode model in a WSL-share repo set to Windows host', async () => { const shareScope = { ...scope, id: 's', path: share.path, repo: share, folderWorkspace: null } Object.assign(runtime, { resolveTerminalWorkspaceLaunchScope: async () => shareScope }) const request = { clientOperationId, worktree: 'id:s', agent: 'opencode' } as const - await runtime.createAgentSession({ ...request, launchPreferences: { model: 'm' } }) - expect(spawned()).toEqual(['linux']) + const picked = runtime.createAgentSession({ ...request, launchPreferences: { model: 'm' } }) + await expect(picked).rejects.toThrow('cannot verify this OpenCode') + expect(spawned()).toEqual([]) }) diff --git a/src/main/runtime/orca-runtime-create-agent-session.ts b/src/main/runtime/orca-runtime-create-agent-session.ts index 0d0e2500912..a74335fe285 100644 --- a/src/main/runtime/orca-runtime-create-agent-session.ts +++ b/src/main/runtime/orca-runtime-create-agent-session.ts @@ -14,7 +14,6 @@ import { createHash } from 'node:crypto' import { isTuiAgentEnabled } from '../../shared/tui-agent-selection' import { resolveAgentStartupPlanInputs } from '../../shared/agent-startup-plan-inputs' import { agentLaunchQuotingShell } from '../../shared/agent-launch-runtime' -import { openCodeModelCheckPlatform } from './agent-launch-scope-runtime' import { buildExecutionHostAgentStartupPlan } from '../opencode/opencode-model-startup-plan' import type { RuntimeTerminalCreate } from '../../shared/runtime-types' import type { @@ -147,11 +146,6 @@ export class OrcaRuntimeWithCreateAgentSession extends OrcaRuntimeWithGetAgentSe }) const startup = await buildExecutionHostAgentStartupPlan({ inputs: startupArgs, - modelCheckPlatform: openCodeModelCheckPlatform( - this.store!, - workspace, - launchRuntime.platform - ), cwd: startupCwd ?? workspace.path, prompt: request.prompt ?? '', promptDelivery: request.promptDelivery, diff --git a/src/main/runtime/runtime-agent-terminal-startup.ts b/src/main/runtime/runtime-agent-terminal-startup.ts index 8c1ae331464..7e57f9c8017 100644 --- a/src/main/runtime/runtime-agent-terminal-startup.ts +++ b/src/main/runtime/runtime-agent-terminal-startup.ts @@ -27,7 +27,6 @@ import { import { agentLaunchPlatformForScope, agentLaunchProjectRuntime, - openCodeModelCheckPlatform, resolveAgentLaunchRuntime } from './agent-launch-scope-runtime' import { resolveQoderTerminalCommand } from './qoder-terminal-command-resolution' @@ -182,9 +181,6 @@ async function buildRuntimeAgentTerminalStartupOptions( shell: agentLaunchQuotingShell(runtime), sessionOptions: host.toSessionOptions(opts.launchPreferences) }), - ...(host.store - ? { modelCheckPlatform: openCodeModelCheckPlatform(host.store, workspace, runtime.platform) } - : {}), prompt: opts.startupPrompt ?? '', cwd: resolveTerminalStartupCwd(workspace.path, opts.cwd) ?? workspace.path, hostIdentity: host.hostIdentity,