Repository navigation
Repair malformed tool-call args at the parse boundary so the call reaches the tool (closes #1943) - #1946
Conversation
…ches the tool (closes #1943) The locked model emits `search_nodes` filters with two malformations at once: keys carrying literal quotes (`"\"property\""`) and a value that swallowed the delimiters introducing the next key (`"type": "task\",\"value\":"`). The payload is valid JSON, so no parse guard fires; the filter is rejected instead. Four distinct defects sat between the model and a working query: 1. Repairs ran on a local copy, never on `tc.arguments_json` — so the malformed text was persisted into history and replayed verbatim into the next prompt, where the model copies it (measured 8/8 vs 0/8 in toolcall_json_shape.rs). Every attempt was repaired for the tool and simultaneously re-taught to the model. Repair now runs at the parse boundary, so the record is repaired too. 2. The spliced value survived every existing repair. `repair_spliced_object_values` recovers the truncated value (`task`) from the exact `","<key>":` delimiter run. It does not invent the swallowed key's value — that was never emitted. 3. `query: null` was rejected (`invalid type: null, expected a string`) though omitted and null plainly mean the same thing here. Read as empty now; `deny_unknown_fields` still rejects misspelled keys. 4. Filter-category inference deferred to a supplied `type` even when it named no category. The model writes the *node* type there while `node_type` carries the same value — the production `Unknown filter type 'task'` from #1939, which this establishes is the same defect, not a second one. Inference now falls through on an unrecognised value; an item naming no subject still errors, and the message names the value supplied rather than claiming `type` was omitted. Verified on the locked native model, 3/3: the retry now reaches the query layer with usable keys, a clean `type`, and correct category routing. What remains is not repairable downstream: the model never emits the comparison value, so `equals` has nothing to match and the query fails for a missing value. Inventing "open" would fabricate the user's query. Typing the previously-untyped `value` leaf was tried against this and changed nothing (byte-identical output 3/3); it is kept as a schema correctness fix, not as a claimed remedy. `live_model_recovers_from_a_bad_enum_value_without_asking` therefore asserts that every retry gets as far as that missing value — repair and routing must carry it that far — rather than asserting execution, which would encode a capability this model does not have and leave a permanently red test. Co-Authored-By: Claude <[email protected]>
…place Two follow-ups on the repair introduced for #1943. `repair_spliced_object_values` rewrites a string *value*, not just a key, so unlike the two sibling key repairs it can reach user-authored text: create_node and update_node carry the user's own note in `content` and their chosen field values in `properties`. The mechanical shape is rare but typeable — a pasted CSV header fragment (`name","email":`) matches it exactly — and silently truncating a note is a worse failure than declining to repair a filter. Those subtrees are now skipped at any depth. Nothing is given up: the malformation is only observed in filter and schema-definition objects, where every value is a machine-chosen token and none is free text. The three repairs were also listed individually at three call sites, so a fourth would have to be remembered in all three. They now go through one `repair_parsed_tool_arguments` helper, which is the single place the set is enumerated. Co-Authored-By: Claude <[email protected]>
Code Review SummaryVerdict: Approve with one non-blocking follow-up. (Posting as a comment — GitHub rejects self-approval.) This is a strong change. The investigation is the best part of it: the PR answers all four diagnostic acceptance criteria with measured evidence, and — unusually — records two negative results (typing the The core insight is genuinely valuable and worth restating: repairs were mutating a local I verified the central claims rather than taking them on trust:
FindingsCritical IssuesNone. Suggested Improvements[Improvement — already fixed in flight] Unlike the two sibling repairs, this one rewrites values, not keys. That is a real category change. The key repairs are safe because a JSON key carrying its own quote marks cannot be written by the schema path that produced it — the malformation is not expressible as intent. That argument does not transfer to values: a value is frequently the user's own text, where any byte sequence is expressible as intent. I probed the guard directly (compiled The You independently found and fixed this mid-review by skipping [Improvement] Note the residual containment argument in the doc comment. Even with the subtree skip, the guard is a denylist — a future tool adding a free-text parameter under some name other than On the deliberate deviation from the acceptance criterionThe reasoning is sound and I would accept it. The criterion asked that the retry assert execution; the PR asserts every retry reaches a "missing value" failure instead. The justification holds up: the model writes the delimiters that should have introduced More importantly, the weaker assertion still has teeth. This was the thing worth checking, and it passes: assert_eq!(executed + missing_value_only, recovered, ...)
The one soft spot is that it string-matches On the remaining brief pointsCategory inference fallthrough ( Nit:
Making Defense-in-depth vs. redundancy — this was a fair concern, and your in-flight refactor resolves it. As originally written, three repair call sites each listed the same three functions by hand — precisely the drift risk I would have flagged, since a fourth malformation would have to be remembered in three places. Extracting Test qualityStrong overall. The suite covers the verbatim reported payload end-to-end, the history-propagation gate (verified to fail without the fix), the null-query pair, category fallthrough in both directions, byte-identical passthrough for clean args, unparseable-args passthrough, and negative cases guarding user data. The negative tests are the ones that matter most for a heuristic like this, and they were present from the start — Nit: Net assessment: a well-investigated fix that addresses a genuine self-sustaining failure loop, with honest documentation of what it cannot fix and why. The one real risk — value rewriting reaching user data — is now contained. Recommend merge once the deviation is recorded on #1943. |
malibio
left a comment
There was a problem hiding this comment.
Verdict: APPROVE with one non-blocking follow-up (posting as a comment — GitHub rejects self-approval).
Full review posted above. Summary:
- No critical issues. The core insight — repairs mutating a local
Valuewhiletc.arguments_jsonstayed malformed and was replayed into the next prompt — is a genuine self-sustaining loop, and moving repair to the parse boundary is the correct structural fix. - Verified rather than trusted: disabled the parse-boundary repair in a scratch copy and confirmed
history_carries_the_repaired_arguments_not_the_malformed_onesfails with exactly the reported malformed shape and passes when restored. It is a real gate. Full agent lib suite: 461 passed, 0 failed. - The acceptance-criterion deviation is sound. The model never emits the comparison value, so execution is genuinely unreachable without fabricating the user's query. The weaker assertion still has teeth:
missing_value_onlymatches only"Missing value", so a repair regression or a category-inference regression fails asunknown field/Unknown filter typeand trips the assertion. Recommend marking the criterion deviated-with-rationale on #1943 rather than checked off. - Main concern (value rewriting reaching user data) is resolved in flight.
repair_spliced_object_valuesrewrites values, not keys — a category change from its siblings, since a user's text can express any byte sequence as intent. I confirmed by direct probe thatReviewed the paper","Notes":and a pasted CSV headername","email":match the shape exactly. The gap was reach, not shape; thecontent/propertiessubtree skip fixes it correctly. - Follow-up (non-blocking): that guard is a denylist, so a future free-text parameter named something else (
body,note) silently re-enters the blast radius. Worth a sentence in the doc comment so whoever adds one knows to extend the list. - Category fallthrough,
null_as_default, and thepubseam all check out — details in the comment.
Recommend merge once the deviation is recorded on #1943.
Three non-blocking follow-ups from the PR review. No behaviour changes. - `is_known_category` deferred to `parse_filter_type(s).is_ok()` instead of re-listing the four categories three lines away, so there is one authority on the set and the two cannot drift. - Noted in `repair_spliced_object_values`'s doc comment that its safety rests on an enumerated denylist of user-data keys: a tool added later with a free-text parameter named something other than `content`/`properties` re-enters the blast radius unless the list is extended. Records the inversion to an allowlist as the better shape if the list grows. - Split `repair_entry_point_leaves_clean_arguments_byte_identical`, which bundled clean-passthrough and unparseable-passthrough, so a failure names which property broke. Co-Authored-By: Claude <[email protected]>
Review addressedAll four follow-ups from the review are in Addressed:
Also landed mid-review ( Verification: A correction to the record: the review reports that the reviewing agent inadvertently reverted my uncommitted work with a Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All three code changes are 🟢 suggestions with no behavioural effect — one doc-comment addition, one two-line refactor that routes an existing predicate through the function that already owned the set, and one test split with both assertions preserved verbatim. The substantive change the review cared about (value repair reaching user data) was already reviewed and confirmed in-flight. Full suite green. |
Closes #1943.
What was wrong
The locked model emits
search_nodesfilters with two malformations at once — keys carrying literal quotes and a value that swallowed the delimiters introducing the next key:This parses as valid JSON, so no parse guard fires. It is rejected on its merits instead.
Findings against the acceptance criteria
Where the corruption originates. Not the parser and not transport: llama.cpp's own OAI-compat parser is used, and the arguments string is deserialized exactly once between engine and tool. No double-encoding path exists. The malformation is the model's own output.
One defect or two? One. The reproduction's splice hid that
typewas"task"all along; with the splice repaired, the run reproduces #1939's production error verbatim —Unknown filter type 'task'. The model puts the node type in the filter's category slot.Nested-object specific? The previously-untyped
valueleaf was the leading suspect. Typing it changed nothing — byte-identical output across 3/3 reps — so nesting depth is not the trigger. Recorded in the code so the next person doesn't re-run it.Four defects fixed
Value, nevertc.arguments_json— the string persisted into history and replayed verbatim into the next prompt, where the model copies it (8/8 malformed from malformed, 0/8 from clean). Every attempt was repaired for the tool and re-taught to the model. Repair now runs at the parse boundary.repair_spliced_object_valuesrecovers the truncated value from the exact","<key>":delimiter run. It does not invent the swallowed key's value — that was never emitted.query: nullwas rejected though omitted and null mean the same thing here.deny_unknown_fieldsstill rejects misspelled keys.type. It now falls through on an unrecognised value; an item naming no subject still errors, and the message names the value actually supplied.Verified on the locked native model
3/3 reps. The retry now reaches the query layer with usable keys, a clean
type, and correct category routing.The honest residue
The model never emits the comparison value, so
equalshas nothing to match and the query fails for a missing value. Inventing"open"would fabricate the user's query.So
live_model_recovers_from_a_bad_enum_value_without_askingasserts that every retry gets as far as that missing value — repair and routing must carry it that far — rather than asserting execution. Asserting execution would encode a capability this model does not have and leave a permanently red test. This is a deliberate deviation from the issue's stated criterion; flagging it explicitly for review.Testing
test:all— no new failures vs baseline (frontend 171 files / 4108 tests, unchanged)cargo test --release -p nodespace-agent --test live_unset_schema_field live_model_recovers -- --ignored --nocapture --test-threads=1🤖 Generated with Claude Code
https://claude.ai/code/session_01FELy7rhqnKbDmmG9fuHALT