GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — browser: concurrent HTTP requests return empty 502 responses in desktop preview · Issue #59593 · anomalyco/opencode

browser: concurrent HTTP requests return empty 502 responses in desktop preview #59593

New issue
Copy link
New issue
Copy link
Open
Open
browser: concurrent HTTP requests return empty 502 responses in desktop preview#59593
Copy link

Description

@daniel-doktor
daniel-doktor
opened on Oct 27, 2026
Issue body actions

Description

Summary

OpenCode Desktop's in-app browser intermittently returns empty HTTP 502 responses when plain-HTTP requests overlap. This makes local development pages render without CSS, JavaScript, fonts, or images. A framework-free HTTP fixture reproduces the failure, and the failed requests never reach its HTTP handler.

Environment

  • opencode version: Desktop 2.2.0 (browser User-Agent); connected server 2.2.0 (opencode api get /api/info). Also observed earlier with Desktop 2.1.4.
  • OS: Desktop macOS (exact version unavailable); connected server Linux 7.0.14 aarch64, glibc 2.43.
  • Browser runtime: Electron 44.9.1 / Chromium 152.0.7977.167, per User-Agent.
  • Terminal: Server TERM=xterm-256color; desktop terminal not applicable.
  • Shell: Server /bin/bash.
  • Install/channel: Installed Desktop app; exact channel unavailable. Server runtime reports channel latest. No matching desktop update was offered when initially investigated.
  • Active plugins: Configured project plugin opencode-zeldoc; built-in browser plugin active. Other desktop plugin state unavailable.
  • Topology: Browser UI runs on macOS; tool execution and the connected server run in Linux. Preview localhost traffic resolves on that connected server, per the browser tool contract.

Reproduction

  1. On the connected server, run this minimal Node HTTP server:

    const http = require('node:http');
    const seen = [];
    http.createServer((req, res) => {
      const url = new URL(req.url, 'http://127.0.0.1');
      if (url.pathname === '/observations') {
        res.setHeader('content-type', 'application/json');
        return res.end(JSON.stringify(seen));
      }
      if (url.pathname === '/asset') {
        seen.push(url.searchParams.get('id'));
        res.setHeader('content-type', 'text/plain');
        return res.end('diagnostic asset');
      }
      res.setHeader('content-type', 'text/html');
      res.end('<!doctype html><title>Proxy diagnostic</title><h1>Proxy diagnostic</h1>');
    }).listen(3107, '127.0.0.1');
  2. Open http://127.0.0.1:3107/ in OpenCode's in-app browser.

  3. Evaluate this script in that browser tab using browser.evaluate:

    (async () => {
      const results = [];
      for (const count of [1, 6, 12]) {
        const batch = Date.now();
        const responses = await Promise.all(
          Array.from({ length: count }, async (_, i) => {
            const id = `${batch}-${count}-${i}`;
            try {
              const response = await fetch(`/asset?id=${id}`);
              return { id, status: response.status, body: await response.text() };
            } catch (error) {
              return { id, error: String(error) };
            }
          })
        );
        results.push({ count, responses });
      }
      return results;
    })()
  4. Compare successful IDs with curl http://127.0.0.1:3107/observations from the connected server.

Expected Behavior

All requests return HTTP 200 with diagnostic asset. Normal local development pages load their supporting assets.

Actual Behavior

One captured fixture run:

Concurrent requests | HTTP 200 | Empty HTTP 502 -- | -- | -- 1 | 1 | 0 6 | 2 | 4 12 | 1 | 11

Only the four successful requests appeared in the fixture's /observations output. The failed requests did not reach its HTTP handler.

The failure rate and threshold vary between runs. Some 502s arrive within roughly 6–14 ms; others take several hundred milliseconds. This is not established as a fixed connection limit.

