Skip to content

Surface a node type's schema fields so unset fields can be set and filtered (closes #1939) - #1941

Merged
malibio merged 5 commits into
mainfrom
issue-1939-schema-fields-get-node
Aug 3, 2026
Merged

malibio merged 5 commits into
mainfrom
issue-1939-schema-fields-get-node

Conversation

@malibio

@malibio malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #1939.

A schema field that is defined but currently unset was invisible to the model from every direction. get_node returns only populated properties, and the RELEVANT ENTITY TYPES block excludes core types by construction — so for task/text there was no path, prompt block or tool call, by which due_date could be discovered. Following "use the node's OWN existing property keys" literally, the model correctly declined and asked the user to name a field the schema had defined all along.

Approach — option 1, not option 2

The field list is delivered on the tool result, per ADR-064 rule 4 (tool results own facts). This leaves routing.rs's deliberate is_core exclusion completely untouched, which matters for two independent reasons the issue sets out:

  • ADR-063: widening the routing block risks create_schema's guidance misreading a core type as user-defined and writing a bare property key onto it. That guidance keys off RELEVANT ENTITY TYPES; this channel never touches it.
  • Wrong mechanism: RELEVANT ENTITY TYPES answers "which user-defined types are relevant to this message" — a retrieval question over an unbounded set. Core types are the opposite: a small fixed set that must be always known when the model is looking at a node of that type, not found. Routing them through a relevance mechanism would make every core type a retrieval candidate on every turn.

