Repository navigation
Stop create_node from silently discarding user values with no matching schema field (#1866) - #1897
Conversation
…g schema field (#1866) Agent-matrix scenario 4 ("Log a laser cutter checked out on the 12th, replacement cost 2400") called create_node, succeeded, and persisted zero properties while telling the user the record was saved. The storage path was not at fault. `exec_create_node` derives its reported property_count by re-fetching the stored node, so the zero was a truthful reading, and `normalize_flat_properties_to_namespace` namespaces unknown keys rather than filtering them. The new core test pins all three cases: a declared field's value persists, an UNDECLARED field's value also persists, and zero is reported only when the arguments were genuinely empty. That last pairing is what makes the count diagnostic — "schema omitted the field" and "model omitted the value" no longer collapse into the same reading. The gap was in what the model was told. The Node Creation guidance covered only values MATCHING a listed field and was silent on a supplied value with no field to hold it. Faced with that silence the model discarded the value and said the schema "does not currently support logging replacement costs" — a defensible reading of the instructions as written, and silent data loss. Both surfaces now state the rule, because scenario 4's traces show routing varying across arms while the empty-call outcome stayed identical: guidance alone would leave the gap open on exactly the paths that were failing. Examples in both are deliberately neutral ("weight: 40kg") rather than the scenario's own value, so the fix cannot be measured by the model pattern-matching the example it was given. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
Pragmatic Code Review — PR #1897Review Type: Initial Review Requirements Check
Is closing #1866 on 1+2 with 3 delegated to #1895/#1896 scope-dodging? No. Those are genuinely different mechanisms (#1895 wrong But criterion 3 is the criterion that says the bug is fixed. Closing with it unchecked means #1866's own success condition is unverified — either leave it open pending an adequately-powered run, or restate its scope as "criteria 1+2" so the unmeasured claim isn't inherited as settled. Findings🔴 Critical: guidance instructs bare keys on core types — contradicts ADR-063 and bypasses the one place it's enforced📁
Unconditional about key format; never distinguishes user-defined from core types (
Confirmed empirically via a probe through real Both persisted bare. Note The cause is a validator asymmetry:
The guidance explicitly closes the guarded door — "Do NOT call create_schema or update_schema to add the field first" — routing the model away from the validated path toward the unvalidated one. That inversion is what makes this critical: the PR doesn't merely fail to enforce ADR-063, it instructs the model to bypass the one place it is enforced. An agent following this can write Recommendation — scope the rule to type ownership, mirroring ADR-063's own conditional:
Plus a test asserting both cases are named. Stronger option worth a follow-up issue: enforce in code, not prose. 🔴 Critical: internal contradiction with
|
malibio
left a comment
There was a problem hiding this comment.
Review status: REQUEST CHANGES (posting as a comment — GitHub does not permit request-changes on one's own PR).
Blocker: the new guidance instructs bare property keys on core types, contradicting ADR-063 while routing the model away from update_schema — the one place that rule is enforced. Motivating failure was a text node, so this is the default path, not an edge case.
Full findings in the review comment above. Addressing now.
…063)
The guidance told the model to key an undeclared value bare, unconditionally.
On a core type (text/task/date) that is the exact configuration ADR-063
prohibits and update_schema rejects — and the guidance simultaneously routed
the model away from update_schema, the one place the rule is enforced. The
motivating failure was a text node, so this was the default path, not an edge
case. Fixing "value silently discarded" that way would have traded it for
"value silently written under a key the schema layer would have refused",
which is harder to spot because the value looks stored.
Both surfaces now state the same conditional: bare on a user-defined type,
`custom:`-prefixed on a built-in one, with the reason (unprefixed names are
reserved — status, priority, due_date are real examples that would collide).
PROPERTY KEYS is renamed to PROPERTY KEYS FOR LISTED FIELDS. Its unqualified
heading sat four lines below the new rule and read as a general prohibition on
prefixes, so the two paragraphs jointly steered toward the ADR violation.
Key drift: the rule now derives the key from the user's own noun rather than
leaving it to free invention, so the same fact lands under the same key across
turns instead of weight/weight_kg/mass.
Adds both_surfaces_agree_on_the_undeclared_key_rule. The duplication across
skill guidance and tool schema is deliberate — routing does not always reach
Node Creation — but nothing pinned the two together. The first version of this
test was toothless: it asserted contains("custom:"), which the worked example
satisfies on its own, so flipping the tool schema to "bare on a built-in type"
still passed. It now asserts the prefix is tied to built-in types, verified by
mutating each surface in turn and confirming both fail.
Also from review: the "doesn't support" assertion pinned a quoted symptom
rather than a rule, so an equally good reword would have broken it; it now
pins the prohibition itself. persisted_count's doc claimed to mirror
exec_create_node's filter, but production uses a plain len() because
flatten_properties_for_api already stripped internals upstream — reworded as
belt-and-braces. The two >= assertions are now exact: equipment is
user-defined with no defaults, so a looser bound would also pass if storage
started injecting keys, which is what these tests exist to catch.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
Review addressed —
|
Pragmatic Code Review — PR #1897 (Re-Review)Review Type: Re-Review — 1 prior review, one new commit Previous Review Summary
On 🟡-3: I re-ran the mutation test myself rather than trusting the reported result — given a toothless first version had already shipped, the author's own green run was not sufficient evidence. Mutating each surface in turn makes Requirements Check
Scoping the closed #1866 to criteria 1+2 and delegating 3 to #1895/#1896/#1899 is correct and clearly recorded. New Finding🟠 The "in the block ⇒ user-defined ⇒ bare key" inference is unsound by construction📁 let schemas: Vec<SchemaNode> = results
.into_iter()
.filter_map(|(node, _score)| SchemaNode::from_node(node).ok())
.collect(); // ← no is_core filterRetrieval is scoped only by The decisive tell is the sibling branch writing to the same 📁 if schema.is_core {
continue; // skip built-in types
}One branch guards; the branch it augments doesn't. That asymmetry reads as oversight, not intent. Why 🟠 and not a blocker: seeding uses raw Recommendation: add Principle: a correctness property should be enforced where it is relied upon, not left to an accident of which code path happens to populate the data. A correction to my own prior review: I previously traced only Assessment of the fix itselfThe two-branch conditional is stated correctly and names the core types explicitly on both surfaces. The added length is justified: the guidance is a routed skill body, not the resident prompt, so the documented prompt-bloat penalty (10,493 chars scoring 50% vs 73% for 445) does not apply the same way — it is only assembled on turns that route to Node Creation. I looked for a mis-branching risk from the new conditional and don't consider it material: both branches name their trigger concretely. Standards: no issue numbers in code/doc comments, no lint suppression, no dead code. All requested tests green (agent lib 404 passed, core persistence 3 passed, contamination guard passes). Recommendation: APPROVEThe blocker from the prior review is genuinely fixed on both surfaces, and the fix was verified rather than taken on trust. On the 🟠: it is pre-existing — present in I would not block the merge, but I'd raise the follow-up above a nit: it is the difference between the new guidance being correct by construction and correct by coincidence. |
malibio
left a comment
There was a problem hiding this comment.
Re-review complete: APPROVE (posting as comment — GitHub blocks self-approval).
Both 🔴 blockers fixed on both surfaces and independently verified (mutation test re-run rather than trusted). 7/9 prior findings addressed, 2 defensibly skipped.
One new 🟠, pre-existing and latent: context_ops.rs:296 lacks the !is_core filter its sibling branch at local_agent_service.rs:1878 has, so the new guidance's "in RELEVANT ENTITY TYPES ⇒ user-defined" premise is correct by coincidence rather than construction. Not created by this PR; tracked as hardening on #1899.
…ue refs from comments - related_one_hop_schemas now filters is_core, closing the same class of gap on the incoming/outgoing relationship traversal: a user-defined schema relating to a core type (e.g. project -> task) could otherwise place that core type in related_schemas. It renders under a different heading than RELEVANT ENTITY TYPES so this wasn't the ADR-063 hazard itself, but there's no reason for a core type in either block, and fixing it removes reliance on core schemas happening to declare no relationships of their own. - Removed #1897/#1900 references from doc comments per the documentation standard (describe behavior directly, cite ADRs not tickets). Co-Authored-By: Claude <[email protected]>
* Filter is_core schemas out of semantic schema retrieval (closes #1900) workspace_context's semantic schema search was scoped only by node_type == "schema", so core types (text/task/date) were retrievable alongside user-defined ones -- unlike the sibling recently-created-schema injection in local_agent_service.rs, which already guards on is_core. A core type reaching RELEVANT ENTITY TYPES would make the #1897 create_node guidance read it as user-defined and write a bare property key onto it, the ADR-063 violation that guidance exists to prevent. Co-Authored-By: Claude <[email protected]> * Address review: exclude core types from related_schemas too, drop issue refs from comments - related_one_hop_schemas now filters is_core, closing the same class of gap on the incoming/outgoing relationship traversal: a user-defined schema relating to a core type (e.g. project -> task) could otherwise place that core type in related_schemas. It renders under a different heading than RELEVANT ENTITY TYPES so this wasn't the ADR-063 hazard itself, but there's no reason for a core type in either block, and fixing it removes reliance on core schemas happening to declare no relationships of their own. - Removed #1897/#1900 references from doc comments per the documentation standard (describe behavior directly, cite ADRs not tickets). Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Closes #1866.
What this fixes
Agent-matrix scenario 4 ("Log a laser cutter checked out on the 12th, replacement cost 2400") called
create_node, succeeded, and persisted zero properties — while telling the user the record was saved. 9/9 failures across three builds.Root cause — not where the issue expected
The issue's leading hypothesis was that storage or the tool exec path was dropping values. It isn't.
exec_create_nodederivesproperty_countby re-fetching the stored node, andnormalize_flat_properties_to_namespacenamespaces unknown keys rather than filtering them.The model was discarding the value before the call, and said so out loud:
The Node Creation guidance covered only values matching a listed field and was silent on a supplied value with no field to hold it. Discarding was a defensible reading of the instructions as written.
Changes
skill_pipeline.rs— newVALUES WITH NO MATCHING FIELDsection: record the value under a key of your own, never drop it, never reply that the type "doesn't support" it, and don't detour throughcreate_schema(the skill's whitelist doesn't offer it, so that path dead-ends).tools.rs— thecreate_nodetool schema'spropertiesdescription now states extra keys are allowed. Both surfaces, because the traces show routing varying across arms while the empty-call outcome stayed identical.create_node_property_persistence_test.rs(new, 3 tests) — pins that a declared field's value persists, an undeclared field's value also persists, and zero is reported only when arguments were genuinely empty. That pairing is what makesfieldCountdiagnostic in both directions.Examples are deliberately neutral (
weight: 40kg, not the scenario's ownreplacement_cost: 2400) so the fix can't be measured by the model pattern-matching the example —guidance_is_not_contaminated_by_eval_promptsenforces this and passes.Measurement — scenario 4 is 2/3, criterion not met
3 runs, E4B @ n_ctx 32768, purged DB, daemon+CLI rebuilt from this commit,
NODESPACE_HOME-isolated, guidance provenance verified before scoring.Against 0/9 before. The diagnosed mechanism did not recur in any run, but 2/3 does not meet "passes across repeated runs," and the remaining failures are two different defects, filed separately:
create_nodeaccepts a nonexistentnode_type(display name instead of schema id) and silently persists zero properties. Run 2's failure.Totals (mean 6.7) sit inside the documented 6–7 noise band, as expected for a single-scenario fix.
Testing
bun run test:all— no new failures vs baseline (170 files / 4097 tests).core-plugins.test.ts > should resolve viewer componentstimes out at the 5s default under load; passes in 2.7s with headroom, and passes on the pristine primary checkout. This change is Rust-only.🤖 Generated with Claude Code