From 2d7d9d661de83fe3dff60a2e50a327d38d04b3b0 Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Wed, 7 Oct 2026 20:00:20 -0400 Subject: [PATCH] fix(ocm): keep the local switch reachable and correct older-Manager status docs --- ocm-cli/README.md | 3 ++- ocm-cli/src/tui-ocm.ts | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ocm-cli/README.md b/ocm-cli/README.md index 0f88ab20..ab8c567f 100644 --- a/ocm-cli/README.md +++ b/ocm-cli/README.md @@ -174,7 +174,8 @@ attached Manager repo through `ocm`: Both commands need an OpenCode Manager release that exposes `/api/internal/session-goals` and `/api/internal/multi-runs`. An older Manager -answers these requests with `401 Unauthorized`. +answers these requests with `404 Not Found`, and the TUI reports that the +Manager must be upgraded. Enable it in `~/.config/opencode/cli.json`: diff --git a/ocm-cli/src/tui-ocm.ts b/ocm-cli/src/tui-ocm.ts index 97d43365..cc45297d 100644 --- a/ocm-cli/src/tui-ocm.ts +++ b/ocm-cli/src/tui-ocm.ts @@ -24,15 +24,24 @@ const LOCAL_CATEGORY = 'Local' export async function runOcmSwitch(context: Context, deps: OcmSwitchDeps): Promise { try { const auth = await resolveManagerAuth(deps.remote?.managerUrl) - if (!auth.ok) { + if (!auth.ok && !deps.remote) { context.ui.toast.show({ variant: 'error', message: auth.message }) return } - const repos = (await fetchRepos(auth.managerUrl, auth.token)).filter((repo) => repo.cloneStatus === 'ready') + let repos: ManagerRepo[] = [] + if (auth.ok) { + try { + repos = (await fetchRepos(auth.managerUrl, auth.token)).filter((repo) => repo.cloneStatus === 'ready') + } catch (error) { + if (!deps.remote) throw error + } + } const choice = deps.remote ? await chooseFromRemote(context, repos, deps.remote) - : await chooseFromLocal(context, repos, auth.managerUrl, deps.cwd ?? localDirectory(context)) + : auth.ok + ? await chooseFromLocal(context, repos, auth.managerUrl, deps.cwd ?? localDirectory(context)) + : undefined if (!choice) return if (choice.kind === 'local') { @@ -41,6 +50,8 @@ export async function runOcmSwitch(context: Context, deps: OcmSwitchDeps): Promi return } + if (!auth.ok) return + await warmRepoProxy(auth.managerUrl, auth.token, choice.repo.repoId) rememberLastRepo(choice.repo) setPendingWarp({