fix(ocm): keep the local switch reachable and correct older-Manager status docs

This commit is contained in:
Chris Scott committed 2026-10-07 20:00:20 -04:00
1 parent f67a48b728
commit 2d7d9d661d
2 files changed
+16 -4

No files matched your search

+2 -1
View File
@@ -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`:
+14 -3
View File
@@ -24,15 +24,24 @@ const LOCAL_CATEGORY = 'Local'
export async function runOcmSwitch(context: Context, deps: OcmSwitchDeps): Promise<void> {
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({