Skip to content

Measure declaring enums on search_nodes filters: negative result, block stays for reads - #2159

Merged
mstomar125 merged 1 commit into
mainfrom
worktree-issue-2147-filters-enum
Aug 19, 2026
Merged

mstomar125 merged 1 commit into
mainfrom
worktree-issue-2147-filters-enum

Conversation

@mstomar125

@mstomar125 mstomar125 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2147

What this is

core#2147's acceptance criteria required an ablation measurement before any code change: copy no-schemas-block.toml, declare the type's filterable fields with enums on search_nodes's filters, and re-measure turn 1's status filter — recording the result, positive or negative, rather than assuming symmetry with #2120/#2148's write-side fix.

Result: negative. No production code changed in this PR — the measurement doesn't support one.

What was measured

Two encodings tested via golden_runner --reps 5, both 5/5 consistent:

packages/agent/goldens/ablation/filters-enum.toml — property+value paired inside oneOf branches, mirroring declare_write_tool_fields's field_values pattern as literally as possible:

search_nodes({"filters":[{"properties":{"property":"status","value":"in_dev"},"operator":"equals"}],"node_type":"ticket"})

The enum VALUE is correct (in_dev, not dev) — the information did reach the model. But the wire format is broken: property/value arrived nested under a spurious "properties" key, and the required "type" key is missing. Confirmed via the post-template prompt dump: Gemma-4's function-declaration template has bespoke rendering for a schema's real top-level properties key, but renders oneOf branches as opaque literal text — including their own nested properties key, spelled out as quoted text the model then pattern-matches and reproduces literally.

packages/agent/goldens/ablation/filters-enum-flat.toml — a flat enum on property and a flat anyOf on value, avoiding oneOf/nested-properties entirely:

search_nodes({"filters":[{"operator":"equals","property":"status","value":"dev"}],"node_type":"ticket","query":""})

Wire format is correct, but the value reverted to dev (wrong) — nothing in a flat schema ties value's enum branch to property being "status" specifically, so the model took the unconstrained branch.

Conclusion

Neither encoding satisfies both the acceptance criteria's correctness bar and its "wire format unchanged" requirement at once. Filters resist the write-side fix's treatment because their wire format encodes the field NAME as a runtime VALUE (property: "status") rather than as a JSON Schema KEY the way field_values.status does — JSON Schema has no flat way to condition one property's legal values on another's, and the one compositional construct tried (oneOf) is not safely representable through this model's structured tool-calling.

RELEVANT NODE TYPES / EXISTING SCHEMAS remains required for reads. Unlike the write path, where the tool-schema channel now fully substitutes for the block (#2120/#2148), the read path has no wire-format-safe schema-only substitute yet measured.

Also updated PATTERN.toml and no-schemas-block.toml's notes, which both previously recorded this as "not yet measured" / "open and NOT run" — now recorded with the actual result.

Not pursued here (future work, needs its own measurement)

  • if/then JSON Schema conditionals — same nested-properties-keyword shape as oneOf, likely the same echoing risk.
  • Widening exec_search_nodes's existing reactive filterable_properties hint (currently only returned on an empty result) to fire proactively.

Testing

  • Both new ablation files verified with golden_runner --check (parses, renders the intended schema).
  • Both measured for real with golden_runner --reps 5 against the locked native model; filters-enum.toml's result additionally cross-checked against the post-template prompt via NODESPACE_PROMPT_DUMP to confirm the root cause.
  • No production Rust code changed, so nothing to regress: cargo test -p nodespace-agent --test prompt_assembly_snapshot re-run and confirmed unaffected (5/5 pass, unchanged). Clarification on the acceptance criterion "full golden corpus re-run; no case regresses": the snapshot test above is a separate, zero-model-call mechanism (hand-built fixtures, never touches packages/agent/goldens/) — it is not evidence about the dev-*.toml corpus itself. This PR did not do a live golden_runner pass over the full corpus, because no production code changed: nothing in find_skills, declare_write_tool_fields, stage2_tools, or any tool definition was touched, so there is no mechanical path by which an existing corpus case's behavior could have shifted. Regression risk here is inherently zero by construction, not empirically re-confirmed.
  • Full pre-push gate (bun run test:all + cargo build --bin nodespaced + bun run test:e2e + cargo test -p nodespace-app) passed locally before push.

🤖 Generated with Claude Code

…anly

core#2147's acceptance criteria required an ablation arm before any code
change: copy no-schemas-block.toml, declare the type's filterable fields
with enums on search_nodes's filters, and re-measure turn 1's status filter
before assuming the write-side fix (#2120/#2148) transplants to reads.

Two encodings measured via golden_runner --reps 5, both 5/5 consistent:

- filters-enum.toml: property+value paired inside oneOf branches (mirrors
  declare_write_tool_fields's field_values pattern as literally as
  possible). Recovers the correct enum value ("in_dev") but breaks the wire
  format — the model echoes the schema's own oneOf-branch `properties`
  keyword into the instance, confirmed via the post-template prompt dump
  (Gemma-4's template has bespoke rendering for a real top-level properties
  key but renders oneOf branches as opaque literal text, including their
  own nested properties key).

- filters-enum-flat.toml: a flat enum on `property` and a flat anyOf on
  `value`, avoiding oneOf/nested-properties entirely. Keeps the wire format
  correct but the value reverts to "dev" (wrong) — nothing in a flat schema
  ties value's enum branch to property being "status" specifically.

Neither encoding satisfies both the acceptance criteria's correctness bar
and its "wire format unchanged" requirement at once, so this does not
recover the way #2120's field_values fix did for writes. Filters resist the
same treatment because the wire format encodes the field name as a runtime
value rather than a schema key, and JSON Schema has no flat way to
condition one property's legal values on another's.

No production code changed. RELEVANT NODE TYPES / EXISTING SCHEMAS remains
required for reads; updated PATTERN.toml and no-schemas-block.toml's notes,
which both previously recorded this as "not yet measured."

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

search_nodes filters declare no enum: allowed values never reach the model on a read

1 participant