envd: distinguish expected stdin lifecycle errors from CodeInternal
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- go, javascript, python
- Domain
- api, backend, backend-api-design
Research direction
Start at Process.SendInput, Handler.WriteStdin, and CloseStdin, then trace how Connect exposes their errors and how the independent EndEvent stream reports termination. Check the Python and JavaScript SDK handling of these errors. Done means nonexistent selectors produce CodeNotFound, unavailable stdin produces CodeFailedPrecondition, unexpected I/O remains CodeInternal, and EndEvent remains authoritative.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Go
- Stars
- 1.6k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from e2b-dev/runtime
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
sandbox cache: StartRemoving state transition not broadcast, all allocations see stale Running state Open
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Similar issues
-
area/dev-productivity area/disaster-recovery area/ipcei kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
kind/bug status/0-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
🤔 refinement needed
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
equinor/radix-operator#1979 ·