fix(exec): emit JSON error payload on startup and store failure - #34
Open
adi-IL wants to merge 1 commit into
Open
fix(exec): emit JSON error payload on startup and store failure#34adi-IL wants to merge 1 commit into
adi-IL wants to merge 1 commit into
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().
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.
Per ADR-0004,
src/exec.jsguarantees emitting exactly one JSON object on stdout for all execution and error states so programmatic consumers (such ase2b-benchand automated grading harnesses) can reliably parse results without raw stderr crashes.Previously, invalid JSON payloads passed via CLI arguments, store read errors, or credential configuration errors threw unhandled exceptions prior to the runner's
try/catchblock.This patch:
JSON.parseand routes them throughemit({ error: ... }).readRecord(key)throughemit().loadConfig()andsdkConn()to return structured JSON errors when credentials or configurations fail.test/exec.test.js.