envd: distinguish expected stdin lifecycle errors from CodeInternal

Aperta
#3,622 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, javascript, python

Direzione di ricerca

Inizia da Process.SendInput, Handler.WriteStdin e CloseStdin, quindi segui il modo in cui Connect espone i relativi errori e in cui il flusso indipendente EndEvent segnala la terminazione. Verifica la gestione di questi errori negli SDK Python e JavaScript. Il lavoro è completato quando i selettori inesistenti producono CodeNotFound, stdin non disponibile produce CodeFailedPrecondition, l'I/O imprevisto rimane CodeInternal ed EndEvent rimane autorevole.

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

Descrizione

Problem

Process.SendInput currently maps every Handler.WriteStdin failure to
CodeInternal.

Some of these failures are expected process lifecycle outcomes:

  • stdin is disabled or already closed;
  • a PTY process receives stdin input;
  • the process exits and its stdin pipe returns EPIPE/file-already-closed.

CodeInternal is reserved for serious invariant failures, so clients cannot
distinguish a normal process-state transition from an unexpected envd failure.

This also races with the Start response stream: SendInput can return
CodeInternal before the process's EndEvent arrives on the independent stream.

Proposed semantics

  • process selector no longer exists: CodeNotFound
  • process exists but cannot accept stdin: CodeFailedPrecondition
  • unexpected underlying I/O failure: CodeInternal

CloseStdin should follow the same error taxonomy.

The EndEvent remains authoritative for exit status; a SendInput error alone
must not be treated as the terminal process result.

Compatibility

This changes observable Connect error codes, although callers that only check
for a non-nil error are unaffected. Python and JavaScript SDK behavior should
be checked before merging.

Reproduction

Start a short-lived non-PTY process, wait for its stdin pipe to close, then
call SendInput before the delayed EndEvent is delivered. The current service
returns CodeInternal for the closed pipe.

Lingua principale
Go
Stelle
1.6k
Fork
438
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 e2b-dev/runtime

Tutte le issue di e2b-dev/runtime

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.