Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,118 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
networking

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
131
Fork
48
Merge medio
4g 15h
PR unite (30g)
17

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/vscode-coder

Tutte le issue di coder/vscode-coder

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.