You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Category: bug | Status: Partially confirmed (verified against main @ 525706267) | Severity: medium
Claim-by-claim result against the current source:
Claim
Result
Evidence
(a) hasField() on exit_code turns exit 0 into Integer.MIN_VALUE
Not confirmed on main
the exit code is read with end.getField(ec) with no presence check (E2bEnvdProcessClient.java:203-209); there is no Integer.MIN_VALUE sentinel anywhere in the class
(b) EndStream envelopes (flags bit 1) are not parsed; error end-streams are silently ignored
Confirmed
every non-zero flag byte is dropped by if (flags != 0x00) continue; (:189-190), so an EndStreamMessage — including a Connect error end-stream — never reaches any handler
same flags != 0x00 skip (:189-190); length is ByteBuffer.getInt() & 0x7FFFFFFF (:181), which makes the len < 0 guard at :182 unreachable and silently truncates the top bit of a legitimate length ≥ 2^31
(d) EndEvent.error (signal kills) never reaches stderr
Confirmed
stderr is only fed from DataEvent.stderr (:198-201, :221-233); the end branch reads exit_code only (:203-209), and the JSON path reads exitCode only (:341-350)
Two refinements worth recording:
The real failure mode for a missing/zero exit code is not a wrong int — it is the terminal IOException("envd process stream ended before receiving a process exit code") at :215-218. On the JSON branch an end object without a convertible exitCode is dropped entirely (:341-350, the setField is inside the canConvertToInt() guard), so an error-only end event is indistinguishable from a truncated stream. On the protobuf branch a present end with an omitted exit_code correctly yields 0.
The (b)/(c) defects are what actually make exit codes misreport in production: an EndStream carrying a Connect error is skipped, the loop then hits EOF and throws the generic "stream ended before…" exception, so the real cause (server-side error, compressed frame, or oversized length) is lost.
Coordination: PR #3341 (split/e2b-a-envd-parsing) is open against this issue and main does not contain those changes yet. We are not opening a competing PR. Suggested coverage for #3341: protobuf exit_code = 0, JSON end without exitCode, JSON end with error only, EndStream with error flags, compressed frame rejection, reserved-bit skip, and a length value with the top bit set.
Activity
oss-maintainer commentedon Sep 28, 2026
Issue Evaluation
Category:
bug| Status: Partially confirmed (verified againstmain@525706267) | Severity: mediumClaim-by-claim result against the current source:
hasField()onexit_codeturns exit 0 intoInteger.MIN_VALUEmainend.getField(ec)with no presence check (E2bEnvdProcessClient.java:203-209); there is noInteger.MIN_VALUEsentinel anywhere in the classif (flags != 0x00) continue;(:189-190), so anEndStreamMessage— including a Connect error end-stream — never reaches any handler& 0x7FFFFFFFlength mask contradicts the unsigned specflags != 0x00skip (:189-190); length isByteBuffer.getInt() & 0x7FFFFFFF(:181), which makes thelen < 0guard at:182unreachable and silently truncates the top bit of a legitimate length ≥ 2^31EndEvent.error(signal kills) never reaches stderrDataEvent.stderr(:198-201,:221-233); theendbranch readsexit_codeonly (:203-209), and the JSON path readsexitCodeonly (:341-350)Two refinements worth recording:
IOException("envd process stream ended before receiving a process exit code")at:215-218. On the JSON branch anendobject without a convertibleexitCodeis dropped entirely (:341-350, thesetFieldis inside thecanConvertToInt()guard), so an error-only end event is indistinguishable from a truncated stream. On the protobuf branch a presentendwith an omittedexit_codecorrectly yields0.Coordination: PR #3341 (
split/e2b-a-envd-parsing) is open against this issue andmaindoes not contain those changes yet. We are not opening a competing PR. Suggested coverage for #3341: protobufexit_code = 0, JSONendwithoutexitCode, JSONendwitherroronly, EndStream with error flags, compressed frame rejection, reserved-bit skip, and a length value with the top bit set.Automated evaluation by github-manager-bot
fix(e2b): harden envd process streaming response parsing [1/3] (#3341)