Additional Context

  • Reproduces without Next.js, Uniform, CSP, external assets, or response compression. The minimal fixture has none of them.
  • The original symptom is HTML rendering without styles and functioning client-side JavaScript. Network diagnostics show empty 502 responses for CSS, JS, and fonts.
  • Twelve concurrent direct requests to the original development server all returned 200.
  • Loading the same CSS URL alone through the preview succeeds. Staggering four requests by 150 ms made all four succeed in the tested batch.
  • Also reproduced against public http://example.com: four of six parallel requests returned 502. The tested six-request batch to https://example.com returned six 200s. This suggests a plain-HTTP forwarding-path difference, not proof that all HTTPS workloads are unaffected.
  • Restarting Desktop restored general navigation after it stopped loading even external sites, but did not resolve the concurrent HTTP asset failures. Both localhost and 127.0.0.1 were tested.
  • A reduced Node harness using the v2.2.0 proxy and server tunnel source (commit 1097e2668b1e08ad63bdf0b1c4860b9bc01e420c), connected via a substitute HTTP transport, passes batches up to 24 concurrent requests. It also passes with Effect 4.0.1 and @effect/platform-node 4.0.1's Node HTTP client. It is not the complete authenticated RPC/Electron integration, so this does not identify the exact fault.
  • In packages/plugin-browser/src/proxy.ts, forwarding exceptions become empty 502s without preserving the exception in that handler. Capturing the first failed tunnel operation and safe nested RPC error would help locate the failure.
  • Stale CLOSE_WAIT sockets were observed in the installed server, but no increasing leak or exhausted 64-connection limit has been demonstrated; this remains unconfirmed.
  • No security settings or installed OpenCode binaries were modified. Chrome is the working workaround. No precise root cause or fix is claimed.
Summary OpenCode Desktop's in-app browser intermittently returns empty HTTP 502 responses when plain-HTTP requests overlap. This makes local development pages render without CSS, JavaScript, fonts, or images. A framework-free HTTP fixture reproduces the failure, and the failed requests never reach its HTTP handler.

