Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#55,369 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend, frontend

Línea de trabajo

El encabezado Cache-Control de /api/event se define en packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts, y el cliente web abre ese stream con window.fetch. Empieza leyendo los encabezados de respuesta del handler y luego busca dónde la UI web lanza el fetch del event-stream. Está terminado cuando la respuesta del stream es no-store (o el fetch del cliente usa cache: "no-store") y una segunda pestaña de Firefox se conecta a /api/event sin quedarse bloqueada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)

Lenguaje dominante
TypeScript
Estrellas
213k
Forks
28.4k
Merge medio
8 h 51 min
PR fusionados (30 d)
289

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anomalyco/opencode

Todos los issues de anomalyco/opencode

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.