AI News
All stories
Official

opencode v2.2.6 adds shared MCP connections and Azure support for Claude models

opencode v2.2.6 adds opt-in MCP connection pooling, a worktree option for scripted runs and Azure Messages support for Foundry Claude models.

AI in Practice · · 2 min read

opencode v2.2.6 changes how opencode run exits. The release notes list this under bug fixes, not features. The command no longer exits when its prompt finishes. It waits, with no time limit, for background shell commands, subagents and image jobs the prompt started, and it keeps running until someone presses Ctrl+C or sends SIGTERM. The notes tell CI users to set a timeout on their jobs, since a dev server or file watcher started from a prompt would otherwise keep the run open indefinitely.

While it waits, opencode prints waiting for N background job(s). With --format json, it emits a background_wait event instead. Once the jobs finish, the model responds to their results before the process exits. The same release reworks noninteractive execution so that SIGTERM cancels the session and its background jobs, then exits with code 143. Scripts that assumed opencode run would return as soon as the model finished will now wait on those jobs.

The other headline change is opt-in MCP connection pooling. Setting pool: true on an MCP server lets projects with the same server configuration share one connection, which the release says means fewer running processes and faster startup. The notes give no figures for either gain. They also don't explain how opencode decides two projects have the "same setup" beyond that phrase. Separately, before a model call, opencode now waits up to 2 seconds for MCP servers that are still connecting, so tools from fast servers reach the first prompt and opencode run.

For scripted and CI use, the release adds two flags to opencode run. The -w option, or --worktree=<name> to choose a name, starts the session in a new git worktree. It cannot be combined with --continue or --session. The --archived flag creates the session already archived, which keeps it out of the inbox, home and session lists. Archived sessions are also hidden from the TUI session list and skipped by --continue.

The release also adds Azure Messages support for Foundry Claude models. The notes give it one line under Core, with no detail on configuration, supported model versions or limits. The entry shows the option exists and little more.

Several security fixes cover the server API and web fetching. Webfetch and Code Mode fetch now reject URLs containing credentials, and they ignore the #fragment when matching permission rules. Code Mode fetch also checks every redirect against the webfetch rules. On the server, file reads and media are served as sandboxed downloads. Cross-site browser navigations and requests from disallowed origins to /api/* are refused. According to the notes, a file in your project cannot run scripts on the server's origin.

The release adds an experimental bytecode VM for Code Mode. It is off by default and turns on with experimental.codemode_vm: true or OPENCODE_FLAGS=codemode_vm. The notes don't say what the VM changes in practice beyond that name and switch.

What changed

opencode run no longer exits when its prompt finishes; it waits with no time limit for background shell commands, subagents and image jobs the prompt started, and keeps running until Ctrl+C or SIGTERM.

Type: Breaking change · Applies to: opencode v2.2.6, opencode run

Why it matters

Teams running coding agents in CI or scripts will see changed exit behavior and new isolation options, which affect pipeline reliability and cost.

What you can do

If you run opencode run in CI, set a timeout now, because background jobs can keep a run open indefinitely.

Original source

Where we saw it

1 source

opencode releases

AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works