Skip to content

Conversation

@zerone0x
Copy link
Contributor

What does this PR do?

Fixes #8407
Fixes #7549

When using direct RPC communication (the default mode), the "Open WebUI" command in the command palette was trying to open http://opencode.internal/ - a placeholder URL that doesn't resolve on any system. This caused DNS errors like:

This site can't be reached
opencode.internal's DNS address could not be found.

The root cause is that when OpenCode starts without explicit --port or network options, it uses direct RPC communication via Worker threads instead of starting an HTTP server. The sdk.url in this case is set to the non-routable placeholder.

The fix

This PR adds an onStartServer callback that lazily starts an HTTP server when the user selects "Open WebUI" from the command palette and no server is already running. The callback:

  1. Calls the worker RPC to start a real server on localhost
  2. Returns the actual URL (e.g., http://127.0.0.1:4096/)
  3. Opens that URL in the browser

This matches the behavior of opencode web which correctly opens localhost.

How did you verify your code works?

  • Code review of the fix logic
  • Verified the pattern matches existing RPC calls in thread.ts
  • Confirmed typecheck passes (the @gitlab/gitlab-ai-provider error is pre-existing in upstream/dev)

🤖 Generated with Claude Code

When using direct RPC communication (no HTTP server), the "Open WebUI" command
in the command palette was trying to open "http://opencode.internal" which is
a placeholder URL that doesn't resolve. This caused "DNS address could not be
found" errors for users.

The fix adds an onStartServer callback that lazily starts an HTTP server when
the user selects "Open WebUI" and no server is already running. This matches
the behavior of `opencode web` which correctly opens localhost.

Fixes anomalyco#8407
Fixes anomalyco#7549

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webUI open with opencode.internal instead of 127.0.0.1 from cmd pallete Open WebUI command not working on WSL

1 participant