Skip to content

cli: opencode run --standalone intermittently registers no MCP servers in the session tool pool (~10% of sessions) #65932

In review

Description

@willturner-maker

Summary

In headless runs (opencode run --standalone --format json), roughly 10% of fresh sessions never get their local stdio MCP servers registered into the session tool pool — for the entire session — so every MCP tool call fails with No tool named "<server>_<tool>" is currently available. Please use a tool from the available tool list. while identical sessions minutes apart on the same machine/config work. We hit it at 2/21 sessions in each of two independent benchmark waves; it did not occur in any wave on the 2.3.2-era build.

Environment

  • opencode version: v2.4.1 (opencode --version)
  • OS: Darwin 27.2.0, arm64 (macOS, Apple Silicon)
  • Terminal: Apple_Terminal (TERM=xterm-256color, COLORTERM=truecolor) — but failures happen in detached headless opencode run subprocesses, not in a TUI
  • Shell: /bin/zsh
  • Install/channel: latest (release)
  • Active plugins: an LSP-support plugin is configured in the global config; the affected runs override config via OPENCODE_CONFIG with --standalone and a policy that denies plugin.use, so plugins are not believed to be involved (see config below)

Reproduction

Harness shape (repeated across two waves, ~44 sessions):

  1. A per-session working directory with a neutral AGENTS.md and a sealed config file (passed via OPENCODE_CONFIG, no global config merge): one provider (local OpenAI-compatible endpoint), and exactly three local stdio MCP servers declared under mcp.servers — the three of the davinci-resolve MCP suite:
    • davinci-resolve — {"type": "local", "command": ["<venv>/bin/python", "<install-dir>/src/server.py"]} (Python stdio)
    • davinci-resolve-builtin — {"type": "local", "command": ["/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Applications/ResolveMCP"]} (app-provided stdio binary)
    • davinci-resolve-advanced — {"type": "local", "command": ["/opt/homebrew/opt/node/bin/node", "<install-dir>/bin/davinci-resolve-advanced-mcp.mjs"]} (Node stdio)
      plus policies denying all built-in tools and mcp.use except these three servers.
  2. Launch fresh sessions headless: opencode run --standalone --format json "<brief instructing MCP-only work>", two lanes concurrently (also reproduced with sequential launches).
  3. ~1 in 10 sessions: from the first turn onward, every attempt to call a pool MCP tool emits a tool_use event with state.status: "error" and error text No tool named "<name>" is currently available. Please use a tool from the available tool list. — including attempts using tool names that work in every sibling session. The agent's text output typically reads "the MCP tools aren't connected / are unavailable".
  4. A sibling session launched seconds earlier or later, same directory pattern, same config, same machine, completes normally with the same tools.