Environment
opencode version: Desktop 2.2.0 (browser User-Agent); connected server 2.2.0 (opencode api get /api/info). Also observed earlier with Desktop 2.1.4.
OS: Desktop macOS (exact version unavailable); connected server Linux 7.0.14 aarch64, glibc 2.43.
Browser runtime: Electron 44.9.1 / Chromium 152.0.7977.167, per User-Agent.
Terminal: Server TERM=xterm-256color; desktop terminal not applicable.
Shell: Server /bin/bash.
Install/channel: Installed Desktop app; exact channel unavailable. Server runtime reports channel latest. No matching desktop update was offered when initially investigated.
Active plugins: Configured project plugin opencode-zeldoc; built-in browser plugin active. Other desktop plugin state unavailable.
Topology: Browser UI runs on macOS; tool execution and the connected server run in Linux. Preview localhost traffic resolves on that connected server, per the browser tool contract.
Reproduction
On the connected server, run this minimal Node HTTP server:
const http = require('node:http');
const seen = [];
http.createServer((req, res) => {
const url = new URL(req.url, 'http://127.0.0.1');
if (url.pathname === '/observations') {
res.setHeader('content-type', 'application/json');
return res.end(JSON.stringify(seen));
}
if (url.pathname === '/asset') {
seen.push(url.searchParams.get('id'));
res.setHeader('content-type', 'text/plain');
return res.end('diagnostic asset');
}
res.setHeader('content-type', 'text/html');
res.end('<!doctype html><title>Proxy diagnostic</title>

Proxy diagnostic

');
}).listen(3107, '127.0.0.1');
Open http://127.0.0.1:3107/ in OpenCode's in-app browser.
Evaluate this script in that browser tab using browser.evaluate:
(async () => {
const results = [];
for (const count of [1, 6, 12]) {
const batch = Date.now();
const responses = await Promise.all(
Array.from({ length: count }, async (_, i) => {
const id = ${batch}-${count}-${i};
try {
const response = await fetch(/asset?id=${id});
return { id, status: response.status, body: await response.text() };
} catch (error) {
return { id, error: String(error) };
}
})
);
results.push({ count, responses });
}
return results;
})()
Compare successful IDs with curl http://127.0.0.1:3107/observations from the connected server.
Expected Behavior
All requests return HTTP 200 with diagnostic asset. Normal local development pages load their supporting assets.

Actual Behavior
One captured fixture run:

Concurrent requests HTTP 200 Empty HTTP 502
1 1 0
6 2 4
12 1 11
Only the four successful requests appeared in the fixture's /observations output. The failed requests did not reach its HTTP handler.

The failure rate and threshold vary between runs. Some 502s arrive within roughly 6–14 ms; others take several hundred milliseconds. This is not established as a fixed connection limit.

Additional Context
Reproduces without Next.js, Uniform, CSP, external assets, or response compression. The minimal fixture has none of them.
The original symptom is HTML rendering without styles and functioning client-side JavaScript. Network diagnostics show empty 502 responses for CSS, JS, and fonts.
Twelve concurrent direct requests to the original development server all returned 200.
Loading the same CSS URL alone through the preview succeeds. Staggering four requests by 150 ms made all four succeed in the tested batch.
Also reproduced against public http://example.com/: four of six parallel requests returned 502. The tested six-request batch to https://example.com/ returned six 200s. This suggests a plain-HTTP forwarding-path difference, not proof that all HTTPS workloads are unaffected.
Restarting Desktop restored general navigation after it stopped loading even external sites, but did not resolve the concurrent HTTP asset failures. Both localhost and 127.0.0.1 were tested.
A reduced Node harness using the v2.2.0 proxy and server tunnel source (commit 1097e26), connected via a substitute HTTP transport, passes batches up to 24 concurrent requests. It also passes with Effect 4.0.1 and @effect/platform-node 4.0.1's Node HTTP client. It is not the complete authenticated RPC/Electron integration, so this does not identify the exact fault.
In packages/plugin-browser/src/proxy.ts, forwarding exceptions become empty 502s without preserving the exception in that handler. Capturing the first failed tunnel operation and safe nested RPC error would help locate the failure.
Stale CLOSE_WAIT sockets were observed in the installed server, but no increasing leak or exhausted 64-connection limit has been demonstrated; this remains unconfirmed.
No security settings or installed OpenCode binaries were modified. Chrome is the working workaround. No precise root cause or fix is claimed.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot

No response

Operating System

No response

Terminal

No response

Reacted by Vladimir Danchenkov

Activity

  1. opencode-agent commented on Oct 27, 2026

    @opencode-agent
    opencode-agentBot
    on Oct 27, 2026 – with OpenCode Agent
    Contributor
    More actions

    Thanks for the detailed report and the minimal fixture. I couldn't reproduce this here: it needs OpenCode Desktop with its in-app browser connected to a separate server, and this sandbox can only run headless Linux. A maintainer with a desktop setup will need to check it.

    From reading the code, without running it:

    • The browser proxy (forward() in packages/plugin-browser/src/proxy.ts) turns every forwarding error into an empty 502 and discards the error. That matches what you see.
    • Every plain-HTTP request opens a new tunnel, and the server allows at most 64 per browser connection (packages/plugin-browser/src/tunnel.ts). That shouldn't be reached at 6–12 requests unless closed tunnels aren't being released, which could fit the stuck CLOSE_WAIT sockets you noticed. This is unconfirmed.

    Related open PRs that may change this behaviour:

    • fix(desktop): persist browser sessions across restarts, prevent tab unmounts, and increase tunnel limit #53453: raises the per-connection tunnel limit from 64 to 512
    • refactor(browser): stream proxy traffic over binary WebSockets #55528: replaces the browser proxy's JSON-RPC transport with binary WebSockets
  2. daniel-doktor commented on Oct 27, 2026

    @daniel-doktor
    daniel-doktor
    on Oct 27, 2026
    Author
    More actions

    Environment clarification: OpenCode Desktop runs on macOS, while the connected OpenCode server and development server run inside a Linux sandbox—not directly on the macOS host. The in-app preview reaches the development server through OpenCode’s proxy/tunnel path into that sandbox.

    The minimal HTTP fixture also ran inside the sandbox. Concurrent requests through the desktop preview returned empty 502 responses, while direct concurrent requests from within the sandbox succeeded.

    Sandbox/network integration has not been ruled out as the cause. The reduced standalone proxy/tunnel harness did not reproduce the failure, so this should not yet be treated as a confirmed general defect in OpenCode’s HTTP forwarding code.

  3. daniel-doktor commented on Nov 2, 2026

    @daniel-doktor
    daniel-doktor
    on Nov 2, 2026
    Author
    More actions

    Anything?

  4. axelhildingson commented on Nov 27, 2026

    @axelhildingson
    axelhildingson
    on Nov 27, 2026
    More actions

    Still reproduces on 2.4.2 (Desktop macOS ↔ opencode serve in a Linux VM). Evidence for the unreleased-tunnel theory:

    • Preview of a Vite dev server (0.0.0.0:8080 in the VM) returns empty 502s. From inside the VM, curl localhost:8080 returns 200.
    • About 30 min after a fresh server start, ss -tanp in the VM shows 60 CLOSE-WAIT sockets to :8080, all owned by opencode serve. Vite has closed its side; the server never closes its own. That's close to the 64-tunnel limit in tunnel.ts, so new tunnels fail and forward() returns empty 502s.
    • 7 of those sockets still have 300 KB–3.4 MB unread in Recv-Q, so the tunnel stops reading upstream without tearing it down.
    • Desktop main.log records nothing for these 502s.
    • Restarting the server clears the sockets. They build up again (57 on an earlier run).

    Raising the limit (#53453) would only delay this. The fix is to close the upstream socket when either side of the tunnel ends.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.