Repository navigation
List OpenCode's project agents in the ACP provider's mode menu - #5455
Merged
Merged
Conversation
OpenCode reports its primary agents as the ACP "mode" option and resolves them from the session's working directory: the global agents plus the project's own `.opencode/agent` files. bb read an ACP agent's options once per machine, in the bridge's own process directory, so a new thread's mode menu listed only the built-in agents and any global ones. - The ACP bridge runs `model/list` discovery in the workspace bb names. - OpenCode (the built-in agent and custom agents with the opencode dialect) declares a workspace-scoped model catalog; every other ACP agent keeps the machine-wide one. - `GET /system/execution-options` accepts `projectId` so a new thread can name its project before an environment exists. The SDK and `bb provider models --project <id>` carry it, and the new-thread composer sends it for providers with a workspace-scoped catalog. - The bridge deletes the session it opens to read an agent's options, over ACP `session/delete` when the agent advertises it and through `opencode session delete` otherwise, so discovery no longer leaves empty sessions in OpenCode's history. Co-Authored-By: Claude Code <[email protected]>
SawyerHood
marked this pull request as ready for review
October 13, 2026 23:49
OpenCode lists only the agents it loads itself and does not read `.agents/agents/`. Say so in the providers guide and the ACP skill, with the `OPENCODE_CONFIG_DIR` setting that makes a per-project folder appear in the mode menu. Co-Authored-By: Claude Code <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
A user reported that the new ACP provider (
bb--provider-acp-next) lists only OpenCode's built-in agents (Build, Plan) in the new-thread "Session Mode" menu, while other ACP clients also list their custom agents.OpenCode reports its primary agents as the ACP
modeconfig option and resolves them from the session's working directory: the global agents plus the project's own.opencode/agent/*.md. bb read an ACP agent's models and options once per machine (models.scope: "host"), and the bridge opened its discovery session in its own process directory. A project's agents therefore never appeared before a thread existed.What changed
packages/provider-bridge-acp-next):model/listruns discovery in thecwdthe server names. A launch spec that sets its owncwdstill wins, and a path that is not a directory falls back to the previous behaviour.plugins/provider-acp-next): agents carry amodelCatalogScope. The built-in OpenCode agent and custom agents with"dialect": "opencode"declareworkspace; every other ACP agent stayshost. I kept the others machine-wide because a workspace-scoped catalog makes a thread page's model button read "Loading models" for about two seconds the first time it opens. OpenCode threads now have that delay, as Pi threads already do.GET /api/v1/system/execution-optionsacceptsprojectId(rejected together withenvironmentId). The server resolves the project's checkout on the target machine and reads a workspace-scoped catalog there.projectCheckoutPathOnHostmoved from thread creation intoservices/projects/project-workspace.tsso both callers share it.sdk.providers.models({ projectId })andbb provider models --project <id>.session/newused to leave an empty "New session" row in OpenCode's history, and per-project discovery would have multiplied them. The bridge now sends ACPsession/deletewhen the agent advertises it, and otherwise, for the opencode dialect, runsopencode session delete <id>after the agent exits.docs/provider-plugin-api.md. The guide and the ACP skill also say that OpenCode does not read agent files from other folders such as.agents/agents/, and howOPENCODE_CONFIG_DIRmakes a per-project folder appear in the mode menu.No
HOST_DAEMON_PROTOCOL_VERSIONbump: the server already sendscwdonmodel/listfor workspace-scoped providers, and no daemon contract file changed. The plugin SDK surface is unchanged.How you verified
Tests added:
projectIdvalidation and forwarding, the--projectflag, when the composer names the project, and the per-project cache with its placeholder.Commands, on this commit rebased onto current
main:turbo run typecheck lint --filter='...[origin/main]': 121 tasks pass.turbo run testfor the nine touched packages.node .github/workflows/check-plugin-sdk-version.mjsandnode packages/plugin-sdk/scripts/check-npm-version-guard.mjs.Manual, in the dev app on Linux with OpenCode 1.18.35 and a project that has two
.opencode/agentfiles:bb thread spawn --option mode=<agent> --new-environment worktreedid the same from the CLI..agents/agents/: OpenCode 1.18.35, 1.19.0 and the OpenCode 2 beta do not list them from the project, a parent folder or the home directory. WithOPENCODE_CONFIG_DIR=.agents, set as a machine variable for the built-in agent or in a custom agent'senv, the mode menu listed the project's.agents/agentsagent and a new Worktree thread answered as that agent. A changed machine variable reached the mode list about a minute and a half later, or at once after a plugin reload.opencode2 acp), added as a custom agent with"dialect": "opencode", listed the project agents, ran a thread on one, and had its discovery session removed over ACPsession/delete.Not tested: a remote machine, macOS, Windows, and an OpenCode 1 release newer than 1.18.35.
🤖 Generated with Claude Code