Repository navigation
The chat starts opencode 2 with its Code Mode off - #235
Merged
Merged
Conversation
opencode 2 puts a session's MCP tools behind one `execute` tool, and a picture a tool answers with never reaches the model. The `opencode acp` the chat spawns on opencode 2 now carries `permission.execute: "deny"` in OPENCODE_CONFIG_CONTENT, added to the user's own value; a value that says permission.execute stands, one that does not parse is left as it is with a line in the log. opencode 1.x and the other agents are not touched. `dialogram.chat.opencodeCodeMode` (default off) leaves Code Mode on. Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
…Code Mode may come back Review of #235: an opencode connector without the HTTP API was never probed, so an opencode 2 there kept Code Mode on; it is now asked by its command's name, its HTTP API still off. An opencode whose version cannot be told says in the log that Code Mode is left as its config says. The setting, the CHANGELOG and the log line say that an opencode.json permission.execute gives way to the chat's, and that an agent's own wildcard allow lets execute back in. Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
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.
What changes
opencode 2 has a "Code Mode": it hides a session's MCP tools behind one
executetool. The model writes a script that calls the tools and reads only what the script prints, so when a tool answers with a picture (the diagram server'sdiagram-png,untangle-start,untangle-try), the model never sees it.With this PR, when the chat's connector is opencode and the binary is opencode 2, the chat starts
opencode acpwith Code Mode off. It puts{"permission": {"execute": "deny"}}inOPENCODE_CONFIG_CONTENT, a config layer opencode reads from its environment. The tools are then offered as themselves, and their results reach the model whole, pictures included.opencode servethat one starts). The user's own opencode, and opencode in a terminal, are not touched.OPENCODE_CONFIG_CONTENT(from the environment or the connector'senvtable), the key is added to it and the rest is kept. If their value already sayspermission.execute, theirs stands. If it does not parse as JSON (opencode also reads JSONC), it is left as it is and the log says so in one line.permission.executeset there gives way to the chat's. The setting below is how to keep Code Mode.dialogram.chat.opencodeCodeMode(default off) leaves Code Mode on. It is declared by the Dialogram extension itself, besidedialogram.chat.useGlspMcpandautoLayoutAfterEdits; every product depends onebezati.dialogram, so no product needs a change. It takes effect when the chat next starts its agent.Why not opencode's per-server
codemode: false: the chat hands its MCP servers over through ACPnewSession, and opencode's ACP adapter keeps only a server's url and headers.Tests
opencode-code-mode.test.ts: no value; empty value; user value kept with the key added last; user value withoutpermission; userpermission.executekept whatever it says; JSONC left as it is with a one-line note; non-object values and a one-rulepermissionleft as they are.acp-client.test.ts: opencode 2 spawns with execute denied (the probe still sees the env as it was); user value from the process and from the connector env merged; user execute kept; JSONC kept with one warn line; the setting on leaves it unset; opencode 1.x and an unknown flavour untouched; claude, codex and gemini untouched.acp-client.test.ts(review): an opencode 2 connector without the HTTP API gets execute denied and no HTTP client; an opencode 1.x one gets no port; an unknown version logs one Code Mode line.npm run typecheck5/5, extension-core 681/681, neutrality 5/5.Review
code-review mediumfound five nits, no bugs:permission.executeis overridden in the chat (the env layer is read after it). Holds: the setting, the CHANGELOG and the module say so, and name the setting as the way to keep Code Mode.permissionwith a wildcard allow letsexecuteback in. Holds as wording: the comment and the log line now say so. Not changed in behaviour: injecting rules into agents the chat does not know would be guesswork.http_apiwas never probed, so an opencode 2 there kept Code Mode on, and an unknown version left no trace. Fixed: any connector whose command isopencodeis probed (HTTP API still off without the flag), and an unknown version logs one line. Tests added.OPENCODE_CONFIG_CONTENTis left alone. Not changed: that is the agreed behaviour (opencode reads JSONC; rewriting a value the chat cannot parse risks breaking it). The log line says so.acp.connectorsetting, and the description says it takes effect when the chat next starts its agent.https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu