Repository navigation
opencode harness: t3-code MCP server intermittently absent from Code Mode execute catalog mid-session #15736
Description
Activity
Note
Grok responding on behalf of Julius.
Triage
Thanks for the careful report, @Sunsilkk! The notice text and the flapping timeline were really useful for tracing this.
What I found
- Not a duplicate of [Bug]: Codex turn sees partial MCP tool catalog during server startup #13437. That one is a Codex first-turn startup race, where optional MCP servers get dropped while they're still starting. Here, the
t3-code-<thread>server was already connected and working, then left OpenCode's Code Mode catalog on a later turn. - Where the notice comes from. OpenCode emits "The Code Mode tool catalog has changed" itself whenever the visible inventory changes. An empty
searchresult fororchestrator_capabilitiesmeans the namespace really was unregistered.browserandopencodeare OpenCode's own namespaces, so the execute runtime itself stayed up. - Also expected:
T3_ACP_MCP_NODEbeing unset. It only covers the ACP terminal fallback. - How T3 registers the server.
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.tsregisters it once per directory inprepareTurn. I found two paths that can remove it mid-session.- Event-stream reconnect. A reconnect resets every thread's remembered MCP registration (
state.mcp = undefined) without removing the live server. The next turn callsmcp.addagain, and OpenCode'sreplaceServerdisposes the existing client before the new one has tools. That drops the namespace until the reconnect finishes. If the add takes longer than the 5 sINVENTORY_TIMEOUT, it logsCould not add T3 Code's MCP server to OpenCodeand leaves the registration unset, so the next turn tears the server down again. Repeated cycles would match the present, absent, present flapping you saw. - Transport close. OpenCode clears a server's tools when its transport closes. It only reconnects when a session-expired response comes back, such as the 404 a restarted T3 process returns for an old in-memory session id. After any other close, the namespace stays gone, and T3 won't re-add it because it still thinks the server is registered.
- Event-stream reconnect. A reconnect resets every thread's remembered MCP registration (
- Less likely: credential expiry. The token is refreshed on every provider turn.
Likely fix area
-
Option 1: avoid replacing a live server. After an event-stream reconnect, check what OpenCode actually has registered instead of resetting and calling
mcp.addagain. -
Option 2: re-register when the server disappears. Detect that the
t3-code-*server is missing, for example by checking the inventory each turn, and register it again rather than trusting the remembered state. -
Option 3: handle a slow add more gracefully. When the 5 s add timeout hits, avoid tearing the server down again on the following turn.
-
Logs that would tell the paths apart:
- From T3, around a drop:
Lost the OpenCode event stream; reconnecting.orCould not add T3 Code's MCP server to OpenCode. - From OpenCode, for the
t3-code-*server:mcp session expired, reconnectingorConnection closed.
If you can share those lines (redacted), please do.
- From T3, around a drop:
A maintainer will decide on the fix direction.
- Not a duplicate of [Bug]: Codex turn sees partial MCP tool catalog during server startup #13437. That one is a Codex first-turn startup race, where optional MCP servers get dropped while they're still starting. Here, the
- addedbugSomething is broken or behaving incorrectly.Something is broken or behaving incorrectly.via-triageFiled through npx t3 triageFiled through npx t3 triage
on Oct 4, 2026
Summary
The
t3-codeMCP server (t3-code-b4757dec-c97d-45b3-9c6c-194da6d88025, ~72 tools includingdelegate_task/task_status/orchestrator_capabilities) intermittently disappears from the Code Modeexecutetool catalog mid-session when running in T3 Code through the OpenCode harness (opencode-go/muse-spark-1.3-contributor). Calls then fail withUnknown tool, breaking in-flight orchestration with no config change in between.Environment
~/.config/opencode/opencode.jsonchas"mcp": {}, no local.opencode/overrides; the t3-code server is injected by the harness.Reproduction
execute+search(...)to discover T3 tools (e.g.delegate_task,task_status,orchestrator_capabilities).tools["t3-code-b4757dec-c97d-45b3-9c6c-194da6d88025"].orchestrator_capabilities()anddelegate_task(providercodex, modelgpt-6.1-sol) several times across turns.browser,cloudflare*,opencode— not3-code-*server.search({query: "delegate_task"})returns only unrelated Cloudflare/browser tools;search({query: "orchestrator_capabilities"})returns 0 items.Unknown tool 't3-code-b4757dec-c97d-45b3-9c6c-194da6d88025.task_status'. Did you mean tools.opencode.list_mcp_resources?Expected Behavior
Once attached, the
t3-codeMCP server should stay present in theexecutecatalog for the lifetime of the thread, or its removal should come with an explicit reason/actionable error instead of a silent catalog swap.Actual Behavior
The server flaps in and out of the catalog across turns within a single thread. While absent,
delegate_task/task_statusare uncallable, so delegated Codex child tasks can neither be spawned nor have their terminal results read (notifications about terminal task state arrive but are unactionable).T3_ACP_MCP_NODEis unset in this environment, so the ACP fallback transport is unavailable.Additional Context
executecatalog losing an already-working server mid-session.