Repository navigation
Accept raw control characters inside JSON strings in model replies - #255
Merged
Merged
Conversation
The first kb init pilot (afd-plugin skeleton, dry run) stopped on its first generator call: the model returned a well-formed fenced JSON object whose architecture_md value held an ASCII diagram with literal newlines, and strict json.loads rejects raw control characters inside strings, so parse_json_object raised ModelUnavailable ($0.78 wasted). Parse with strict=False: control characters in strings are data, not structure; anything else malformed is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
The first kb init pilot (afd-plugin skeleton, dry run) stopped on its first generator call: the model returned a well-formed fenced JSON object whose
architecture_mdvalue held an ASCII diagram with literal newlines. Strictjson.loadsrejects raw control characters inside strings, sokb_service.models.parse_json_objectraisedModelUnavailableand the stage blocked ($0.78 call wasted).parse_json_objectnow parses withstrict=False: control characters inside strings are data, not structure. Anything else malformed (unterminated strings, non-objects, no JSON) is still refused. This parser is shared by the knowledge service (intake, gate, judge), which benefits the same way.Tests
test_kb_intake_gate.py::test_parse_json_object_accepts_raw_newlines_inside_strings(fenced + bare, newline/tab in strings; unterminated still refused).Independent of the kb init stack (based on main); found by the kb init pilot.
🤖 Generated with Claude Code