anomalyco / anomalyco/opencode
Terminal WebSocket URL contains a double slash when the server URL ends with /
@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
- Configure the server URL as
https://example.test/, including the trailing slash. - Create a terminal connection with PTY ID
pty_test. - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.