Repository navigation
Description
Summary
The locked native model (gemma-4-E4B-it-Q4_K_M) emits malformed JSON arguments for search_nodes filters: object keys arrive with embedded quote characters, and a value is spliced into a neighbouring field. The call is rejected by argument parsing before it ever runs, so a search the model correctly intended never executes.
This blocks "How many tasks are open?" from returning a count, even though — after #1939 / #1941 — the model now forms the right intent and targets the right field.
Observed
Reproduced 3/3 at temperature 0.1 while verifying #1939 (packages/agent/tests/live_unset_schema_field.rs, live_model_recovers_from_a_bad_enum_value_without_asking):
LIVE[rep 0] retried: {"filters":[{"\"operator\"":"equals","\"property\"":"status","\"type\"":"task\",\"value\":"}],"\"node_type\"":"task","query":null}
LIVE[rep 0] retry rejected: invalid arguments for tool search_nodes:
unknown field `"node_type"`, expected one of `query`, `node_type`, `filters`, `sorting`, `limit`
Two distinct corruptions in one payload:
- Keys carry literal quotes —
"\"property\""instead of"property", at both the top level ("\"node_type\"") and inside the filter object. - A value is spliced across fields —
"\"type\"":"task\",\"value\":"has swallowed what should have been thevaluekey and its content, so the filter loses its comparison value entirely.
Identical output across all 3 reps, so this is deterministic at this temperature, not sampling noise.
Not new
#1939 recorded the same class of defect from production and explicitly scoped it out as "a model slip that self-corrected on retry":
args_preview={"filters":[{"operator":"equals","property":"status","type":"task","value":"open"}],"node_type":"task"}
result_preview={"error":"...Unknown filter type 'task'. Supported: property, content, relationship, metadata"}
packages/agent/tests/live_update_node_noop_gate.rs:188 also carries an unparseable args branch for the same reason. So the behaviour is known and tolerated in several places, but has not been characterised or fixed.
Note the production instance and the one above are not identical: production emitted well-formed JSON with a wrong type value, whereas the reproduction emits structurally corrupt JSON. They may be one defect or two — worth establishing which before designing a fix.
Why this matters now
Before #1941 the read path failed earlier, at the model asking the user to name the field, so this defect was masked. With the field list delivered, the model reaches the point of emitting a filter — and this is what it hits. Measured A/B, 3 reps each, identical but for the payload:
| empty result carries | outcome |
|---|---|
{count, nodes} only |
0/3 retried — "I do not have enough information to continue…" |
+ filterable_properties |
3/3 retried against status, 3/3 rejected on malformed args |
So this is now the last thing between the user and a working "how many tasks are open?".
Acceptance criteria
- Determine where the corruption originates — grammar-constrained decoding, the tool-call parser, or the model itself.
Grammar triggered on regex: '<|tool_call>'appears in the logs immediately before each affected generation, which makes the grammar/parser seam the first place to look - Establish whether the production case (valid JSON, wrong
typevalue) and the reproduction (structurally invalid JSON) are one defect or two - Confirm whether this is specific to
search_nodes' nestedfiltersarray, or affects any tool with a nested-object parameter —update_node's flatpropertiesobject does NOT exhibit it (3/3 clean in the same test run), which suggests nesting depth is the trigger - Fix, or add a repair path if the corruption is unfixable at the source
- Regression test at the same 3-rep granularity
-
live_model_recovers_from_a_bad_enum_value_without_askingupgraded to assert the retry executes, replacing the deliberately-scoped assertion left in place by Surface a node type's schema fields so unset fields can be set and filtered (closes #1939) #1941 - Verified on the locked native model
Environment
- Reproduced on branch
issue-1939-schema-fields-get-node(PR Surface a node type's schema fields so unset fields can be set and filtered (closes #1939) #1941), modelgemma-4-E4B-it-Q4_K_M, native llama.cpp path,n_ctx=16384 - Repro:
cargo test --release -p nodespace-agent --test live_unset_schema_field live_model_recovers -- --ignored --nocapture --test-threads=1 - Related: Agent cannot set or filter a defined-but-unset schema field: no tool exposes a node type's field list #1939 (scoped this out), update_node reports updated:true for a zero-property call, and the agent fabricates a confirmation of a write that never happened #1937 / Gate no-op update_node calls and act on the persisted-field signal (closes #1937) #1938
Activity
malibio commentedon Aug 3, 2026
Baseline (worktree issue-1943-malformed-tool-args): Frontend: 171 test files passed, 4108 tests passed.
Keep the splice repair off user text, and list the repair set in one …
malibio commentedon Aug 3, 2026
Acceptance criterion deviated-with-rationale, not met as written.
The criterion
live_model_recovers_from_a_bad_enum_value_without_asking upgraded to assert the retry **executes**is NOT satisfied as stated, deliberately. Recording it here so the delta stays visible rather than resting in a merged PR body.The model writes the delimiters that should have introduced
valueas string content ("type": "task\",\"value\":"), so the comparison value is never generated at all. Nothing downstream can recover it — synthesizing"open"would fabricate the user's query. Asserting execution would encode a capability this model does not have and leave a permanently red test.The test instead asserts every retry reaches exactly the missing-value failure:
This still gates the fix.
missing_value_onlyincrements only on"Missing value", so a repair regression (fails asunknown field), a category-inference regression (fails asUnknown filter type 'task'), or a new malformation all land in neither bucket and trip the assertion.Verified on the locked native model, 3/3:
recovered=3 executed=0 missing_value_only=3 asked_the_user=0.Making the retry actually execute needs the model to emit the value — a prompting/model-capability question, not a repair one. Worth a separate issue if the count matters for "how many tasks are open?"; the read path now gets everything except that value.