web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests
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
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
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/eventURL 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):
- Server: send
Cache-Control: no-store(e.g.no-store, no-transform) for/api/event(and other SSE endpoints) inpackages/opencode/src/server/routes/instance/httpapi/handlers/event.ts. Event streams should never be stored. - 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
opencode serve, open the web UI in Firefox.- Open the same server/project in a second Firefox tab.
- The second tab never receives live events; DevTools > Network shows
/api/eventrequests piling up without status or timings. - 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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from anomalyco/opencode
-
reproduced
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
anomalyco/opencode#55351 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
anomalyco/opencode#55285 · 2 comments ·
Maintainers usually reply within 1 day
-
opencode on clean macos zsh .export path not working because it append and it fails because no ~/.zshrc filePossibly taken @fihaaade claimed this 1 day ago. Openreproduced
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anomalyco/opencode#55068 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anomalyco/opencode#54919 · 1 comment ·
Maintainers usually reply within 1 day
-
triaging
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
anomalyco/opencode#54887 · 1 comment ·
Maintainers usually reply within 1 day
All issues in anomalyco/opencode
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vercel/streamdown#673 · 1 reaction ·
Maintainers usually reply within 1 day
-
docs(stream-protocol): document messageMetatadata on start/finish and the message-metadata chunkOpenfactory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
agilepathway/label-checker#721 ·
Maintainers usually reply within 1 day
-
CLI Empathy needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
chromaui/chromatic-cli#1524 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day