Skip to content

Preserve full model output on parse failure (diffsmith-2xy) - #3

Merged
selyafi merged 1 commit into
mainfrom
debug/preserve-raw-on-parse-failure
Jun 10, 2026
Merged

Preserve full model output on parse failure (diffsmith-2xy)#3
selyafi merged 1 commit into
mainfrom
debug/preserve-raw-on-parse-failure

Conversation

@selyafi

@selyafi selyafi commented Jun 10, 2026

Copy link
Copy Markdown
Owner

When a model returned unparseable output, ParseError.Raw was clipped to 200 chars at capture time and ParseError.Error() never included it — so a model that emitted garbage left no trace of what it actually said. The error is wrapped (%w) by the adapters and printed (%v) in the dropped- model run summary, meaning the user saw only "parse model output (invalid_json): " with zero offending bytes.

Retain the full raw payload on ParseError.Raw (untruncated) and surface a bounded 200-char snippet in Error(). Full payload stays on Raw for any future --debug-to-disk surface. Pure model-layer change; adapters need no edits since they already wrap the ParseError.

TDD: parse_test.go gains a full-raw-preserved test and a snippet-in- message test (both RED first). Full suite + go vet green.

When a model returned unparseable output, ParseError.Raw was clipped to
200 chars at capture time and ParseError.Error() never included it — so a
model that emitted garbage left no trace of what it actually said. The
error is wrapped (%w) by the adapters and printed (%v) in the dropped-
model run summary, meaning the user saw only "parse model output
(invalid_json): <json err>" with zero offending bytes.

Retain the full raw payload on ParseError.Raw (untruncated) and surface a
bounded 200-char snippet in Error(). Full payload stays on Raw for any
future --debug-to-disk surface. Pure model-layer change; adapters need no
edits since they already wrap the ParseError.

TDD: parse_test.go gains a full-raw-preserved test and a snippet-in-
message test (both RED first). Full suite + go vet green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@selyafi
selyafi merged commit b05fd44 into main Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant