Repository navigation
fix(opencode): do not append --port to the acp launch command - #1177
Merged
catatafishen merged 1 commit intoOct 12, 2026
Merged
Conversation
OpenCode 2's acp command has no --port flag and exits on unknown flags, so the auto-injected flag from the subagent transcript feature broke every OpenCode session launch. Only an explicit --port from the agent profile's extra CLI arguments is honored now; without one the transcript endpoint stays cleared and the feature degrades gracefully.
BambinoSK
requested a deployment
to
fuzzing-gate
October 12, 2026 14:38 — with
GitHub Actions
Waiting
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Owner
|
Thanks, I hadn't tested that on opencode 2.x.x |
catatafishen
pushed a commit
that referenced
this pull request
Oct 12, 2026
….x keeps subagent transcripts
OpenCode 2's `acp` command has no --port flag and exits on it ("Unrecognized flag: --port"),
so the port pinned for the subagent transcript feature (#1173) stopped every 2.x session from
starting (#1176). OpenCode 1.x accepts the flag and the transcript depends on it.
- AcpClient.finalizeCommand: new hook, called once the binary is resolved and validated, so a
client can run the binary before deciding on flags. buildCommand runs before resolution.
- OpenCodeVersionProbe: runs `<binary> --version` with the launch environment (5 s timeout) and
extracts the version. The version OpenCode reports in the ACP initialize response arrives too
late for a launch flag.
- OpenCodeClient.pinServerPort: explicit --port from the profile is kept as is; 1.x gets a free
port appended; 2.x or an undeterminable version gets none, with the reason logged.
- On 2.x there is no transcript source yet. loadSubAgentTranscript returns null there instead of
throwing, since an IOException becomes a chat error entry after every sub-agent. A missing
address on 1.x (before launch, after stop) is still an error.
Supersedes the removal of the port in #1177, which would also have dropped transcripts for 1.x.
Fixes #1176
This branch is waiting to be deployed
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.
Fixes #1176.
Problem
Since the subagent transcript feature, starting the OpenCode agent fails immediately:
OpenCodeClient.addServerPortappended--port <free port>to theopencode acplaunch command. OpenCode 2'sacpcommand has no--portflag: its command spec (packages/cli/src/commands/commands.tsondev) defines exactly one flag,--login, and the parser exits on unknown flags. Reproduced withopencode v2.0.27:The CLI docs table for
acplists--port/--hostname/--mdns/--cors, but those are theserve/webflags; theacphandler spawns its own internal server (opencode serve --stdio --port 0) with a random per-launch password, so an external client cannot reach it with or without the flag. The same flag removal already hit OpenCode's own VS Code extension (anomalyco/opencode#49085).What this PR does
--portto theopencode acplaunch command, so OpenCode sessions start again.--portpassed in the agent profile's extra CLI arguments (user override), still publishing it to the transcript endpoint.loadSubAgentTranscripterror message is updated to match.addServerPorttorecordServerPortto reflect that it no longer adds flags.Subagent transcripts (#1173) remain unavailable with this change until the feature is reworked on a supported mechanism (the pinned-port approach cannot reach the server
opencode acpspawns internally).Verification
:plugin-core:compileJava+compileTestJavapass*OpenCodeClientBehaviorTest*passes, including two new regression tests pinning thatrecordServerPortnever appends flags (with and without an explicit--port)*OpenCodeClientModelRoutingTest*,*OpenCodeServerEndpointTest*,*OpenCodeSessionHttpClientTest*pass:plugin-core:buildPluginsucceeds; installed the zip and verified an OpenCode 2 session launches from the agent dropdown, with theNo --port pinnedwarning in the IDE log instead of theUnrecognized flagcrashCloses #1176