Repository navigation
fix(exec): preserve JSON results for input and setup errors - #34
Merged
Merged
Conversation
Per ADR-0004, src/exec.js guarantees emitting exactly one JSON object on stdout for all outcomes so programmatic callers like the grader and e2b-bench can reliably parse the result. Previously, invalid CLI JSON payload arguments, store reading errors, or config loading failures threw unhandled exceptions before reaching the runner's try/catch block, dumping stack traces to stderr and violating the stdout JSON contract. Wrap payload parsing, store reading, and config loading in try/catch blocks that route errors through emit().
OndrejDrapalik
approved these changes
Sep 7, 2026
OndrejDrapalik
left a comment
Collaborator
There was a problem hiding this comment.
Input validation now prevents malformed values from escaping the JSON error contract. The isolated tests cover missing/corrupt records, credentials and configuration errors, and the redundant store catch is removed. Fresh CI passed across Node 22/24 on Ubuntu/macOS and the Rust/version checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Malformed CLI input and configuration/credential failures could crash exec.js before it emitted the JSON result consumed by the grader. Validate the key, command and timeout, and route JSON parsing and configuration errors through the existing result emitter. Failed setup returns one JSON object with ok:false and exitCode:null.
The store keeps its existing behavior: missing or malformed records return the no-sandbox JSON error. Numeric timeout strings remain supported. Invalid timeout values are rejected before coercion or SDK activity.
Four isolated CLI tests pass, covering malformed/null input, invalid field and timeout types, missing/corrupt records, missing credentials and invalid configuration. Fixtures use temporary HOME, config and record directories.