anomalyco / anomalyco/opencode

Terminal WebSocket URL contains a double slash when the server URL ends with /

Open
#45,891 1 comment 0 reactions 1 assignee View on GitHub

@Brendonovich is already working on this.

Since Aug 28, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When a configured server URL ends with /, opening a terminal constructs its WebSocket URL with a double slash before the PTY route. Servers and reverse proxies that do not normalize repeated slashes can reject the connection with a 404, leaving the terminal unable to connect.

The terminal URL helper appends the PTY route directly to the server URL. For example, combining https://example.test/ with /api/pty/pty_test/connect produces a pathname beginning with //api. Parsing the base URL first and joining the pathname at a single slash boundary would preserve the server path while avoiding the duplicate separator.

Plugins

N/A

OpenCode version

N/A (reproduced in the URL helper)

Steps to reproduce
  1. Configure the server URL as https://example.test/, including the trailing slash.
  2. Create a terminal connection with PTY ID pty_test.
  3. Inspect the WebSocket URL produced for the terminal connection.

Observed URL:

wss://example.test//api/pty/pty_test/connect

Expected URL:

wss://example.test/api/pty/pty_test/connect

The same result can be reproduced directly by evaluating new URL("https://example.test//api/pty/pty_test/connect").pathname, which returns //api/pty/pty_test/connect.

Screenshot and/or share link

Not provided; the generated URL above is the deterministic reproduction.

Operating System

All

Terminal

Web and desktop terminal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.