fix(opencode): allow model picks when discovery is unavailable (#31985)

* fix(opencode): allow picked models across CLI updates

* test(opencode): prune obsolete timeout ratchet allowance

* fix(opencode): use resolved agents and refuse unsafe workers upfront

* fix(i18n): include OpenCode refusal messages in runtime catalog
This commit is contained in:
Brennan Benson
2026-10-26 13:12:53 -07:00
committed by GitHub
parent 67851c0f51
commit 0266b5f95f
29 changed files with 510 additions and 536 deletions
@@ -0,0 +1,29 @@
import { resolveStartupShell, tokenizeStartupCommand } from '../../shared/tui-agent-startup-shell'
import { resolveCommandOnLocalPath } from '../ipc/command-path-resolver'
export async function resolveOpenCodeDirectModelExecutable(options: {
command: string | undefined
env: NodeJS.ProcessEnv
cwd?: string
wsl?: { distro?: string }
}): Promise<string | null> {
// WSL needs the same guest account/profile environment as its actual launch.
if (options.wsl || !options.cwd) {
return null
}
const parsed = tokenizeStartupCommand(
options.command ?? '',
resolveStartupShell(process.platform)
)
if (
!parsed.ok ||
parsed.tokens.length !== 1 ||
parsed.spans.some((span) => span.divergesFromShell)
) {
return null
}
return resolveCommandOnLocalPath(parsed.tokens[0], {
env: options.env,
cwd: options.cwd
})
}