[Bug]: Sidebar shows "pending" for all agents when TUI attaches to a remote opencode serve (tui-state.json is local-file-only)

Author: haotianfeiCreated Sep 4, 2026Updated Sep 13, 2026
Labelsbug

What happened, and what did you expect?

When the TUI runs on machine A and attaches to opencode serve on machine B, the OMO-Slim sidebar permanently shows the fallback agent list with pending instead of resolved models (screenshot attached below). Expected: sidebar shows each agent's configured model, as it does when the TUI and server share a filesystem.

Root cause (from source analysis):

  • The server-side plugin writes agent models to the server's local file: $XDG_DATA_HOME/opencode/storage/oh-my-opencode-slim/<sha256(resolve(projectDir))[:12]>/tui-state.json (src/tui-state.ts, called from the config hook via recordTuiAgentModels).
  • The TUI plugin polls that path on the client's local filesystem every 1s and renders snapshot.agentModels[agentName] ?? 'pending' (src/tui.ts).
  • In remote-attach mode the two processes don't share a filesystem, so the client always reads an empty snapshot → fallback agent list (FALLBACK_SIDEBAR_AGENTS, note the orchestrator row disappears) with every model column showing pending.
  • Notably the project-scope hash matches on both ends (in attach mode api.state.path.directory is the server-reported path string), so the only gap is file visibility, not keying.

Steps to reproduce

  1. On machine B: opencode serve --hostname 0.0.0.0 --port 4096 inside a project directory
  2. On machine A: opencode attach http://B:4096 and open any session in that project
  3. Observe the OMO-Slim sidebar: explorer/librarian/oracle/designer/fixer all show pending
  4. On machine B itself, the same project's sidebar correctly shows model names (state file exists in B's $XDG_DATA_HOME)

oh-my-opencode.json

jsonc
// active preset: alibaba-token-plan-cn — orchestrator/explorer/librarian/designer/fixer -> alibaba-token-plan-cn/qwen3.8-flash; oracle -> alibaba-token-plan-cn/deepseek-v4-pro; variants: orchestrator=xhigh, explorer=low, librarian=high, oracle=high, fixer=high

OpenCode version

1.18.18(server 与 TUI 客户端同版本)

oh-my-opencode-slim version

2.2.18

Operating system

Fedora 44 Linux (both server and client)

Logs, screenshots, or extra context

bash
Proposed fix options:
(A) In `src/tui.ts`, when the local snapshot is empty, fall back to fetching agent models through the TUI plugin's existing `client` SDK channel (e.g. `/config` — per discussion #259 the merged plugin agent config is visible in serve mode). This keeps behavior correct without any filesystem sharing.
(B) At minimum, document the limitation and the workaround: sync or bind-mount the server's `storage/oh-my-opencode-slim/` directory onto the client's `$XDG_DATA_HOME` equivalent. The atomic temp+rename writes plus `.lock` files are already tolerant of partial syncs (the reader falls back to an empty snapshot on parse errors).
(C) Related: #1122 shows the v2 compatibility shim hardcodes `http://localhost:4096/`; a proper remote-server story may want the actual server URL plumbed into the TUI plugin as well.

Source: alvinunreal/oh-my-opencode-slim