Make a rejected plan diagnosable - #30
Merged
Merged
Conversation
Two changes, both about the same failure: a decompose attempt is reported as "response is not valid JSON" and there is no way to see what the model actually said. _extract_json now decodes the first complete object with JSONDecoder.raw_decode and ignores whatever follows it. json.loads is strict about trailing content, so a model that closes its object and then adds a sentence of commentary -- or leaves a ``` fence unclosed, which defeats the regex path -- was rejected even though a complete, usable plan was sitting right there. The rejection journal entry gains agent_stdout_path. A 500-character stderr head is enough to see *that* a plan was rejected and useless for seeing *why*, because the malformed part of a plan is almost always near its end; the full response now goes to runs/<id>/artifacts/ so a rejection is diagnosable after the fact rather than only reproducible. Best effort: a journal without a path, an empty response, or an unwritable directory leaves the entry as it was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S7Y1ASxt4ox8riauVcYCsF
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.
What this changes
Two changes, both about the same failure: a decompose attempt is reported as "response is not valid JSON" and there is no way to see what the model actually said.
_extract_json now decodes the first complete object with JSONDecoder.raw_decode and ignores whatever follows it. json.loads is strict about trailing content, so a model that closes its object and then adds a sentence of commentary -- or leaves a ``` fence unclosed, which defeats the regex path -- was rejected even though a complete, usable plan was sitting right there.
The rejection journal entry gains agent_stdout_path. A 500-character stderr head is enough to see that a plan was rejected and useless for seeing why, because the malformed part of a plan is almost always near its end; the full response now goes to runs//artifacts/ so a rejection is diagnosable after the fact rather than only reproducible. Best effort: a journal without a path, an empty response, or an unwritable directory leaves the entry as it was.
Checklist
make checkis green locallyare the product)
specs/(spec changes go through an issue first)Generated-by:trailer present if anagent wrote the change