Repository navigation
Description
What happens
Inside an Orca terminal running opencode, the agent in use flips from the configured default to
build, and it never recovers on its own.
Measured status lines inside the Orca terminal, opencode v2.2.7:
| moment | status line |
|---|---|
config intact (default_agent: "ORACLE", agent defined only in ~/.config/opencode/agents/ORACLE.md) |
ORACLE · qwen3.8-27b-nvfp4 SGLang · medium |
after the config folder is rewritten (agents/ deleted and the tree copied back) |
Build · Big Pickle OpenCode |
It loses the model too (local SGLang → built-in default), and restoring agents/ORACLE.md
afterwards does not bring the agent back.
It does not happen outside Orca
Same machine, same config, same act, plain opencode in a tmux session:
| step | status line |
|---|---|
| config intact | ORACLE · qwen3.8-27b-nvfp4 SGLang |
rm agents/ORACLE.md + touch opencode.json |
unchanged |
rm -rf agents/ |
unchanged |
agents/ deleted and opencode.json replaced (new inode) and the tree re-extracted |
unchanged |
So the trigger needs Orca.
What Orca adds (read from the live process)
cmdline : /usr/local/bin/opencode serve --service
env : ORCA_OPENCODE_PLUGIN_API=v2
ORCA_AGENT_HOOK_ENDPOINT=/root/.config/orca/agent-hooks/endpoint.env
ORCA_AGENT_HOOK_TOKEN=…
ORCA_WORKTREE_ID=…::/work/proj
ORCA_TERMINAL_HANDLE=term_…
ORCA_APP_VERSION=1.4.255 (also reproduced on 1.4.256)
The terminal does not run a self-contained opencode: it attaches to a per-worktree
opencode serve --service that Orca starts and wraps with its plugin/hook layer. Hypothesis,
consistent with every observation: that service pins the agent for the session; when the config is
rewritten the pinned agent momentarily does not exist, the service falls back to build, and —
unlike a plain TUI, which re-resolves default_agent — it never re-resolves.
Minimal reproduction
mkdir -p ~/.config/opencode/agents
printf '{"$schema":"https://opencode.ai/config.json","default_agent":"ORACLE"}\n' \
> ~/.config/opencode/opencode.json
printf -- '---\ndescription: stand-in\n---\n\nYou are ORACLE.\n' \
> ~/.config/opencode/agents/ORACLE.md
# 1. open a worktree in Orca whose agent is opencode, and open its terminal
# status line: ORACLE · <model>
# 2. rewrite the config folder while that terminal is open
rm -rf ~/.config/opencode/agents && mkdir -p ~/.config/opencode/agents
printf -- '---\ndescription: stand-in\n---\n\nYou are ORACLE.\n' \
> ~/.config/opencode/agents/ORACLE.md
touch ~/.config/opencode/opencode.json
# 3. status line becomes: Build · ... (and stays there)This is not hypothetical: it is what an install-global-style deploy does on every update — two
rsync -a --delete --checksum passes over the live config folder.
Environment
- Orca 1.4.255 and 1.4.256 (both reproduced), Linux x86_64
- opencode v2.2.7, agent defined only in
agents/*.md(the"agents"object inopencode.json
is not read by the v2 schema, so the definition really does depend on that file) - container: Debian bookworm, Orca server headless (
orca serve), config mounted read-only from the
host
What would help
Either the service re-resolving default_agent when a pinned agent disappears, or Orca re-selecting
the agent for a worktree whose pinned agent no longer exists (instead of silently staying on build).
Related upstream: anomalyco/opencode#62002 (default_agent reverts to build after a config rewrite).
Activity
AmethystLiang commentedon Nov 12, 2026
Triage: assigning to Brennan: this is about OpenCode serve session/config handling, which is agent integration.