Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Read handshake status from public API instead of parsing library error strings

オープン
#1,118 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
networking

調査の方向性

Read handshakeStatus in src/websocket/utils.ts and trace the SSE path through SseConnection.createErrorEvent in src/websocket/sseConnection.ts; first run test/unit/websocket/utils.test.ts to understand the existing coverage. Check how the public event data reaches handshakeStatus, then verify that unrecoverable-HTTP handling and the SSE 404 fallback still work without relying on error message text.

索引モデルが issue の本文から書いたものです。

説明

enhancement tech-debt
Background

handshakeStatus (src/websocket/utils.ts) recovers the HTTP status of a failed
WebSocket/SSE handshake by parsing the error message text from two libraries:

  • ws — Unexpected server response: <code>
  • eventsource — Non-200 status code (<code>)

Neither string is a public contract; both are plain template literals
(ws/lib/websocket.js and eventsource/src/EventSource.ts). If either reword on
a version bump, handshakeStatus returns undefined, every unrecoverable status
becomes a retry-forever connection_error, and CoderApi.is404Error stops
falling back to SSE.

A real-library test (test/unit/websocket/utils.test.ts) now guards against a
silent reword by failing in CI, but parsing internal strings is still fragile.

Proposal

Read the status from the libraries' public event APIs instead of the message:

  • SSE: eventsource puts the status on ErrorEvent.code (documented public
    API). SseConnection.createErrorEvent (src/websocket/sseConnection.ts)
    currently reads only message and error and drops code; surface it.
  • WebSocket: ws exposes the same on its unexpected-response event, which
    also suppresses the string path once handled.

Once the status comes from the events, handshakeStatus's string parsing can be
narrowed or removed.

Acceptance
  • Handshake status is derived from ErrorEvent.code / the ws
    unexpected-response event, not the error message text.
  • Unrecoverable-HTTP handling and the SSE 404 fallback keep working.

Filed by Coder Agents on behalf of @aqandrew, as a follow-up to PR #1100.

主要言語
TypeScript
スター
131
フォーク
48
平均マージ
4日 15時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

coder/vscode-coder のほかの issue

coder/vscode-coder の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。