Changes

  • get_node gains available_properties: every field the type defines, with its type, allowed values, and a set flag. That flag is load-bearing — without it, "defined but unset" and "does not exist" read identically.
  • search_nodes attaches filterable_properties when a type-scoped search returns zero results — the one outcome where count: 0 and "bad field name" are indistinguishable. Scoped to the empty case so successful turns get no schema block they never needed.
  • Guidance (update_node's properties, and the Gate no-op update_node calls and act on the persisted-field signal (closes #1937) #1938 no-op rejection text) now names unset schema fields as legitimate targets and points at get_node, without reopening "invent a key from the user's wording".

Rendering reuses EntityFieldDescriptor::from_schema_field, already documented for exactly this and already used by resolve_query — not a fourth renderer.

Verification

Write path — 3/3 on the locked model (gemma-4-E4B-it-Q4_K_M), field name never in the prompt:

LIVE[rep 0] update_node({"id":"53a44ccd-...","properties":{"due_date":"2026-08-06"}})
LIVE[rep 1] update_node({"id":"45554bd7-...","properties":{"due_date":"2026-08-06"}})
LIVE[rep 2] update_node({"id":"e6163379-...","properties":{"due_date":"2026-08-06"}})

Read path — controlled A/B, 3 reps each, identical except for the payload:

empty result carries outcome
{count, nodes} only 0/3 retried — "I do not have enough information to continue. Could you please clarify…"
+ filterable_properties 3/3 retried, filtering on status

So the field list is what moves the model off interrogating the user. All 3 retries then serialize their args malformed (keys with embedded quotes) and are rejected before running. That defect is pre-existing and explicitly scoped out of #1939 (the report records the same slip — a filter emitted with "type": "task"), and the sibling no-op-gate suite already carries an unparseable-args branch. The test asserts the model went back to the graph against the named field, executes the retry for visibility, and does not assert it succeeds — tying a schema-visibility fix to an unrelated serialization bug would make it fail for something it does not own.

8 deterministic tests drive the real executor over a real store, so this is caught by test:all rather than only by an ignored live run. Verified they fail without the fix (4/5 failed with exactly the reported symptom).

3 agent-matrix scenarios on task — every existing group builds a custom type first, which is precisely why this gap went unmeasured.

Two things the review should know I checked rather than assumed:

An earlier draft returned a no_matches_hint prose string beside the list. It read as helpful and violated ADR-064 rule 4 — measured, not stylistic, since instructions delivered as a tool result dropped continuation 100%→44% in this codebase's own testing. It was removed and the guidance moved to search_nodes' description; a test now pins the result to facts only.

Testing

  • test:all — frontend 171 files / 4108 tests, browser 2/24, Rust all green. Matches baseline exactly, zero new failures.
  • quality:fix clean (workspace-wide cargo fmt reformatting of 9 unrelated files reverted).
  • Live tests run at n_ctx=16384, production's enforced floor. At 32768 the KV cache OOMs the GPU whenever a nodespaced daemon is resident — a behavioral assertion failing for a memory reason reads as a regression.

Not addressed

The malformed-filter-args defect above is real, reproduces 3/3, and blocks the read path from completing even though the model now forms the right intent. It is out of scope here per the issue's own framing, and worth its own issue — I can open one if you'd like.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FELy7rhqnKbDmmG9fuHALT

malibio and others added 4 commits August 3, 2026 18:12
A schema field that is defined but currently unset was invisible to the
model from every direction: get_node returns only populated properties,
and the RELEVANT ENTITY TYPES block excludes core types by construction.
So for task/text there was no path — prompt block or tool call — by which
due_date could be discovered. Following "use the node's own existing
property keys" literally, the model correctly declined and asked the user
to name a field the schema had defined all along.

Deliver the field list on the tool result rather than the routing prompt,
per ADR-064 rule 4. That leaves routing.rs's deliberate is_core exclusion
untouched: RELEVANT ENTITY TYPES answers "which user-defined types are
relevant to this message", a retrieval question over an unbounded set,
whereas core types are a small fixed set that must be *always known* when
the model is looking at a node of that type, not *found*.

- get_node gains available_properties: every field the type defines, with
  its type, allowed values, and a `set` flag. That flag is load-bearing —
  without it "defined but unset" and "does not exist" read identically.
- search_nodes attaches filterable_properties when a type-scoped search
  returns zero results, the one outcome where count:0 and "bad field name"
  are indistinguishable. Scoped to the empty case so successful turns get
  no schema block they never needed.
- update_node guidance and the #1938 no-op rejection now name unset
  schema fields as legitimate targets and point at get_node, without
  reopening "invent a key from the user's wording".

Field names are flat on both sides — reads flatten the stored namespace
and writes re-namespace flat keys — so a name taken from the list passes
straight back to update_node. A test asserts that round-trip against the
store rather than assuming it.

ADR-063 is re-verified for the new channel rather than assumed: the list
can only echo keys the schema already defines, so it opens no path to
writing a new bare key onto a core type.

Refs #1939

Co-Authored-By: Claude <[email protected]>
Every existing group builds a CUSTOM type first, which is why this gap
went unmeasured: a custom type's fields reach the model through RELEVANT
ENTITY TYPES, and that block excludes core types by construction. No
scenario ever acted on task/text, so the field list never being delivered
for them scored green.

10a creates a task with the fields under test deliberately unset, 10b
sets due_date without the prompt naming the key (minProperties makes a
turn that persists nothing score red), 10c filters on the status enum —
the read-side half of the same root cause.

Refs #1939

Co-Authored-By: Claude <[email protected]>
The first draft returned a `no_matches_hint` prose string beside the field
list. Rule 4 is explicit that a tool result owns resolved state and "does
not return a plan for the model to carry out" — and that is measured, not
stylistic: instructions delivered as a tool result dropped continuation
from 100% to 44% in this codebase's own testing.

filterable_properties is a fact and stays. What to DO about it moves to
search_nodes' description, the channel rule 2 gives tool-selection prose.
A test now pins the result to facts only, so the next helpful-sounding
string has to justify itself against the doctrine.

Also covers two edge cases: a type that defines no fields omits the key
entirely rather than claiming an empty field set, and get_node on a schema
node does not describe it using its own instance fields.

Refs #1939

Co-Authored-By: Claude <[email protected]>
The read-path live test measures the field list in isolation, 3 reps each,
identical except for the empty-result payload:

  {count, nodes} only        → 0/3 retried; "I do not have enough
                               information to continue. Could you please
                               clarify what you would like me to do?"
  + filterable_properties    → 3/3 retried, filtering on `status`

So the field list is what moves the model off interrogating the user,
which is the reported defect. All 3 retries then serialize their arguments
malformed — keys with embedded quotes, a value spliced into a neighbouring
field — and are rejected before running.

That malformation is not caused by this change and is not this issue's to
fix: the originating report records the same defect (a filter emitted with
"type": "task") and explicitly scopes it out as a model slip, and the
sibling no-op-gate suite already carries an unparseable-args branch. The
test therefore asserts the model went back to the graph against the named
field, executes the retry for visibility, and does not assert it succeeds
— tying a schema-visibility fix to an unrelated serialization bug would
make it fail for something it does not own.

Strengthening the fixture is what surfaced this: with only the in_progress
task, "there are no open tasks" was the CORRECT answer, so giving up
scored the same as recovering. An open task now exists, making the right
answer reachable only by retrying.

Live tests drop to n_ctx=16384 (production's enforced floor). At 32768 the
KV cache plus compute buffers OOM the GPU whenever a nodespaced daemon is
resident with its own model — the normal state of a dev machine — and a
behavioral assertion that fails for a memory reason reads as a regression.

Write path remains 3/3 at the production floor.

Refs #1939

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Code Review — PR #1941

Review Type: Initial Review
Scope: 4 files, +1107 / −10 (tools.rs, entity_types_block.rs, live_unset_schema_field.rs, agent-matrix.ts)
Verdict: ✅ APPROVE (posted as a comment — GitHub rejects self-approval)


Summary

This is a well-diagnosed fix for a real, precisely-characterised defect, and the architectural call at its centre is the right one. Delivering the field list on the tool result rather than widening RELEVANT ENTITY TYPES is correct for two independent reasons the PR states and I verified: it keeps routing.rs's is_core exclusion untouched (so ADR-063's bare-key hole stays closed), and it matches the semantics — core types need to be always known, not retrieved. Routing a fixed set through a relevance mechanism would have been a category error.

I verified the claims rather than taking them at face value. The load-bearing ones hold. git diff --name-only confirms only 4 files changed; routing.rs and context_ops.rs are byte-identical to origin/main, and nothing in the diff feeds the routing block. All 8 deterministic tests pass on a clean run (cargo test -p nodespace-agent --test live_unset_schema_field → 8 passed, 2 ignored), and the 5 new entity_types_block unit tests pass (12/12 in that module).

Two things stand out as genuinely good practice: the round-trip test asserts against the store, not the tool's own report — the exact lesson from #1937 — and the no_matches_hint prose string was removed mid-PR on ADR-064 rule 4 grounds, with a test added to pin the result to facts only. Deleting your own helpful-sounding string because the doctrine is measured rather than stylistic is the correct instinct.

Findings below are one 🟡 on the eval fixture, one 🟡 on an honest-but-incomplete acceptance criterion, and the rest 🟢. None block merge.


Requirements Check (issue #1939)

# Criterion Status
1 Set due date persists due_date without user naming the field ✅ Live 3/3 on locked model; deterministic_unset_field_name_round_trips_through_update_node asserts persistence against the store
2 "How many tasks are open?" filters on status without asking the user ⚠️ Partial — see 🟡-2. The asking is fixed (0/3 → 3/3 retry, verified A/B). The filtering does not complete, due to a pre-existing defect
3 Model can distinguish "defined but unset" from "does not exist" ✅ The set flag; available_properties_lists_unset_fields_marked_not_set + available_properties_treats_null_as_unset
4 Enum-valued fields expose allowed values ✅ allowed_values from from_schema_field (core ∪ user values); asserted on both get_node and search_nodes paths
5 Guidance no longer implies only populated keys are writable ✅ update_node.properties description, get_node description, and the #1938 no-op rejection text all rewritten
6 Regression test: set previously-unset schema field end-to-end ✅ Runs in test:all, not only under #[ignore] — the right call
7 Agent-matrix scenario for set-unset-field and filter-by-unset-field ✅ 10a/10b/10c. Winnability verified (below), with one scoring caveat: 🟡-1
8 Verified on locked native model (gemma-4-E4B-it-Q4_K_M) ✅ Both paths, 3 reps, with a controlled A/B on the read path

Winnability check on scenario 10 (requested explicitly). I confirmed against packages/core/src/models/core_schemas.rs that the seeded core task schema defines status (enum: open/in_progress/done/cancelled, required), priority (enum), due_date (date), started_at, completed_at, and assignee. So 10b's due_date and 10c's status/open are all real, and scenario 10 is winnable by construction — it is not the album/artist trap the file's own comments warn about. minProperties: 1 routes through callPersistedProperties, which correctly reds out isError, contentOnly, and fieldCount < min. Good.


Code Review Findings

🟡 Important

1. 📁 scripts/eval/fixtures/agent-matrix.ts:519-522 — scenario 10c's assertion cannot detect the failure its own comment names.

The comment states the defect "shows up here as the search never firing at all." But noRetry (agent-matrix.ts:263-275) only trips on runLength > 1; with zero search_nodes calls the loop body never executes and it returns {passed: true}. assertExpectation({kind:"noRetry", tool:"search_nodes"}, []) passes. The sibling noExtraTypes branch explicitly guards the zero case ("got 0"), and agent-matrix.test.ts:269 tests for it — noRetry has no such guard.

So 10c scores green on the exact production behaviour that motivated this PR: the model stopping to interrogate the user and never searching. That is the reverse of what an eval scenario is for, and it is precisely the "measures the fixture, not the model" failure this file's comments elsewhere are vigilant about.

The reasoning for choosing noRetry over toolOnce is sound — a narrowing follow-up search is legitimate, so a hard count is wrong. But the two concerns are separable: you want "fired at least once, and never twice in a row." Options, cheapest first:

  • Add a zero-call guard to the noRetry branch (if (!actions.includes(expect.tool)) return {passed:false, ...}), matching noExtraTypes. This changes shared semantics, so check the other noRetry users first — but "no blind retry loop" arguably always implies the tool ran.
  • Or introduce {kind:"noRetry", tool, minCalls?: 1} and set it on 10c only, leaving existing scenarios untouched.

Principle: a test that cannot fail on its target behaviour provides no signal — it converts an unmeasured gap into a falsely-measured one, which is strictly worse than leaving it unmeasured. This is the same class of hole minProperties was introduced to close on the write side (#1937).

2. 📁 packages/agent/tests/live_unset_schema_field.rs:625-798 — acceptance criterion 2 is genuinely not fully met, and the PR should say so in the issue, not only in the PR body.

You asked me to be direct rather than rubber-stamp this, so: the scoping call is correct, but the criterion is not satisfied.

What's right about the scoping. The A/B is clean and it isolates the variable properly — identical prompts, identical fixtures, one payload difference, 0/3 → 3/3. That is strong evidence the field list is the causal factor, and the fixture strengthening (adding a genuinely-open task so "there are no open tasks" stops being the correct answer) is exactly the right move — without it, giving up and recovering would score identically. Refusing to assert clean execution is also right: tying a schema-visibility fix to an unrelated arg-serialisation bug would make this suite fail for something it doesn't own, and CLAUDE.md's atomicity preference supports not bundling the two.

What is nonetheless true. Criterion 2 reads "filters on status without asking the user" — and the filtering does not happen. The model forms the right intent and emits malformed args ({"\"property\"": "status"}) 3/3, so the search never runs. A user asking "how many tasks are open?" today still does not get a count. The PR body is admirably honest about this ("blocks the read path from completing"), and the doc comment at :644-656 is excellent — it records the measurement, the reasoning, and the fact that the retry is executed for visibility so a future fix surfaces in the log rather than silently.

My recommendation is not to fix it here. It is: mark criterion 2 as partial on the issue rather than checked, and open the follow-up issue before merging — the PR offers to ("I can open one if you'd like"). A 3/3-reproducing defect that blocks a shipped acceptance criterion should not depend on someone remembering a sentence in a merged PR body. That is the whole difference between a scoped-out defect and a lost one.

Principle: honest partial delivery beats overclaimed completion — but the boundary has to be recorded somewhere durable, or scoping becomes indistinguishable from dropping.

🟢 Suggestions

3. 📁 packages/agent/src/local_agent/tools.rs:552 — the get_node description overclaims for format=markdown.

The description now states unconditionally: "Returns the node's current values in 'properties', plus 'available_properties' — every field this node's type defines…". But the format == "markdown" branch (tools.rs:1840-1868) returns json!({"markdown": truncated}) and never reaches the attach logic — no properties, no available_properties.

Defensible in practice (markdown mode is for reading a document, not inspecting state), and the model is unlikely to reach for markdown when hunting a field name. But the description is a model-facing contract, and a model that did call format=markdown and found neither key would be reading a broken promise. Consider scoping the sentence: "In the default format, returns … . Use format=markdown to include all descendants as a readable document."

4. 📁 packages/agent/src/local_agent/tools.rs:1889 — nodeType is correct for all live paths, but the schema path works by accident.

I verified all four serialization paths in packages/nodespace-types/src/convert.rs:

  • generic Node — #[serde(rename_all = "camelCase")] → nodeType ✅
  • TaskNode — explicit #[serde(rename = "nodeType")] ✅
  • AiChatNode — explicit #[serde(rename = "nodeType")] ✅
  • SchemaNode — has no node_type field at all, so no nodeType key is emitted

So there is no silent partial failure on any type where the feature is meant to work. But the schema case is worth noting: deterministic_get_node_on_a_schema_node_is_sane passes because the lookup silently no-ops on a missing key — not because anything checks "don't describe a schema node with its own instance fields." The inline comment ("both the generic Node and TaskNode camelCase it") is accurate but doesn't mention the third case that's load-bearing for the schema test.

Worth one comment line noting that SchemaNode emits no nodeType, so schema nodes skip this path by construction. Otherwise a future nodeType addition to SchemaNode — entirely plausible — would silently start describing the task schema node using task's instance fields, and the test guarding that would still pass while its if let Some(...) guard quietly stops covering anything.

5. 📁 packages/agent/tests/live_unset_schema_field.rs:590-595 and :613-622 — two conditionally-asserting tests are weaker than their doc comments claim.

Both wrap their assertions in if let Some(available) = stored.result.get("available_properties"), so both pass vacuously when the key is absent — which is the current behaviour in both cases. deterministic_fieldless_type_is_unaffected does assert unconditionally that get_node still succeeds and returns the content (real value — the "field list is an addition, never a precondition" contract is genuinely covered). But its stated contract, "the list must be absent, not an empty array," is only half-checked: it never asserts absence. Since text has fields: vec![] in core_schemas.rs:324, the outcome is deterministic — assert!(stored.result.get("available_properties").is_none()) would be exact and would catch a regression that started emitting [].

Same for the schema-node test: assert!(stored.result.get("available_properties").is_none()) states the actual invariant. The conditional form is defensive against a shape you already control.

Principle: a conditional assertion is a test that opts out of failing. Where the expected state is deterministic, assert it directly.

6. 📁 packages/agent/src/local_agent/tools.rs:1488-1497 — the set-stripping in search_nodes is a small structural smell.

Building the full per-node descriptor and then obj.remove("set") because there is no node is correct in effect (the test at :268-273 pins it), but it constructs a wrong value in order to correct it. A set-free variant — or a properties: Option<&Value> parameter where None omits the flag — would make the type-level vs. node-level distinction explicit at the API boundary rather than by post-hoc mutation. Nit-level; the current form is tested and the comment explains why.

7. 📁 packages/agent/src/local_agent/tools.rs:1467, 1888 — performance is fine as-is; do not cache.

You flagged this for scrutiny, so to close it out explicitly: get_schema_node is an uncached single-row primary-key lookup on local SQLite (schema.rs:291-300). Against a turn that is dominated by multi-second local LLM inference, one extra point lookup is unmeasurable. On search_nodes it only fires on the empty branch, and it is correctly .filter(|t| !t.is_empty())-gated so an untyped search skips it entirely.

Adding a schema cache would introduce an invalidation problem (update_schema, rename_schema_field) in exchange for no observable gain — a textbook premature optimisation, and one that would risk serving the model a stale field list, which is worse than the defect being fixed. Correct as written.

8. 📁 packages/agent/src/local_agent/tools.rs:1465-1482 — the search_nodes empty branch introduces no new failure mode.

Also flagged for scrutiny, and it checks out. self.node_service()? inside the empty branch cannot cause a legitimately-empty search to error, because run_node_query (tools.rs:1359) calls self.node_service()? as its first statement and propagates with ?. Any absent-service case fails before the empty branch is reachable. The inner failures are all swallowed correctly too: if let Ok(Some(schema)) degrades to no filterable_properties rather than failing the search, and the !fields.is_empty() guard means a fieldless type omits the key rather than claiming an empty field set — matching the get_node side. Consistent and right.


ADR-063 verification (explicitly requested)

The issue demands this be re-verified, not assumed, so I traced it independently rather than trusting the test name.

The guarantee holds, and it is structural rather than incidental. build_available_properties (entity_types_block.rs:338-364) iterates schema.fields and only schema.fields; the node's properties map is consulted solely to compute the boolean is_set via properties.get(&descriptor.name). There is no code path by which a key present in properties but absent from the schema can enter the output. available_properties_names_only_schema_defined_fields pins this with a deliberately adversarial fixture (weight, custom:color), and deterministic_available_properties_advertises_no_undefined_bare_keys cross-checks the emitted names against ns.get_schema_node("task").fields at runtime — so it validates against the real seeded core schema, not a hand-built one. That's the stronger of the two forms and the right one to have.

Is the test sufficient? For the property it states — "this channel never advertises an undefined key" — yes, and it is non-vacuous (it asserts the list is non-empty first, so it cannot pass by advertising nothing).

Is there a path where the new channel leads to a bare key on a core type? I could not find one. The prefix rule keys off RELEVANT ENTITY TYPES via create_schema's guidance; this channel never touches that block, and context_ops.rs:214,235 is_core filters are unmodified. The update_node guidance change is a narrowing in the relevant sense — it broadens which keys are legitimate targets, but only to keys "the node's type already defines," and it retains the explicit "Do not invent a key from the user's wording." The one theoretical widening would be if a core schema itself contained a bare user-added field — but that is update_schema's job to reject at write time (per ADR-063), and this channel only reflects what is stored. Reflecting an already-violated schema is not a new hole.


Recommendation

APPROVE. (Posting as a comment — GitHub rejects --approve on a self-authored PR.)

Clearly net-positive, and unusually well-evidenced for a model-behaviour fix: a controlled A/B rather than a single anecdote, repeated reps at temperature 0.1, deterministic tests that fail without the fix, store-level assertions where the codebase has been burned before, and a fixture strengthened specifically so the right answer stops being reachable by accident. The architectural decision is correct and the reasoning for it is recorded where the next reader will find it.

Before merge, I'd ask for just one thing:

And one worth doing but not gating:

  • 🟡-1 — 10c's noRetry scores green on the "never searched at all" outcome, so it does not currently guard the read-path defect it was added for. Since the write-side scenario (10b) is correctly guarded by minProperties, this doesn't undermine the PR's evidence — but the scenario will read as protective when it isn't.

🟢-3 through 🟢-6 are polish and can be folded in here or left. 🟢-7 and 🟢-8 need no action — they are the two scrutiny items I checked and found already correct.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — PR #1941

Review Type: Initial Review
Scope: 4 files, +1107 / −10 (tools.rs, entity_types_block.rs, live_unset_schema_field.rs, agent-matrix.ts)
Verdict: ✅ APPROVE (posted as a comment — GitHub rejects self-approval)


Summary

This is a well-diagnosed fix for a real, precisely-characterised defect, and the architectural call at its centre is the right one. Delivering the field list on the tool result rather than widening RELEVANT ENTITY TYPES is correct for two independent reasons the PR states and I verified: it keeps routing.rs's is_core exclusion untouched (so ADR-063's bare-key hole stays closed), and it matches the semantics — core types need to be always known, not retrieved. Routing a fixed set through a relevance mechanism would have been a category error.

I verified the claims rather than taking them at face value. The load-bearing ones hold. git diff --name-only confirms only 4 files changed; routing.rs and context_ops.rs are byte-identical to origin/main, and nothing in the diff feeds the routing block. All 8 deterministic tests pass on a clean run (cargo test -p nodespace-agent --test live_unset_schema_field → 8 passed, 2 ignored), and the 5 new entity_types_block unit tests pass (12/12 in that module).

Two things stand out as genuinely good practice: the round-trip test asserts against the store, not the tool's own report — the exact lesson from #1937 — and the no_matches_hint prose string was removed mid-PR on ADR-064 rule 4 grounds, with a test added to pin the result to facts only. Deleting your own helpful-sounding string because the doctrine is measured rather than stylistic is the correct instinct.

Findings below are one 🟡 on the eval fixture, one 🟡 on an honest-but-incomplete acceptance criterion, and the rest 🟢. None block merge.


Requirements Check (issue #1939)

# Criterion Status
1 Set due date persists due_date without user naming the field ✅ Live 3/3 on locked model; deterministic_unset_field_name_round_trips_through_update_node asserts persistence against the store
2 "How many tasks are open?" filters on status without asking the user ⚠️ Partial — see 🟡-2. The asking is fixed (0/3 → 3/3 retry, verified A/B). The filtering does not complete, due to a pre-existing defect
3 Model can distinguish "defined but unset" from "does not exist" ✅ The set flag; available_properties_lists_unset_fields_marked_not_set + available_properties_treats_null_as_unset
4 Enum-valued fields expose allowed values ✅ allowed_values from from_schema_field (core ∪ user values); asserted on both get_node and search_nodes paths
5 Guidance no longer implies only populated keys are writable ✅ update_node.properties description, get_node description, and the #1938 no-op rejection text all rewritten
6 Regression test: set previously-unset schema field end-to-end ✅ Runs in test:all, not only under #[ignore] — the right call
7 Agent-matrix scenario for set-unset-field and filter-by-unset-field ✅ 10a/10b/10c. Winnability verified (below), with one scoring caveat: 🟡-1
8 Verified on locked native model (gemma-4-E4B-it-Q4_K_M) ✅ Both paths, 3 reps, with a controlled A/B on the read path

Winnability check on scenario 10 (requested explicitly). I confirmed against packages/core/src/models/core_schemas.rs that the seeded core task schema defines status (enum: open/in_progress/done/cancelled, required), priority (enum), due_date (date), started_at, completed_at, and assignee. So 10b's due_date and 10c's status/open are all real, and scenario 10 is winnable by construction — it is not the album/artist trap the file's own comments warn about. minProperties: 1 routes through callPersistedProperties, which correctly reds out isError, contentOnly, and fieldCount < min. Good.


Code Review Findings

🟡 Important

1. 📁 scripts/eval/fixtures/agent-matrix.ts:519-522 — scenario 10c's assertion cannot detect the failure its own comment names.

The comment states the defect "shows up here as the search never firing at all." But noRetry (agent-matrix.ts:263-275) only trips on runLength > 1; with zero search_nodes calls the loop body never executes and it returns {passed: true}. assertExpectation({kind:"noRetry", tool:"search_nodes"}, []) passes. The sibling noExtraTypes branch explicitly guards the zero case ("got 0"), and agent-matrix.test.ts:269 tests for it — noRetry has no such guard.

So 10c scores green on the exact production behaviour that motivated this PR: the model stopping to interrogate the user and never searching. That is the reverse of what an eval scenario is for, and it is precisely the "measures the fixture, not the model" failure this file's comments elsewhere are vigilant about.

The reasoning for choosing noRetry over toolOnce is sound — a narrowing follow-up search is legitimate, so a hard count is wrong. But the two concerns are separable: you want "fired at least once, and never twice in a row." Options, cheapest first:

  • Add a zero-call guard to the noRetry branch (if (!actions.includes(expect.tool)) return {passed:false, ...}), matching noExtraTypes. This changes shared semantics, so check the other noRetry users first — but "no blind retry loop" arguably always implies the tool ran.
  • Or introduce {kind:"noRetry", tool, minCalls?: 1} and set it on 10c only, leaving existing scenarios untouched.

Principle: a test that cannot fail on its target behaviour provides no signal — it converts an unmeasured gap into a falsely-measured one, which is strictly worse than leaving it unmeasured. This is the same class of hole minProperties was introduced to close on the write side (#1937).

2. 📁 packages/agent/tests/live_unset_schema_field.rs:625-798 — acceptance criterion 2 is genuinely not fully met, and the PR should say so in the issue, not only in the PR body.

You asked me to be direct rather than rubber-stamp this, so: the scoping call is correct, but the criterion is not satisfied.

What's right about the scoping. The A/B is clean and it isolates the variable properly — identical prompts, identical fixtures, one payload difference, 0/3 → 3/3. That is strong evidence the field list is the causal factor, and the fixture strengthening (adding a genuinely-open task so "there are no open tasks" stops being the correct answer) is exactly the right move — without it, giving up and recovering would score identically. Refusing to assert clean execution is also right: tying a schema-visibility fix to an unrelated arg-serialisation bug would make this suite fail for something it doesn't own, and CLAUDE.md's atomicity preference supports not bundling the two.

What is nonetheless true. Criterion 2 reads "filters on status without asking the user" — and the filtering does not happen. The model forms the right intent and emits malformed args ({"\"property\"": "status"}) 3/3, so the search never runs. A user asking "how many tasks are open?" today still does not get a count. The PR body is admirably honest about this ("blocks the read path from completing"), and the doc comment at :644-656 is excellent — it records the measurement, the reasoning, and the fact that the retry is executed for visibility so a future fix surfaces in the log rather than silently.

My recommendation is not to fix it here. It is: mark criterion 2 as partial on the issue rather than checked, and open the follow-up issue before merging — the PR offers to ("I can open one if you'd like"). A 3/3-reproducing defect that blocks a shipped acceptance criterion should not depend on someone remembering a sentence in a merged PR body. That is the whole difference between a scoped-out defect and a lost one.

Principle: honest partial delivery beats overclaimed completion — but the boundary has to be recorded somewhere durable, or scoping becomes indistinguishable from dropping.

🟢 Suggestions

3. 📁 packages/agent/src/local_agent/tools.rs:552 — the get_node description overclaims for format=markdown.

The description now states unconditionally: "Returns the node's current values in 'properties', plus 'available_properties' — every field this node's type defines…". But the format == "markdown" branch (tools.rs:1840-1868) returns json!({"markdown": truncated}) and never reaches the attach logic — no properties, no available_properties.

Defensible in practice (markdown mode is for reading a document, not inspecting state), and the model is unlikely to reach for markdown when hunting a field name. But the description is a model-facing contract, and a model that did call format=markdown and found neither key would be reading a broken promise. Consider scoping the sentence: "In the default format, returns … . Use format=markdown to include all descendants as a readable document."

4. 📁 packages/agent/src/local_agent/tools.rs:1889 — nodeType is correct for all live paths, but the schema path works by accident.

I verified all four serialization paths in packages/nodespace-types/src/convert.rs:

  • generic Node — #[serde(rename_all = "camelCase")] → nodeType ✅
  • TaskNode — explicit #[serde(rename = "nodeType")] ✅
  • AiChatNode — explicit #[serde(rename = "nodeType")] ✅
  • SchemaNode — has no node_type field at all, so no nodeType key is emitted

So there is no silent partial failure on any type where the feature is meant to work. But the schema case is worth noting: deterministic_get_node_on_a_schema_node_is_sane passes because the lookup silently no-ops on a missing key — not because anything checks "don't describe a schema node with its own instance fields." The inline comment ("both the generic Node and TaskNode camelCase it") is accurate but doesn't mention the third case that's load-bearing for the schema test.

Worth one comment line noting that SchemaNode emits no nodeType, so schema nodes skip this path by construction. Otherwise a future nodeType addition to SchemaNode — entirely plausible — would silently start describing the task schema node using task's instance fields, and the test guarding that would still pass while its if let Some(...) guard quietly stops covering anything.

5. 📁 packages/agent/tests/live_unset_schema_field.rs:590-595 and :613-622 — two conditionally-asserting tests are weaker than their doc comments claim.

Both wrap their assertions in if let Some(available) = stored.result.get("available_properties"), so both pass vacuously when the key is absent — which is the current behaviour in both cases. deterministic_fieldless_type_is_unaffected does assert unconditionally that get_node still succeeds and returns the content (real value — the "field list is an addition, never a precondition" contract is genuinely covered). But its stated contract, "the list must be absent, not an empty array," is only half-checked: it never asserts absence. Since text has fields: vec![] in core_schemas.rs:324, the outcome is deterministic — assert!(stored.result.get("available_properties").is_none()) would be exact and would catch a regression that started emitting [].

Same for the schema-node test: assert!(stored.result.get("available_properties").is_none()) states the actual invariant. The conditional form is defensive against a shape you already control.

Principle: a conditional assertion is a test that opts out of failing. Where the expected state is deterministic, assert it directly.

6. 📁 packages/agent/src/local_agent/tools.rs:1488-1497 — the set-stripping in search_nodes is a small structural smell.

Building the full per-node descriptor and then obj.remove("set") because there is no node is correct in effect (the test at :268-273 pins it), but it constructs a wrong value in order to correct it. A set-free variant — or a properties: Option<&Value> parameter where None omits the flag — would make the type-level vs. node-level distinction explicit at the API boundary rather than by post-hoc mutation. Nit-level; the current form is tested and the comment explains why.

7. 📁 packages/agent/src/local_agent/tools.rs:1467, 1888 — performance is fine as-is; do not cache.

You flagged this for scrutiny, so to close it out explicitly: get_schema_node is an uncached single-row primary-key lookup on local SQLite (schema.rs:291-300). Against a turn that is dominated by multi-second local LLM inference, one extra point lookup is unmeasurable. On search_nodes it only fires on the empty branch, and it is correctly .filter(|t| !t.is_empty())-gated so an untyped search skips it entirely.

Adding a schema cache would introduce an invalidation problem (update_schema, rename_schema_field) in exchange for no observable gain — a textbook premature optimisation, and one that would risk serving the model a stale field list, which is worse than the defect being fixed. Correct as written.

8. 📁 packages/agent/src/local_agent/tools.rs:1465-1482 — the search_nodes empty branch introduces no new failure mode.

Also flagged for scrutiny, and it checks out. self.node_service()? inside the empty branch cannot cause a legitimately-empty search to error, because run_node_query (tools.rs:1359) calls self.node_service()? as its first statement and propagates with ?. Any absent-service case fails before the empty branch is reachable. The inner failures are all swallowed correctly too: if let Ok(Some(schema)) degrades to no filterable_properties rather than failing the search, and the !fields.is_empty() guard means a fieldless type omits the key rather than claiming an empty field set — matching the get_node side. Consistent and right.


ADR-063 verification (explicitly requested)

The issue demands this be re-verified, not assumed, so I traced it independently rather than trusting the test name.

The guarantee holds, and it is structural rather than incidental. build_available_properties (entity_types_block.rs:338-364) iterates schema.fields and only schema.fields; the node's properties map is consulted solely to compute the boolean is_set via properties.get(&descriptor.name). There is no code path by which a key present in properties but absent from the schema can enter the output. available_properties_names_only_schema_defined_fields pins this with a deliberately adversarial fixture (weight, custom:color), and deterministic_available_properties_advertises_no_undefined_bare_keys cross-checks the emitted names against ns.get_schema_node("task").fields at runtime — so it validates against the real seeded core schema, not a hand-built one. That's the stronger of the two forms and the right one to have.

Is the test sufficient? For the property it states — "this channel never advertises an undefined key" — yes, and it is non-vacuous (it asserts the list is non-empty first, so it cannot pass by advertising nothing).

Is there a path where the new channel leads to a bare key on a core type? I could not find one. The prefix rule keys off RELEVANT ENTITY TYPES via create_schema's guidance; this channel never touches that block, and context_ops.rs:214,235 is_core filters are unmodified. The update_node guidance change is a narrowing in the relevant sense — it broadens which keys are legitimate targets, but only to keys "the node's type already defines," and it retains the explicit "Do not invent a key from the user's wording." The one theoretical widening would be if a core schema itself contained a bare user-added field — but that is update_schema's job to reject at write time (per ADR-063), and this channel only reflects what is stored. Reflecting an already-violated schema is not a new hole.


Recommendation

APPROVE. (Posting as a comment — GitHub rejects --approve on a self-authored PR.)

Clearly net-positive, and unusually well-evidenced for a model-behaviour fix: a controlled A/B rather than a single anecdote, repeated reps at temperature 0.1, deterministic tests that fail without the fix, store-level assertions where the codebase has been burned before, and a fixture strengthened specifically so the right answer stops being reachable by accident. The architectural decision is correct and the reasoning for it is recorded where the next reader will find it.

Before merge, I'd ask for just one thing:

  • 🟡-2 — open the follow-up issue for the malformed-args defect and mark criterion 2 partial on #1939. Two minutes; it's the difference between scoped-out and lost.

And one worth doing but not gating:

  • 🟡-1 — 10c's noRetry scores green on the "never searched at all" outcome, so it does not currently guard the read-path defect it was added for. Since the write-side scenario (10b) is correctly guarded by minProperties, this doesn't undermine the PR's evidence — but the scenario will read as protective when it isn't.

🟢-3 through 🟢-6 are polish and can be folded in here or left. 🟢-7 and 🟢-8 need no action — they are the two scrutiny items I checked and found already correct.

…rtions

Review finding 1 was a real bug in my own test. Scenario 10c's comment
claimed it catches "the search never firing at all", but bare `noRetry`
provably cannot: its run-length loop never executes over zero calls, so
`assertExpectation({kind:"noRetry",...}, [])` returns passed. The scenario
scored GREEN on the exact production behavior it was added to catch — the
model stopping to interrogate the user instead of searching. A scenario
that cannot fail on its target behavior is worse than none: it converts an
unmeasured gap into a falsely-measured one.

Added an opt-in `minCalls` and set it on 10c only, rather than making the
zero-call guard unconditional. Scenario 7 also uses `noRetry`, and
re-scoring an existing baseline scenario is not something single-run matrix
numbers can absorb silently. Six tests now pin the behavior, including one
documenting the default's blind spot so the reason `minCalls` exists is
recorded rather than implied.

Also from review:
- get_node's description no longer promises `properties` and
  `available_properties` unconditionally; the markdown branch returns
  neither, and a model-facing description is a contract.
- Recorded that `SchemaNode` emits no `nodeType` and so skips the attach
  block by construction. That is load-bearing — it is what stops the task
  SCHEMA node being described with task's instance fields — and a future
  `nodeType` on `SchemaNode` would silently break it.
- Two tests wrapped assertions in `if let Some(...)`, opting out of failing
  where the state is deterministic. Both now assert absence directly, which
  is the real invariant and catches regressions the conditional form would
  pass over.

Skipped the `set`-stripping refactor (marked nit): the current form is
tested and commented, and reshaping an API signature for aesthetics is
churn this PR does not need.

Refs #1939

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Review addressed — commit 0a45b063

7 of 8 findings addressed, 1 skipped. Both 🟡 items were right; 🟡-1 was a genuine bug in my own test.

🟡-1 — scenario 10c couldn't detect its own target behavior ✅

Verified the claim before acting: noRetry's run-length loop never executes over zero calls, so assertExpectation({kind:"noRetry",...}, []) returns passed. The scenario scored green on the exact production behavior that motivated this PR — the model stopping to interrogate the user and never searching. My comment asserting it caught that case was simply wrong.

Took the minCalls opt-in rather than the unconditional zero-guard. Scenario 7 (agent-matrix.ts:382) also uses noRetry, and re-scoring an existing baseline scenario isn't something single-run matrix numbers can absorb silently — the cheaper fix would have been the riskier one here.

Six new tests, including one that documents the default's blind spot explicitly, so the reason minCalls exists is pinned rather than implied. test:scripts 87 → 93.

🟡-2 — criterion 2 marked partial, follow-up opened ✅

Opened #1943 with the repro command, the measured A/B, and the upgraded assertion as an acceptance criterion. Posted an AC status comment on #1939 marking criterion 2 partial with the reasoning.

Agreed with the framing: "the boundary has to be recorded somewhere durable, or scoping becomes indistinguishable from dropping." The test's doc comment now points at that tracking too — without embedding the number, per the docs standard.

🟢-3, 🟢-4, 🟢-5 ✅

  • get_node description no longer promises properties/available_properties unconditionally — the markdown branch returns neither, and a model-facing description is a contract.
  • SchemaNode comment: recorded that it emits no nodeType and so skips the block by construction. Your point that the schema test passes by accident of that omission rather than by design is the useful half — the comment now says a future nodeType on SchemaNode would need an explicit guard, since the test would keep passing while covering nothing.
  • Conditional assertions: both now assert absence directly. On the schema test I went with is_none() rather than "does not contain due_date" for the reason you gave — the weaker form would pass if it started describing the node with the schema type's fields.

⏭️ Skipped: 🟢-6 (set-stripping refactor)

You marked it nit-level and noted the current form is tested and commented. Reshaping a public signature for structural cleanliness is churn this PR doesn't need; the remove("set") is pinned by a test that states why. Worth revisiting if a third caller ever needs the type-level variant — at that point the distinction earns its place in the signature.

🟢-7, 🟢-8 — no action

Confirmed correct as-is. Agreed on caching: invalidation risk against update_schema/rename_schema_field in exchange for no measurable gain, and a stale field list would be worse than the defect being fixed.

Verification

  • test:all — frontend 171 files / 4108 tests, browser 2/24, Rust green. Matches baseline exactly.
  • test:scripts 93 pass, entity_types_block 12/12, live_unset_schema_field 8 pass / 2 ignored.
  • quality:fix clean; workspace-wide cargo fmt spillover onto 9 unrelated files reverted again.
  • Live tests not re-run — no production code path changed except the two tool descriptions, and the write path's 3/3 doesn't depend on either.

🤖 Generated with Claude Code

@malibio

malibio commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Correction to the verification note above: I wrote that the live tests weren't re-run because no relevant path changed. That was wrong — the write-path test loads get_node's real definition via all_tool_definitions(), and I edited that description in this commit. So it was worth re-running rather than reasoning about.

Re-ran both against the final code:

LIVE SUMMARY: recovered=3 asked_the_user=0 of 3          (read path)
LIVE SUMMARY: persisted=3 of 3 usable reps (3 total)     (write path)
test result: ok. 2 passed; 0 failed

Unchanged — write path still 3/3 persisting due_date, read path still 3/3 going back to the graph rather than the user. The scoped-out arg-serialization defect (#1943) still reproduces 3/3, as expected.

@malibio
malibio merged commit 56cd510 into main Aug 3, 2026
2 checks passed
@malibio
malibio deleted the issue-1939-schema-fields-get-node branch August 3, 2026 19:28
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.

Agent cannot set or filter a defined-but-unset schema field: no tool exposes a node type's field list

1 participant