Preserve full model output on parse failure (diffsmith-2xy) - #3
Merged
Conversation
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>
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.
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.