Variants observed:

  • Total dropout: none of the three MCP servers present in the pool.
  • Partial dropout: davinci-resolve-advanced (Node) registered normally while davinci-resolve (Python) and davinci-resolve-builtin (Resolve's ResolveMCP binary) were absent all session.
  • The dropout state is stable for the whole session; retrying, waiting, or continuing does not re-register the servers. No server-side log entries were produced (the server process never received an initialize from that session).

Event-log excerpts from failing sessions (opencode run --format json stream, verbatim modulo path scrubbing):

Total dropout — first tool_use event of the session; every later MCP call in the session failed the same way (the session never completed one tool call):

{"part": {"type": "tool", "tool": "davinci-resolve-project_manager",
  "state": {"status": "error",
    "error": "No tool named \"davinci-resolve-project_manager\" is currently available. Please use a tool from the available tool list.",
    "time": {"start": 1795474646578, "end": 1795474647118}}}}

Partial dropout — same session, back to back: the Node server answers, the Python and ResolveMCP servers' tools are rejected:

{"part": {"type": "tool", "tool": "davinci-resolve-advanced_capabilities",
  "state": {"status": "completed",
    "output": "{\"core\": \"always available (pure-JS): drp, drt, drx, offline_ref, editorial, fusion, audio_plan, conform(core)\", ...}"}}}

{"part": {"type": "tool", "tool": "davinci-resolve-resolve_control",
  "state": {"status": "error",
    "error": "No tool named \"davinci-resolve-resolve_control\" is currently available. Please use a tool from the available tool list."}}}

Sibling timing (same pair of concurrently-launched sessions, same config, same directory pattern):

  • Driver launches pair F2r3 + T1r1 at 2026-11-23T22:57:23Z. F2r3 completes 37 tool calls normally — 34 completed calls to davinci-resolve* tools (zero No tool named rejections on real tool names). T1r1 is total-dropout for its entire ~28 s session: 12 MCP-name attempts, all rejected with the excerpt above, zero completed calls.
  • Driver launches pair T8r1 + T8r2 at 2026-11-23T23:18:15Z. T8r2 completes normally (13 completed davinci-resolve* calls); T8r1 is partial-dropout — its only 2 completed Resolve-family calls are davinci-resolve-advanced_*; every live/builtin-named call is rejected (excerpts above).
  • Re-run loop (sequential, one session at a time): first T8r1 re-run hit total dropout again (killed by the watchdog after its 6th rejection); the immediately following fresh session registered everything and passed. So concurrency is not required for the failure.

Expected Behavior

Every opencode run session registers all enabled local MCP servers in its tool pool, as the overwhelming majority do; a registration failure should at minimum be surfaced as an explicit startup/session error rather than presenting a silently partial tool pool to the model for the whole session.

Actual Behavior

The affected sessions run with a silently missing (or entirely missing) set of MCP tools for their entire lifetime. All calls to the expected tool names error with the harness rejection No tool named "…" is currently available. Please use a tool from the available tool list. Nothing in the session start output, event stream, or MCP server logs indicates a registration failure occurred.

Additional Context

  • Frequency: 5 of ~44 wave sessions (~11%): 2/21 in wave A (2026-11-23 19:58Z), 2/21 in wave B (2026-11-23 22:54Z, independent fixture), 1/2 in a sequential re-run loop. Same host, same config layout, same servers.
  • Version boundary: began with the 2.4.1 build series. The same briefs/harness on opencode 2.3.2 (multiple waves, dozens of sessions over the prior month) produced zero such sessions. 2.4.0 changed session storage; that's the most visible stack change at the boundary, though we can't pin the mechanism.
  • Not a name-form bug: the same tool names succeed in sibling sessions; the rejection is not limited to any particular name (agents probing both correct and hallucinated names get the same rejection for everything MCP).
  • Impact/workaround: for us this silently invalidates benchmark trials. We added a driver-side watchdog that watches the --format json event stream: it treats a completed call to a pool MCP tool as pool-alive, counts No tool named rejections across all MCP name forms, and kills + relaunches the session at ≥6 rejections with no completions. That recovers the trials but is obviously a workaround for a per-session registration failure.
  • Server health: the MCP servers themselves are healthy — the same servers serve every neighboring session, and the failed sessions produced no traffic on the server side at all (no initialize reached them), suggesting the failure is client-side registration/spawn in the run session, not the servers crashing.
  • Happy to provide the sealed per-session configs, the --format json event logs of failing sessions, and the timing correlation against successful siblings.

Activity

  1. added a commit that references this issue on Nov 24, 2026
  2. added
    area/mcp
    type/bug
    version/v2
    on Nov 24, 2026
  3. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Thanks for the very detailed report. I couldn't reproduce this on 2.4.1, though I tested on Linux, not macOS.

    What I tried: about 140 fresh opencode run --standalone --format json sessions on 2.4.1. Each had a sealed OPENCODE_CONFIG and its own HOME/XDG directories. The config had three local stdio MCP servers (a Python script, a Node script, and a shell wrapper that execs Python in place of a native binary), each logging every message it received. It also had policies like yours (deny all tool.use except the servers' tools, deny all mcp.use except the three servers, deny plugin.use). A mock OpenAI-compatible model called each server's tool for several rounds.

    • Fast-starting servers: I ran up to 16 sessions at once, including on one CPU under extra load. Every session registered all three servers, and each server received initialize, tools/list and tools/call. There were no No tool named refusals.
    • Servers that take a few seconds to start: the first turn could miss them and get No tool named …. That looks intended: the first turn waits only a short time (about 2 s in 2.4.1) for servers still connecting. In my runs those servers were registered once they connected, and later turns could call them. That differs from what you describe, where the servers never get initialize and never appear.

    What would help:

    • The OpenCode log for one failing session and one working sibling (~/.local/share/opencode/log/opencode.log; lines with mcp are the most useful). It should show whether the servers were spawned, stayed pending, or failed for that session.
    • How long each of the three servers takes to answer initialize from a cold start, especially ResolveMCP and the Python venv server.
    • Whether a failing session that keeps going for more than about 30 s ever gets the missing tools.
    • If you can, one of your sealed configs (with paths scrubbed) and the --format json event log of a failing session.
  4. willturner-maker commented on Nov 24, 2026

    @willturner-maker
    Author

    Update from our own log archaeology — the servers DO connect in failing sessions (this supersedes one claim in the description)

    We found the shared ~/.local/share/opencode/log/opencode.log covers both waves. Each opencode run --standalone spawns its serve --stdio --port 0 child, and that child logs the MCP lifecycle — including for the failing sessions. The picture changes: the failing sessions' servers spawned, connected, and listed tools fine; the rejection happens downstream, in getting those connected servers' tools into the session's tool pool. (Our description's line "the server process never received an initialize from that session" was based on our MCP servers' per-call logs, which apparently don't record initialize-level traffic — the lines below show mcp connected for the failing sessions themselves.)

    Failing total-dropout session vs healthy sibling (same concurrently-launched pair, 2026-11-23T22:57:23Z). Both CLI runs (args masked) and both serve children:

    22:57:23.856 run=588677eb cli starting args=["run","--standalone","--format","json","Timeline <project>…   (healthy sibling: 34 completed MCP calls)
    22:57:23.857 run=42e4ab8e cli starting args=["run","--standalone","--format","json","The project <project>…  (FAILING session: 12 MCP-name attempts, 0 completed, whole 28 s)
    

    The failing session's serve child — note all three servers connecting within 725 ms of its start:

    22:57:23.893 run=70ab9212 cli starting args=["serve","--stdio","--port","0"]
    22:57:23.985 run=70ab9212 location services booted directory=<workspace>
    22:57:24.309 run=70ab9212 mcp connected server=davinci-resolve-builtin tools=18 http.span=358
    22:57:24.462 run=70ab9212 mcp connected server=davinci-resolve-advanced tools=18 http.span=511
    22:57:24.618 run=70ab9212 mcp connected server=davinci-resolve tools=37 http.span=667
    22:57:51.918 run=70ab9212 Sent HTTP response http.span=27927 GET /api/event   (~28 s lifetime ≈ the failing session's 28.2 s)
    22:57:51.920 run=70ab9212 shutdown started signal=SIGTERM
    

    Its serve run logs mcp connected for all three servers — and yet every davinci-resolve* call in that session gets No tool named "…" is currently available from the first turn to the last (event excerpts in the description). So: spawned = yes, connected = yes, tools/list = yes (18/18/37 tools), pool = empty anyway.

    The sibling's serve child is byte-for-byte the same shape (mcp connected 3/3, spans 358/511/667, ≈117 s lifetime ≈ its 116.8 s session): same config, same workspace, seconds apart, one works fully, one rejects everything.

    Partial dropout (23:18:15Z pair) — same: both serve children log all three connections (mcp connected 3/3, spans 374/579/775) — while the failing session's tool pool served only davinci-resolve-advanced_* and rejected live/builtin names all session. If the pool state were driven by connection success, that session should have had all three.

    Cold-start initialize latencies (your question 2)

    From http.span on mcp connected lines across the whole wave window (n = 27 sessions per server, same three servers, cold stdio spawns):

    server initialize span min / med / max
    davinci-resolve-builtin (app-provided binary) 330 / 359 / 403 ms
    davinci-resolve-advanced (Node) 456 / 506 / 585 ms
    davinci-resolve (Python venv) 612 / 667 / 805 ms

    All well inside the ~2 s first-turn wait you measured — and the failing sessions' own connection lines are in the same ranges. Cold/slow start doesn't explain these sessions.

    >30 s sessions and late registration (your question 3)

    Never re-registered, at any lifetime length. The partial-dropout session above ran 43.9 s wall; its --format json event stream shows the last rejected davinci-resolve* call at +31.5 s into the tool sequence — rejections continued until the session ended naturally, no late mcp connected-equivalent ever landed in its pool. A killed-and-relaunched retry (sequential, single session at a time) hit total dropout again for its full 60+ s before our watchdog killed it, still zero registrations; the next fresh session on the same config was fully healthy.

    Two log oddities that might be clues

    • The two concurrently-launched sessions' serve children log identical duplicate lifecycle lines — same mcp connected timestamps down to the millisecond and identical http.span values (e.g. both 358), as if one shared event stream records both, or both independently connect in lockstep. Worth knowing whether standalone sessions share MCP connection state.
    • Both serve children logged directory=<workspace> (the run's workspace root), not per-session directories — fine for us, but it means standalone sessions in different cwd's on the same machine could be deduplicating or clobbering a shared connection keyed by something other than session.

    Still happy to attach the full sealed config, complete --format json event logs of both failing sessions, and raw (path-scrubbed) log blocks for all four serve runs above.

  5. willturner-maker commented on Nov 24, 2026

    @willturner-maker
    Author

    Following up on the request for artifacts — gist with the full files (paths scrubbed, nothing else modified):

    https://gist.github.com/willturner-maker/cb8ddaec3b6a4465d1d2772922664d85

    • sealed-config.json — one wave session's exact OPENCODE_CONFIG file (byte-for-byte the shape all ~44 sessions used: local OpenAI-compatible provider with apiKey: "none", the three local stdio MCP servers, deny-all policies with the mcp.use davinci-resolve* allow).
    • events-T1r1-total-dropout.json — complete opencode run --standalone --format json event stream of the total-dropout session whose serve child (run 70ab9212 in our opencode.log excerpt above) logged mcp connected for all three servers: 12 MCP-name attempts, every one No tool named …, zero completed calls, 28 s whole-session.
    • events-T8r1-partial-dropout.json — complete event stream of the partial-dropout session (its serve child likewise connected 3/3): only davinci-resolve-advanced_* calls complete; every live/builtin-named call rejected, with the final rejection at +31.5 s into the session.

    Scrubbing applied to all three files: home paths, external-volume paths, and benchmark project/wave names → placeholders. Server names, policies, commands, event structure, and everything semantic are verbatim.

  6. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Thanks for digging through the logs. Knowing that the servers do connect in the failing sessions narrows this down a lot.

    I tried again on 2.4.1 (Linux) with a setup closer to yours:

    • One shared data directory (one opencode.db) and one working directory for every session.
    • Identical server commands in every session.
    • Three local stdio servers (Python, Node, and a wrapper standing in for the native binary) that take up to about 1 s to start.
    • Your policy shape.
    • In one batch, server names that share a prefix, like davinci-resolve / -advanced / -builtin.

    Across about 150 more opencode run --standalone --format json sessions, 2–4 at a time with a mock model calling every server's tools over several turns, I saw no No tool named refusal. The log had exactly one mcp connected line per server per session, and none of the duplicated lines you saw. So I still can't reproduce it here.

    Your finding (connected, tools listed, but missing from the session for its whole life) points to the step where connected servers' tools are added to the session's tool list. These would help pin it down:

    1. Log lines from a failing serve run: all lines for one failing serve child (e.g. everything with run=70ab9212) from start to shutdown, path-scrubbed, not just the mcp connected lines. Warnings or errors in between, or a second location services booted, would be the most useful.
    2. The first model request: whether the first request of a failing session actually lacks the tools. Since your provider is a local OpenAI-compatible endpoint, could you log the tools array (names only) it receives? A healthy sibling's request would be useful for comparison.
    3. The duplicated log lines: whether the two run processes of a failing pair really started two separate serve --stdio children (two different run= IDs on the cli starting args=["serve",...] lines), or whether the duplicated mcp connected lines come from one child.
    4. The config: one sealed per-session config (paths scrubbed), in particular whether any server sets codemode, pool, cwd or timeout.
  7. willturner-maker commented on Nov 24, 2026

    @willturner-maker
    Author

    Answering the "exact command / additional info" ask — plus a corpus-wide pass over both wave days that yields three new pin-downs.

    Exact invocation (run-mode, per your checklist)

    env = os.environ.copy()
    env["OPENCODE_CONFIG"] = "<session-dir>/opencode.json"   # sealed config = gist from my last comment
    subprocess.Popen(
        ["opencode", "run", "--standalone", "--format", "json", <prompt>],
        cwd="<session-dir>", env=env, stdout=PIPE, stderr=PIPE, text=True)

    opencode 2.4.1 (channel=latest), macOS 27.2.1, Apple Silicon. The runner starts two such processes concurrently (measured 0–2 ms apart); ~44 wave sessions like this over two days. Interactive/TUI: never observed a dropout — only run --standalone.

    Pin-down 1 — the connection path never fails, anywhere, in any session

    Across both wave windows there are 47 serve --stdio children (one per run session). All 47 log mcp connected 3/3 — builtin 18 tools, advanced 18, python-venv 37 — including every one of the 5 dropout sessions. Zero partial-connect children, zero silent children, across ~146 server connections. So the bug is not spawn, initialize, or tools/list, with no exceptions. The dropout rate is ~11% (5/47 serve children), and it lives strictly downstream: in the per-session tool pool.

    Pin-down 2 — concurrency correlates but isn't required; connection order doesn't predict which server drops

    • 4 of the 5 dropouts were members of co-launched pairs (0–2 ms apart). But many other 0 ms pairs ran clean, so same-instant launch is not sufficient.
    • The 5th dropout was a single sequential retry, minutes after its killed predecessor, nothing else running — so a race is not required either.
    • In the partial dropout (T8r1, gist attached): the pool held only the middle-connected server's tools — connect order was builtin(374 ms) → advanced(579) → python(775), and only advanced survived the pool. Fastest and slowest both dropped. If pool binding keys off connect completion timing, this composition argues against a simple "first N connections win" rule.

    Pin-down 3 — sibling serve children log identical per-server initialize spans; worth asking whether standalone sessions share MCP state

    Each co-launched pair's two serve children are separate OS processes, yet their mcp connected lines match exactly per server:

    22:57 pair   run=70ab9212  builtin 358 | advanced 511 | python 667   (FAILING session's child)
    22:57 pair   run=18832f53  builtin 358 | advanced 514 | python 667   (healthy sibling)
    23:18 pair   run=9f570de5  builtin 374 | advanced 579 | python 775   (FAILING session's child)
    23:18 pair   run=7490b793  builtin 374 | advanced 579 | python 775   (healthy sibling — 3/3 identical)
    

    Two independent cold stdio server initializations producing identical (or ±3 ms) durations twice in a row is not what independent processes should look like. Both children also log directory=<workspace root> — identical location. Does the MCP manager key connections by location/config hash in a way that two standalone processes on the same machine can collide through (registry, file lock, shared event bus)? That would explain both the identical timing and the pool clobber.

    One logging ask that would likely crack this fast

    The No tool named "…" is currently available error string never appears in opencode.log — it exists only in the session's --format json event stream (the model-visible tool error). And the failing vs healthy serve children are structurally identical at INFO level (same message set and counts, byte-for-byte). The pool state is currently unobservable in the log at exactly the moment it matters. If the code path that raises "No tool named" (or the session-tool-pool builder) logged the registry's current key set + per-MCP-server tool counts, the 11% dropout would become directly visible — and the T8r1 partial case (one server bound, two not, in one pool) would show which binding step skipped.

    Repro recipe from our corpus: ≥10 trials of two opencode run --standalone processes launched within 2 ms of each other, same sealed OPENCODE_CONFIG (three local stdio MCP servers, one with a ~700 ms cold initialize — the python venv one is what makes binding order observable), same workspace root; expect ~1 in 10 sessions to get a pool missing servers whose connections all logged as connected.

  8. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Thanks for the gist, it helps a lot. I think it shows something different from a registration failure.

    OpenCode names a direct MCP tool <server>_<tool>: the server name, an underscore, then the tool name. With your config, the real names are davinci-resolve_resolve_control, davinci-resolve_project_manager, davinci-resolve-builtin_get_resolve_status, davinci-resolve-advanced_project_read and so on. This naming is the same in 2.3.2 and 2.4.1.

    In both event files, every rejected call uses a hyphen where that underscore should be:

    • davinci-resolve-resolve_control, davinci-resolve-project_manager, davinci-resolve-timeline, davinci-resolve-media_pool
    • davinci-resolve-builtin-get_resolve_status, davinci-resolve-builtin-launch_resolve
    • davinci-resolve-advanced-project_read
    • and a few made-up ones like davinci-resolve-ProjectManager

    The only calls that completed are davinci-resolve-advanced_capabilities, which is the correct <server>_<tool> form. That would explain the "partial dropout": the -advanced server looked alive only because the model happened to write its name correctly. It also fits your finding that every serve child logged mcp connected 3/3. The tools were most likely registered, and the model asked for names that don't exist.

    Why it lasts the whole session is a guess on my part. In v2, a call to an unknown tool stays in the history under its made-up name (#65822), so once a session starts with the hyphenated form, the model may keep copying it. That could be why a fresh session often recovers.

    Could you check these three things?

    1. In a healthy sibling (e.g. F2r3), what are the exact tool names of the completed davinci-resolve* calls? Do they use davinci-resolve_… and davinci-resolve-builtin_… with an underscore?
    2. In the requests your endpoint at 127.0.0.1:8000 receives from a failing session, what tool names are in the tools array? If davinci-resolve_resolve_control and the others are listed, the tool pool was complete and the model picked the wrong names.
    3. Does your brief or AGENTS.md mention tool names in a hyphenated form (e.g. davinci-resolve-resolve_control)? That could push a quantized local model toward the wrong form.

    If the tools array of a failing session really lacks the servers' tools, that would be a real OpenCode bug, and we can take it from there.

  9. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Closing this for now, since we haven't heard back. The last open question was whether the requests from a failing session really lack the servers' tools. In the event logs you shared, every rejected call used a hyphen where OpenCode's <server>_<tool> naming has an underscore (for example davinci-resolve-resolve_control instead of davinci-resolve_resolve_control). The only calls that worked used the correct form. That points to the model getting the tool names wrong rather than tools missing from the session. In about 290 sessions on 2.4.1 I never saw a server's tools missing.

    If you can show that the tools array your endpoint receives in a failing session lacks the davinci-resolve* tools, or that a healthy sibling completed calls with the hyphenated names, please reply here. Replying reopens the issue.

  10. willturner-maker commented on Nov 24, 2026

    @willturner-maker
    Author

    We ran the decisive experiment — we cannot satisfy either ask, because the tools were present. Your reading was right; ours was wrong.

    Method. We put a tee-proxy between our sessions and our OpenAI-compatible endpoint (127.0.0.1:8001 → :8000, stdlib passthrough that logs every /v1/chat/completions request: model, tool count, tool names). Same sealed config (the exact one from our failing sessions, three local stdio MCP servers), same opencode 2.4.1, same workspace, paired concurrent launches like our waves.

    Result 1 — reproduction of our own failure signature, with the payload on record. Two fresh short-brief sessions reproduced exactly the wave behavior we had been calling "dropout": every MCP call used a hyphen-mangled name, zero correct-format attempts, ending in a self-declared "no tools" report. The proxy shows for those sessions: first request (tools: 0 — the session-title generation call, expected), then every subsequent task request: n_tools: 74, including davinci-resolve-builtin_get_resolve_status and davinci-resolve_project_manager. Scrubbed excerpt:

    2026-11-24T15:36:26Z nonce=CAP-R1A tools: 0   (title-gen)
    2026-11-24T15:36:26Z nonce=CAP-R1A tools: 74  (mcp: 73; builtin/python names present)
    2026-11-24T15:36:45Z nonce=CAP-R1A tools: 74  ... same for CAP-R1B (all task requests)
    session R1A events: 4/4 mangled-name attempts (davinci-resolve-builtin-get_resolve_status,
      davinci-resolve-project_manager, ...), all "No tool named", zero correct-format attempts
    

    Result 2 — endpoint rendering exonerated too. We fed that captured 74-tool array directly to our engine at temp 0 with an enumeration prompt: the model lists the exact davinci-resolve-builtin_* names correctly and names davinci-resolve-builtin_get_resolve_status as the status tool. So the array arrives intact and renders intact.

    Result 3 — wave-condition replay, no reproduction. 9 rounds (18 sessions) of the exact wave briefs from our failing sessions, paired launches: 0 confabulating sessions, 5 mangled attempts total across ~250 MCP calls — all self-corrected, exactly the "sloppiness tax" our healthy sessions always showed. We cannot reproduce a pool-side failure at all; and our original waves' 5 failing sessions predate payload logging, so we can no longer claim the tools were absent for them.

    Corrected conclusion (supersedes our previous comment's "pool binding" claim): the failing sessions are a model-side, session-level tool-name grounding failure — a small-model lottery that is self-reinforcing within a session (once names are confabulated, the model keeps confabulating: 12/12, 21/21 attempts mangled in our two archived failing sessions, while a sibling session 1 ms apart was 37/37 correct). Rate is strongly brief/context-dependent: 2/2 with short prompts, ~5/47 with our complex wave briefs, 0/18 in yesterday's replay. Our event-log-only inference genuinely could not distinguish this from pool loss — your hyphen observation is what pinned it. We're re-labeling these sessions in our benchmark records as model failures, not harness dropout.

    One improvement ask, now the only actionable thing we see: the rejection text No tool named "X" is currently available. Please use a tool from the available tool list. doesn't include the actual names (or fuzzy candidates). For small models — the exact class that confabulates — listing the server's available tool names in that error (or a closest-match suggestion) would convert most confabulation sessions into self-recovering ones; we watched healthy sessions recover only by brute-guessing variants across several turns.

    Apologies for the runaround, and thanks for insisting on the payload check — it produced the right answer at our expense, which is exactly how this should work.

  11. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Thanks for running the proxy test and for writing it up so clearly. It settles the main question: every request carried the full tool list, so these sessions were the model getting the <server>_<tool> names wrong, not OpenCode losing the servers.

    That leaves your improvement request: when the model calls a tool that doesn't exist, the error should help it recover. It could list the tool names that are available (for example those of the server the name seems to point to) or suggest the closest match. Today the error only says No tool named "X" is currently available. Please use a tool from the available tool list. A hint like "did you mean davinci-resolve_resolve_control?" could let a small model correct itself on the next turn instead of guessing.

    I've marked this as a feature request for the maintainers to consider; I can't promise if or when it will land. Possibly related: #65822. In v2, a call to an unknown tool is replayed in later requests under its made-up name, which may help explain why a wrong name kept repeating for the rest of a session in your runs.

  12. added
    area/core
    type/feature
    and removed
    type/bug
    area/mcp
    on Nov 24, 2026
  13. willturner-maker commented on Nov 24, 2026

    @willturner-maker
    Author

    Most appreciated! Thank you for running through the tests. Looking forward to an eventual feature, but also quite excited with the level of support and quick responses!

    OpenCode is and will continue to be my favorite!

  14. willturner-maker commented on Nov 27, 2026

    @willturner-maker
    Author

    Benchmarked data point from ~70 sealed opencode run sessions (three 18-trial waves;
    opencode 2.4.1 and 2.4.2; three stdio MCP servers with hyphenated names, e.g.
    my-server, my-server-builtin, my-server-advanced; every session's JSON event stream
    recorded). Worth flagging because this issue's signature is easy to misdiagnose:

    1. The "tool not available" rejection stream we logged turned out to be fully explainable
    by model-side name confabulation — we self-corrected a dropout claim built on it.

    Across the three waves there were 110 No tool named "X" is currently available rejections
    (23–51 per wave, 6–8 sessions per wave). Every rejected name was a non-registered form:
    dash-joined (my-server-render), action-suffixed (my-server-project_manager_get_current),
    or bare (project_manager). Zero rejections targeted any name that completed successfully
    somewhere in the recorded waves — checked within-wave and cross-wave at identical pins.
    Completed MCP calls were consistently server_tool-joined in both 2.4.1 (498 calls) and
    2.4.2 (496 + 667 calls), so the dash forms were never a harness rename — and sessions we had
    flagged "pool dead" (2/21 ≈ this issue's ~10%) contain only malformed-name attempts, never a
    registered name. We cannot prove or disprove a true zero-registration dropout from those
    streams.

    2. That leads to the practical ask: the event stream has no tool-pool surface record.
    opencode run --format json emits step_start/tool_use/step_finish/text parts — no
    session-start registration list. So any user reporting "intermittently registers no MCP
    servers" (including our own earlier report) is inferring from rejection noise. Two cheap
    instruments would make this issue debuggable and cut a large class of model-side failures:

    • log/dump the registered tool pool at session start (a tools/list census event, or a
      --dump-tool-pool flag for repro);
    • include the available tool list (or nearest-name suggestions) in the rejection message —
      it currently says "Please use a tool from the available tool list" without the list.
      In our benchmark, confabulation spirals (model repeatedly inventing name variants, 6+ in a
      row) killed 1–3 sessions per wave; our harness needs an external watchdog + relaunch for
      exactly this. A suggestion-bearing error would break the spiral at the first rejection.

    3. Hyphenated server names compound it: my-server joined to a tool leaves the
    boundary ambiguous, and models confabulate both my-server-tool and
    my-serverrender-style concatenations (join char dropped); related to #63555 (permission action names keep
    hyphens while docs promise _-normalization) and #52420 (normalized-name collisions). Our
    census quantifies the confusion rate: 110 malformed-name attempts vs ~1,660 completed
    Resolve MCP calls (~6.6% of Resolve-side attempts), concentrated in a minority of sessions.

  15. willturner-maker commented on Nov 30, 2026

    @willturner-maker
    Author

    2.4.3-era field follow-up to our 11-27 census comment (two sealed 21-trial waves, 2026-11-29/30, three hyphenated stdio MCP servers again): still zero pool-dropout signature. Every completed MCP tool call is underscore-joined — merged wave manifests show 456 and 338 underscore completions with 0 dash-join / 0 concat forms; the dash/concat names still appear only inside errored model-side attempts (in the 11-29 wave they survive only inside raw <tool_call> XML text emitted by the serving layer, which is a separate model/serving bug we filed elsewhere). Rejection deltas stayed small and all undeclared-name confab: 12 and 9 across all dispatches, 0 invalid_arguments, 0 cut. Our watchdog+relaunch posture stays load-bearing until #66842 ships in a release and a wave can prove self-recovery.

  16. willturner-maker commented on Dec 3, 2026

    @willturner-maker
    Author

    Field follow-up #4 from the same bench line — 2.4.4 verified unchanged, a deterministic repro of the pool-symptom family, and experimental.mcp_resilience demonstrably fixes it (2026-12-02)

    1. Unknown-tool rejection path on 2.4.4 is byte-identical to 2.4.1–2.4.3. Binary string probe on the standalone-install binary: No tool named "${s}" is currently available. Please use a tool from the available tool list. — unchanged; no suggestion machinery near the tool registry. PR #66842 confirmed open/unmerged at probe time (idle since 11-27). Our wave-side confab detection strings need no update. Fresh full-wave census under 2.4.4 (21 sealed agent sessions, 459 completed MCP tool calls): 25 unknown-tool rejections across 9 sessions, 14 distinct name forms — every form unregistered (17 dash-join like davinci-resolve-timeline, 8 action-suffix like davinci-resolve_timeline_list; zero hit a name that exists), and every session self-recovered after its rejection — completed-call manifest is 100% correctly-joined. Still zero evidence of harness-side pool dropout; this is model-side naming confab, exactly the family #66842's hints target.

    2. New: we can now force the symptom instead of waiting for it. Fault-injection battery (SIGKILL the session's MCP stdio server processes mid-session, ~40 lightweight MCP calls per session, sealed per-run configs, adaptive kill after ≥4 verified calls), opencode 2.4.4, flag off vs experimental.mcp_resilience: true on:

    arm steady-state post-kill recovery verdicts
    flag off (n=3) 0/97 (lone "ok" was an in-flight call completing 0.1 s after the kill) 2× STAYED-BROKEN + that race; an earlier n=1 run: 0/40 across 80 s
    flag on (n=3) 106/106 3/3 RECOVERED — sessions never noticed the drop

    So for the "MCP tools keep failing after a connection drop" slice of this issue, the experimental flag is the vehicle and #67852 alone is not: 2.4.4-without-the-flag reproduces the persistent post-drop failure deterministically, and one config key eliminates it. The flag's description matches this exactly ("Keep MCP tools available through dropped connections and reconnect on demand, using saved tool listings during startup"). Would be glad to see it graduate from experimental — and if it does, a did you mean…? hint on the unknown-tool path (#66842) would cover the remaining failure mode.

    3. Datapoint for the #66842 hint ranking: the dash-join confab fires even in maximally-constrained single-tool sessions. In our first unpinned-name battery round, 3 of 14 sessions chose davinci-resolve-project_manager for ALL ~40 calls, each eating the bare rejection with no hint. The harness knows the intended name; a nearest-server+tool edit-distance hint breaks the loop. Side note: Code Mode's tools[...] lookup does have suggestion machinery but ranked drp above project_manager for that same input — ranking worth aligning if #66842 lands.

    4. Serving-side confab source eliminated: our engine-side echo family is dead upstream (incoai/splash#908, released splash 1.7.5) — two consecutive full waves since show 0 echo requests in 408 and 380 guarded requests (pre-fix baseline: 6.8%/request). So the remaining unknown-tool rejections on our surface (the 25 in §1) are unambiguously harness-side naming confab — precisely where #66842's hints pay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreplatform/macostype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions