Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests

Open Beginner friendly
#55,369 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, frontend

Research direction

The Cache-Control header for /api/event is set in packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts, and the web client opens that stream with window.fetch. Start by reading the handler's response headers, then find where the web UI issues the event-stream fetch. Done when the stream response is no-store (or the client fetch uses cache: "no-store") and a second Firefox tab connects to /api/event without stalling.

Written by the indexing model from the issue text.

Description

reproduced
Description

In Firefox (also Firefox-based browsers such as Zen), the web UI's live event stream hangs as soon as the same opencode server is open in a second tab. The banner/loading state never clears until the other tab is closed.

GET /api/event is answered with Cache-Control: no-cache, no-transform. no-cache still allows storing, so Firefox writes the response into its HTTP cache. A concurrent request for the same URL then waits for that cache entry to finish being written - which never happens for an endless SSE stream. The second tab's /api/event requests are queued inside the browser forever:

  • DevTools shows them with no status, 0 B and "No timings for request" - they are never sent.
  • The server never sees them (nothing in the opencode log, no connection attempt).
  • The web client aborts each attempt after its 2 s connect deadline and retries, so the queue just grows.
  • Other requests to the same host at the same moment (e.g. /api/session/active) succeed instantly over the same HTTP/2 connection, so this is not a connection or stream limit - only the repeated /api/event URL is blocked.
  • Closing the other tab makes the stream connect immediately.

Server responses confirmed from opencode serve v2.0.23:

HTTP/1.1 200 OK
cache-control: no-cache, no-transform
x-accel-buffering: no
content-type: text/event-stream
Transfer-Encoding: chunked
Suggested fix

Either (or both):

  1. Server: send Cache-Control: no-store (e.g. no-store, no-transform) for /api/event (and other SSE endpoints) in packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts. Event streams should never be stored.
  2. Client: issue the event-stream fetch with cache: "no-store", which bypasses the HTTP cache entirely.

We worked around it by wrapping window.fetch in the web UI and re-issuing /api/event as new Request(request, { headers, cache: "no-store" }).

Steps to reproduce
  1. opencode serve, open the web UI in Firefox.
  2. Open the same server/project in a second Firefox tab.
  3. The second tab never receives live events; DevTools > Network shows /api/event requests piling up without status or timings.
  4. Close the first tab - the second connects immediately.
Related

#48771, #53498, #51857 describe stalled/never-connecting event streams with other causes; this is a further, browser-side cause with the same symptom.

OpenCode version

2.0.23

Operating System

macOS (Firefox 157 / Zen)

Dominant language
TypeScript
Stars
213k
Forks
28.4k
Avg merge
8h 51m
Merged PRs (30d)
289

Getting set up

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.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.