web: second Firefox tab never connects to /api/event - Cache-Control: no-cache lets Firefox's HTTP cache block concurrent SSE requests
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Cache-Control ヘッダー(/api/event 用)は packages/opencode/src/server/routes/instance/httpapi/handlers/event.ts で設定されており、Web クライアントは window.fetch でそのストリームを開きます。まずハンドラーのレスポンスヘッダーを読み、次に Web UI が event-stream の fetch を発行している箇所を探してください。ストリームのレスポンスが no-store になっている(またはクライアントの fetch が cache: "no-store" を使っている)こと、そして2つ目の Firefox タブが停止せずに /api/event へ接続できることで完了です。
索引モデルが issue の本文から書いたものです。
説明
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)
- 主要言語
- TypeScript
- スター
- 213k
- フォーク
- 28.4k
- 平均マージ
- 8時間 32分
- マージ済み PR(30日)
- 253
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
anomalyco/opencode のほかの issue
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
anomalyco/opencode#55676 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
tui: NumPad End/Home ignored under kitty keyboard protocol (Windows Terminal reports KP_END 57424)対応中かも @argszero が今日担当しました。 オープンreproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
anomalyco/opencode#55533 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
pending close triaging
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
anomalyco/opencode#55392 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
anomalyco/opencode#55383 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
anomalyco/opencode#55351 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
anomalyco/opencode の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
xdjs/MusicNerdWeb#1532 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
sebastian-software/ardo#352 ·
メンテナーはふだん 1 日以内に返信
-
@react95/core good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 3 日以内に返信
-
@shikijs/stream: `ShikiStreamTokenizer.clone()` shares its `tokensStable` array with the original対応中かも @xyrolle が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信