Repository navigation
Conversation
PluginInput.serverUrl returned http://localhost:4096 whenever the process had no HTTP listener, which is every TUI started without --port. Plugins that call that URL then reach whatever else holds 4096: another opencode instance, a leftover `serve`, or an unrelated service. Requests meant for this process (session prompts, status probes) land on the stranger and are lost. The SDK client passed to plugins was already correct: without a listener it fetches the in-process app directly. Only serverUrl lied. serverUrl now mirrors Server.url and is undefined when nothing listens. The PluginInput type marks it optional and documents that `client` is the in-process route in that case.
Author
|
Friendly ping: this one has been quiet for a week. CI is green and it is a small, self-contained fix - happy to adjust anything if a maintainer has a moment to take a look. Thanks! |
Nowaker
added a commit
to Nowaker/opencode
that referenced
this pull request
Nov 17, 2026
Add pr-queue/00-open-slots.md as the daily drain's record of the three open author PRs (anomalyco#63062, anomalyco#63063, anomalyco#63897), their checks, next nudges and a log of every nudge, starting with the 2026-11-17 pings on anomalyco#63062 and anomalyco#63063. Mark entry 06 filed as anomalyco#63897; it still read "not filed" after anomalyco#54578 closed and freed its slot. The cap stays full and entry 10 is next in line. AI-Model: anthropic/claude-opus-5-5 AI-Variant: high AI-Tool: opencode 1.18.34-vt-101-907b3bc518 AI-Platform: linux AI-Harness: Vibeterm 3c3f1fadd21 AI-Session-ID: ses_eeda1d251ffel81U5Y42j4kb33
This branch has not been 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.
Issue for this PR
Fixes #39561
Type of change
What does this PR do?
PluginInput.serverUrlno longer inventshttp://localhost:4096when the process has no HTTP listener. It mirrorsServer.urland isundefinedin that case. ThePluginInputtype marks the field optional and documents thatclientis the in-process route when it is absent.A TUI started without
--porthas no listener, yet every plugin was told the server is atlocalhost:4096. Plugins that make raw HTTP calls toserverUrl(wake-ups, status probes, session prompts) then reach whatever else holds port 4096: another opencode instance, a leftoveropencode serve, or an unrelated service. We hit this in practice: a plugin probed a stranger on 4096 (/global/health200), posted aprompt_asyncthere (204), and the wake meant for the local session was silently lost.The SDK
clienthanded to plugins was already correct: with no listener it fetches the in-process app directly. OnlyserverUrlmisreported the situation.Compatibility:
serverUrl: URLbecomesserverUrl?: URL. Plugins that read it unconditionally get a type error pointing at the case they were already mishandling; at runtime they seeundefinedinstead of a URL that may belong to another process. Plugins that need to talk to this process should useclient.How did you verify your code works?
packages/opencode/test/plugin/server-url.test.tsloads a real plugin throughPlugin.Service:serverUrlisundefinedandclient.project.current()still resolves the instance in-process;Server.listen({ port: 0 }),serverUrlequals the listener URL and the client works over HTTP.The first test fails on the previous code with
http://localhost:4096/.bun test test/plugin212 pass;bun typecheckclean inopencode,plugin,sdk/js,tui.Screenshots / recordings
N/A
Checklist
This PR is AI generated, but under direct supervision and on request of @Nowaker.