Repository navigation
Description
Summary
search_nodes' in operator receives a comma-joined string instead of an array, 3/3 reps, producing a filter that silently matches nothing.
search_nodes({"filters":[{"operator":"in","property":"stage",
"value":"cut,soak"}],"node_type":"release"})
value should be ["cut","soak"].
This is a schema/grammar defect, not a guidance gap — established by measurement below, so please don't try to fix it with prose.
Why a filter failure is worse than a write failure
A malformed write is rejected by validation — loud and recoverable. A malformed filter returns zero results, which is indistinguishable from a genuinely empty result. The agent then truthfully reports "nothing found" and the user has no signal anything went wrong. The corpus has a case for exactly that legitimate outcome (dev-empty-result-query), so a bad filter hides inside it.
Both channels already state the rule correctly
packages/agent/src/local_agent/tools.rs (~line 443):
"value": {
"type": ["string", "number", "boolean", "array"],
"description": "Value to compare against. Use string for dates (YYYY-MM-DD), \
string/number for others. Use array for 'in' operator."
}The type union includes array. The description says "Use array for 'in' operator." The model ignores both.
Prose was measured and does not fix it
Measured on dev-unseen-schema via the golden runner (packages/agent/goldens/ablation/), 3 reps each, byte-identical within each arm:
| arm | result |
|---|---|
| full guidance subtree | "value":"cut,soak" — wrong |
| minimal subtree | "value":"cut,soak" — wrong |
| minimal + explicit filter-construction rule | "value":"cut,soak" — unchanged |
The rule added in the third arm was:
FILTERS: each filter is one object with property, operator, and value. An operator taking several values takes them as a list, never as one comma-joined string.
No effect. And on a sibling case (dev-status-change-enum), that same generically-worded rule made things worse — the model emitted Gemma's internal call syntax as raw text rather than a JSON tool call:
call:search_nodes{filters:[{operator:equals,property:status,value:in_dev}],node_type:ticket,query:}
So this is a third statement of a rule two channels already carry, and adding it is not free.
Probable mechanism
value's correct shape depends on the value of a sibling field (operator). Nothing in JSON Schema expresses that dependency here, so the model must infer "operator is in ⇒ value is an array" from prose. It doesn't.
There is a directly relevant note already in the source at that declaration:
Measured honestly: this alone did NOT stop the #1943 splice (3 of 3 reps produced byte-identical output before and after), so the malformation is not the untyped leaf.
Same shape of finding: tightening the type union did not change behaviour then either.
This is also the same class as #2159, where declaring enums on filters produced correct enum values in a broken wire format, and was closed as a negative result.
Directions worth measuring
Not prescribing one — each needs the same measurement discipline:
- Split the operator. A separate
in_valuesarray parameter, so the array shape is unconditional rather than conditional on a sibling. - Drop the union. Make
valuea string and accept a documented separator, or make it always an array with single-value filters using a one-element list. Either removes the inference step. oneOfper operator. Note Measure declaring enums on search_nodes filters: negative result, block stays for reads #2159 measured this failing: Gemma-4's template rendersoneOfbranches as opaque literal text, and the model reproduced the branch's ownpropertieskey verbatim. Probably a dead end on the locked model, recorded so it isn't retried blind.- Repair at the parse boundary.
agent_loop.rsalready has repairs for this family (repair_spliced_object_values,repair_over_quoted_keys). Splitting a comma-joined string whenoperator == "in"is mechanical and unambiguous. Cheapest, and treats the symptom.
Acceptance criteria
-
inreceives an array, measured at ≥3 reps ondev-unseen-schema(currently 0/3) -
dev-status-change-enumdoes not regress — itsequalsfilter andqueryhandling still correct - Wire format unchanged for callers, or the change is threaded through
search_nodes' handler - Whatever is tried, the result is recorded in the arm file including a negative result
Reproduction
cargo build --release -p nodespace-agent --bin golden_runner
./target/release/golden_runner --reps 3 \
packages/agent/goldens/ablation/dev-unseen-schema-filter-rule.tomlNo daemon, no DB. Turn 1 shows the malformed filter; turn 2 is correct, so the case fails on argument shape alone.
Activity
malibio commentedon Aug 20, 2026
Frontend baseline: 227 test files passed, 4789 tests passed (0 failures).
malibio commentedon Aug 20, 2026
Scoping — one correction to the framing, and the direction I'm taking
Correction: this does not silently match nothing. I traced the path before choosing an approach:
exec_search_nodes→run_node_query→query_ops::execute_query→QueryService::build_filter_condition, and atpackages/core/src/services/query_service/mod.rs:454:A non-array value is an
Err, which propagates asOpsError::Internal("execute_query failed: In requires array value")and surfaces to the model as a tool error. So today's behaviour on"value":"cut,soak"is a loud failure, not a zero-result indistinguishable fromdev-empty-result-query. That doesn't make the defect less real — a failed turn is still a failed turn, and the model then has to recover from an error it caused — but it does mean the "worse than a write failure" argument in the issue body does not hold, and it changes which fix is proportionate. Recording it rather than quietly fixing around it.Second observation about the repro.
packages/agent/goldens/ablation/dev-unseen-schema-filter-rule.tomlis not in the repo (the third arm was presumably never committed), andgoldens/dev-unseen-schema.tomldeclaresfilters.items.properties.valueas a baretype = "string"— no array in the union. So on the case as committed,"cut,soak"is schema-compliant output: the corpus is asking for a string and getting one. Production's schema (tools.rs~443) does includearrayin the union. Whatever arm I measure has to declarevaluethe way production does, or it measures the corpus's own defect rather than production's.Direction: parse-boundary repair, which of the four listed is the only one that is both cheap and cannot regress a sibling case:
dev-status-change-enumsees a byte-identical prompt and therefore cannot regress — the mechanism that made the third prose arm hurt (adding a third statement of a rule, displacing context) is absent by construction.repair_spliced_object_valuesandrepair_over_quoted_keysalready are: whenoperator == "in"andvalueis a string, the intended value is that string split on the separator. It joins the existing repair set at the one entry point (repair_parsed_tool_arguments), so it reaches both the parse boundary and the execution backstop, and participates incanonical_argsso a malformed call and its repaired retry share one identity.operator: "in", never oncontent/field_valuesuser data.Why not the other three.
oneOfis a measured dead end on the locked model (#2159 — the template renders branches as opaque literal text). Splitting the operator into anin_valuesparameter and dropping the union both change the model-facing surface, i.e. they change prompt bytes, i.e. they carry exactly the regression risk the third prose arm demonstrated — and they're a larger change to buy the same outcome the repair buys for free. If the repair turns out not to be enough, they remain available and I'd measure them then rather than now.On the "in receives an array, measured at ≥3 reps" criterion. The repair means the model may still emit a comma-joined string while the tool receives an array. I'll measure and report both: what the model emitted, and what the tool executed after repair. If the intent of the criterion is specifically "the model's raw emission is an array", the repair does not meet it and I'll say so plainly rather than claiming a pass — but the executed call being correct is what the user experiences, and that is what I'm optimising for. Recording the emission-level result as a negative if it stays wrong.
Proceeding on that basis unless redirected.
malibio commentedon Aug 20, 2026
Measured. Both of this issue's central claims are refuted.
PR #2183. Recording the numbers here since the issue asked for results in the arm files and on the ticket.
The
inmalformation is caused by the DECLARATION, and production's declaration already worksTwo ablation arms differing in exactly one thing — how
filters.items.properties.valueis declared — 3 reps each, byte-identical within each arm:valuedeclared asin-operator-array-elicited["string","number","boolean","array"]"value":["cut","soak"]✅ 3/3in-operator-string-declaredtype = "string""value":"cut,soak"❌ 3/3--check-verified as isolated: identical system prompts, user messages, tool descriptions, tool results, and turn 2; only thevalueschema differs.Production already carries the union. The
"cut,soak"reported here came fromgoldens/dev-unseen-schema.toml, which declaresvalueas a baretype = "string"— so the model was complying with the schema in front of it, not defying it. The premise "both channels already state the rule correctly" is true of production and false of the case the evidence came from.This inverts the issue's guidance: rather than splitting the operator or dropping the union, the union is the thing that must not be narrowed. I've recorded that at the declaration in
tools.rsso nobody removes it later on the theory that the model ignores it.It does not silently match nothing — it errors
packages/core/src/services/query_service/mod.rs:454rejects a non-arrayinvalue with"In requires array value", anErrthat propagates to the model as a tool error. Pinned by a new test. So the "worse than a write failure" argument — that a bad filter hides insidedev-empty-result-query— does not hold. Still a failed turn worth removing; just not an invisible one.A third finding: the first arm never reached its own question
Built faithfully to this issue's repro (production's declaration + "What releases do we have open?"), the model answered 3/3 with
search_nodes({"node_type":"release","query":"open"})— no filters at all. Nothing measured. That reads as a pass if you only check whether the turn looks right.Kept as
in-operator-array.tomlwith that recorded as its result. It also means the reported"cut,soak"came from a prompt that pushed the model toward filters first — consistent with the uncommitted-filter-rulearm, which isn't in the repo (so the repro command in this issue does not run as written).On the acceptance criteria
inreceives an array, ≥3 reps ondev-unseen-schema(currently 0/3)" — measured on a case that actually elicits aninfilter instead, sincedev-unseen-schemaas committed cannot: it declaresvalueas a string, so"cut,soak"there is schema-compliant output and the criterion is unmeasurable on it. Against production's declaration it is 3/3; after repair it is 3/3 even with the failing declaration. Flagging the substitution rather than quietly scoring the original.dev-status-change-enumdoes not regress" — satisfied by construction, not by measurement: the fix changes zero prompt bytes and zero tool-schema bytes, so that case's input is byte-identical. That property is exactly why I chose the parse-boundary repair over the prose and schema-reshaping options, given this issue's own record of a generic rule making that case worse.QueryServicealready expects, no parameter added or renamed.What shipped anyway
repair_scalar_in_operator_valuesis in, framed as a backstop rather than the mechanism — a declaration is not a guarantee and the downstream contract is strict. It is measured converting real model output on the failing arm 3/3, so it isn't speculative, but it is not credited with recovering a case that wasn't failing.Two fixes to the measurement apparatus were prerequisites and are kept: the golden runner now prints
[emitted, before repair: …](without it the two arms produce the same line and the comparison proves nothing), andcanonical_argsnow routes through the shared repair entry point instead of re-listing repairs by hand — that duplication meant a repair added later reached execution but silently not the duplicate-detection identity.Scope the `in` repair to `filters`; the no-denylist claim was false
Justify the one-element wrap semantically, not by schema conformance
Use the semantic argument in the wrap test's comment too
Get search_nodes' `in` operator an array — and correct what #2182 att…
Repair bare unquoted dates in resolve_query's decomposition output (#…