Repository navigation
create_node discards user-supplied schema field values: the guidance referenced a structure absent from the prompt (#1841) - #1847
Conversation
…e_node can populate properties (#1841) The node-creation guidance instructs the model to read fields[].name and to treat required=true fields as mandatory in the properties map, but the entity block rendered field NAMES only. The referent for those instructions did not exist in the model's context, so it fell back to the two parameters it could ground (content, node_type) and omitted properties entirely, persisting bare shells. - context_ops: render name, type, and required-ness per field - skill_pipeline: point the guidance at RELEVANT ENTITY TYPES rather than the absent schema_metadata structure - tools.rs: de-hedge create_node's properties description Co-Authored-By: Claude <[email protected]>
Code Review — PR #1847Review Type: Initial Review (no prior reviews or comments on the PR) Scope reviewed: SummaryThis is a net-positive change and a materially better diagnosis than the issue proposed. The issue asserted the cause was ADR-064 rule 5 (prose) and offered two prose candidates; the PR shows it was rule 1 (context surface) — the guidance conditioned The change is small, cohesive, sits at the right layer, uses data already on I have one substantive finding (🟡): this PR fixes one of two Requirements Check (issue #1841)
📝 Note (good practice): the separately-discovered schema-contamination bug was filed as #1846 rather than folded in, and a pre/post control on Code Review Findings🟡 Important: a second
|
malibio
left a comment
There was a problem hiding this comment.
Recommendation: APPROVE (submitted as a comment — GitHub blocks self-approval on your own PR). Full report in the review comment above.
Diagnosis independently verified: the guidance's schema_metadata/fields[].name/required=true referent genuinely did not exist in the assembled prompt, and context_ops.rs was the field-metadata source on the creation turn. required.unwrap_or(false) matches the enforcement semantics in crud.rs:1705. No consumer parses the entity block, so the separator change is safe. Tests pass: 19/19 context_ops, 380/380 agent lib; format_for_prompt_schema_no_fields's !contains("(") still holds.
Two non-blocking 🟡 follow-ups on adjacent surfaces: routing.rs::render_schema_metadata is a second, unfixed producer of the same RELEVANT ENTITY TYPES header that co-occurs in the same prompt with a different format and still no required; and tools.rs promises title_template is "shown in ENTITY TYPES" when no renderer emits it — the same phantom-referent class this PR fixes.
…required and title_template through Review of #1847 found the workspace-context block is only one of two producers of this heading. agent_loop concatenates the routing candidate block into the same system prompt, so a single prompt carried two spellings of one concept: '(is_returned: boolean; replacement_cost: number)' from context_ops and 'is_returned (boolean), replacement_cost (number)' from routing, the latter three times. Confirmed against a captured prompt, not inferred. The routing renderer also never emitted required-ness at all — it was dropped at construction in skill_ops — which is the same phantom-referent defect this branch fixes, surviving in the other half of the prompt. And create_node's description promises title_template is 'shown in ENTITY TYPES' while neither renderer emitted it. - skill_ops: carry required into schema_metadata - routing: same 'name: type[, required]' notation, semicolon-separated, enum values preserved as 'name: enum (a, b)' - both renderers: emit title_template, giving the tool description a referent Co-Authored-By: Claude <[email protected]>
Addressed the 🟡 second-renderer finding — it was right, and confirmed against a real promptPushed Verified before fixing. Captured a live system prompt with So the review's read was exactly right: Changes
AfterField notation is now identical across all four. The residual difference is that End-to-end on the rebuilt daemon: A correction to my own earlier numbersWhile re-verifying I found the daemon I measured mid-investigation was stale — built during the pre/post-fix control for #1846 and never rebuilt after I restored the sources. One intermediate reading in the issue comments came from pre-fix code. It did not affect the reported results (the 9/12 eval and the original verification both ran on correctly-built daemons, and the eval records Tests
Not done hereThe review's suggested follow-up — collapsing the two renderers into one shared function — I have deliberately left out. They now agree on notation and content, but they read from different sources ( I have not re-run |
The review noted the routing renderer expands core_values/user_values while context_ops did not, so a 'status: enum' field reached the model without its legal values — the model then invents one and the write path rejects it. Same defect class as the missing type and required-ness this branch fixes: an instruction with no referent. Both renderers now emit 'name: enum (a, b)'. Covered by format_for_prompt_renders_enum_values. Addresses reviewer recommendations from PR #1847 review. Co-Authored-By: Claude <[email protected]>
/address-review summaryRan the review systematically against the posted findings. I had addressed the two headline 🟡 items ad-hoc before running this properly; the pass caught three items I had missed, buried in sub-points rather than headline findings. ✅ Addressed (6)
Enum values were consequence #3 of the 🟡 finding and I skipped them. A 📝 The seeded-guidance caveat, stated explicitly as the review askedThe ⏭️ Skipped (1)Collapsing both renderers into one shared function. They read different sources ( Revisit condition: filed as #1848 with acceptance criteria, including the open question of whether the block should appear up to four times per prompt at all — flagged to be measured, not assumed. 🧪 Tests
One honest note on verification: I tried to confirm enum rendering end-to-end on a live model and could not, because Re-Review DecisionDecision: RE-REVIEW NEEDED Rationale: Three commits have landed since the reviewed |
Code Review — PR #1847 (Re-Review)Review Type: Re-Review (delta pass) Two files in this delta — Previous Review Summary
Requirements Check (issue #1841)The delta does not change the AC verdicts from the initial review; it strengthens AC2.
📝 On the self-correction: the PR author disclosed that a daemon measured mid-investigation was stale, and that one intermediate reading came from pre-fix code. Volunteering an invalidated measurement that nobody would have caught, when the corrected result is more favorable, is the behavior that makes the other numbers in this PR trustworthy. Noted approvingly. Code Review Findings✅ Verified:
|
malibio
left a comment
There was a problem hiding this comment.
Re-review (delta 3902a742..HEAD): APPROVE. Both prior 🟡 findings properly closed, plus the 🟢 enum sub-point and the two process items. The two previously-unreviewed files (routing.rs, skill_ops.rs) hold up under fresh scrutiny — title_template key names match at both ends, malformed-entry skip survived the rewrite, and schema_metadata has no non-Rust consumer. Two new 🟢 findings, neither blocking. Full report in the PR comment above. Not merging — that call is yours.
… block A type with no fields rendered as '- type_id: ' — a trailing separator promising a field list that never arrives, which is the malformed-prompt class this branch exists to fix. context_ops already guards this; routing did not. Not reachable today (skill_ops filters to non-core schemas and zero-field types are all core), but a skill scoping itself with node_types makes it so, which skill_ops documents as recommended. Covered by a_zero_field_type_renders_without_a_dangling_separator. Addresses the re-review's first new finding. The second — that the [title_template: ...] notation is not described by the guidance prose — is deliberately skipped: the referent now exists, which was the defect, and the braces are self-describing. Editing seeded guidance requires a DB purge to take effect, so a cosmetic rewording is not worth re-seeding for. Co-Authored-By: Claude <[email protected]>
/address-review — re-review passBoth new 🟢 findings triaged. Pushed ✅ Addressed (1)🟢 Dangling Fixed rather than deferred. The reviewer marked it unreachable today, and that is correct ( Covered by ⏭️ Skipped (1)🟢 The defect was that the referent did not exist; it now does. The braces are self-describing, and the reviewer framed it as "a one-clause tightening next time guidance is touched." Editing Revisit condition: fold into the next substantive guidance edit, or into #1848 if the renderers are unified. 🧪 Tests
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The delta since the last review is a single three-line guard on an unreachable branch, plus one test. No logic change to any reachable path, no new API surface, no change to what the model receives for any schema that exists today. The re-review already examined the substantive work ( The review cycle is complete. Both passes returned APPROVE, every 🟡 is closed, and the two skipped 🟢 items carry stated justifications and revisit conditions. The PR is ready to merge — that call is the user's, not mine. Open follow-ups: #1846 (schema field contamination, pre-existing, proven not caused here) and #1848 (converge the two renderers; decide the 4-block duplication with measurement). |
SchemaField gained local_only, unique, and unique_case_insensitive while PR #1847 was in review. That branch never saw them, so it merged green and broke main on contact — the two test constructors added there no longer compile. Adds the three fields with their defaults. Renderer behavior is unchanged. Note for later: local_only marks a field machine-bound for sync purposes, not model-invisible, so the entity block advertising one would not be a leak. The two fields that set it today are on the core ai-chat schema, which neither renderer can reach (skill_ops filters to !is_core; context_ops renders only semantically-retrieved user schemas). Co-Authored-By: Claude <[email protected]>
…1848) (#1856) * Converge the RELEVANT ENTITY TYPES renderers on one shared function (#1848) The block reaching the agent was produced by two independent renderers — `context_ops::format_for_prompt` reading `SchemaNode`, and `routing::render_schema_metadata` reading the `schema_metadata` JSON built in `skill_ops`. #1847 aligned their output by hand; nothing kept them aligned. That divergence caused #1841: guidance conditioned `properties` population on field metadata only one renderer emitted, so the model saw an instruction with no referent and dropped every user-supplied value. Both paths now convert into `EntityTypeDescriptor` and render through `entity_types_block::render_entity_types`. The descriptor is the choke point — a field added to `SchemaField` reaches the prompt only through it, so it cannot land in one path and not the other. `skill_ops` now encodes its JSON *from* the same descriptor rather than hand-writing a parallel projection. The wire shape is unchanged: it is the model-facing `search_skills` response body, pinned by the routing latency suites, so it stays a contract rather than becoming an internal detail. Encode and decode sit adjacent as one reversible mapping. Behaviour note: routing now renders a named type as `- id: Name (fields)`, matching the workspace-context format. Production `schema_metadata` carries `name`, but every existing routing fixture omitted it, so the format the agent actually shipped was unasserted. Pinned by a new test. Measurement for the duplication question, rather than an assumption: a Stage-2 prompt carries 4 copies of the block (RETRIEVAL_TOP_K=3 candidates plus workspace context), ~141 redundant tokens for a 2-schema workspace. No seeded skill declares `node_types`, so every candidate takes the unscoped branch and the copies are identical rather than differently scoped — pinned by a test so the premise fails loudly if a seed scopes itself later. De-duplication is left as a separate decision; this change is behaviour-neutral on the block's content. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163 * Address review findings on the entity-block convergence (#1848) The AC-2 guard did not guard. `both_prompt_paths_render_a_schema_identically` derived both sides from one `from_schema` call, so it asserted round-trip fidelity — already covered by the test above it — while its docstring claimed it would catch a `SchemaField` addition wired into only one path. The JSON side is now spelled out independently, as `skill_ops` emits it. Verified by mutation: dropping `required` from the decoder now fails this test, where before it passed. The docstring no longer overclaims either. The structural guarantee is the real one and does not depend on the test: a single `render_line` means a new field reaches both paths or neither. The test pins the conversion seams on either side of that. Corrected the `enum_values` note. The claim that the widened condition is unobservable holds only for seeded core schemas. `validate_schema_field` enforces enum ⇒ has-values and never the converse, and `coreValues` is a documented key on the model-facing `create_schema` tool, so a `text` field carrying values validates today. Emitting values there is still the better behaviour — the model can only use legal values it is shown — but it is a widening of the `search_skills` response, not a no-op, and the comment now says so. Renamed the duplication test to the invariant it actually asserts, one copy per eligible candidate. Its `println!` was swallowed without `--nocapture`, so the measurement is now a dated finding in the doc comment rather than output nobody sees. Matched `no_seeded_skill_scopes_its_schema_metadata` to `find_skills`' predicate: an empty `node_types` array also falls through to the unscoped branch, so only a non-empty list really scopes a candidate. Fixed two stale comments in `search_skills_latency.rs` asserting entity types are not injected into the system prompt. Both routes are live, as this change measured. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163 * Re-run pre-push gate with the GPU free The two prior pushes used --no-verify because ai_chat_send_to_idle_test timed out at 300s waiting on live inference it could not get: another session held the model. This empty commit exists to exercise the gate under normal conditions. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163 * Address review: fix the scenario-3 copy of the stale prompt comment The review's finding 7 flagged `search_skills_latency.rs` for asserting entity types are not injected into the system prompt. Both routes are live, as this change measured, so the claim is false. The earlier fix corrected the module doc and the scenario-2 message but missed an identical scenario-3 message carrying the same false claim and the same stale issue reference. Verified by grep that no occurrence of either phrasing now remains in the crate. Also re-verified the AC-2 guard by mutation rather than by inspection: dropping the decoder's `required` read fails `both_prompt_paths_render_a_schema_identically`, and restoring it passes. A guard that cannot fail is worse than no guard, so this is checked rather than assumed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163 --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Closes #1841
Problem
create_nodepersisted a bare shell — content and type only — discarding every schema field value the user supplied in the same message:Root cause — not what the issue proposed
The issue placed this at ADR-064 rule 5 (prose), on the basis that the call surface was fine, and named two candidate prose fixes. Reading the verbatim prompt via
NODESPACE_PROMPT_DUMPshowed a different cause.The Node Creation guidance refers to
schema_metadatasix times — "Read the fields array from schema_metadata", "Required fields (required=true) MUST be included", "the field name exactly as it appears in schema_metadata fields[].name". All six occurrences in the prompt are the guidance mentioning the name. None is an actual payload. Noschema_metadataobject, nofieldsarray, norequiredflag existed anywhere in the model's context.What the model actually received was one line:
context_ops.rsmapped fields to names only, discardingfield_typeandrequired— both already present onSchemaField. Every field-population instruction was therefore unsatisfiable, and the model fell back to the two parameters it could ground (content,node_type) — exactly the two it emitted. That is rule 1 (context surface), not rule 5.Also ruled out: the tool schema offers
propertiescorrectly typed, and the grammar from #1844 is derived from the tool schemas and constrains syntax, not which optional fields are chosen.Changes
context_ops.rs— the actual fix. Render each field's name, type, and required-ness, giving the guidance's instructions a referent.skill_pipeline.rs— repoint the guidance's fiveschema_metadatareferences at RELEVANT ENTITY TYPES, and state the consequence of omission explicitly.tools.rs— de-hedge the description (the issue's candidate 1): "Optionally pass 'properties'" → "Always pass 'properties' with every schema field value the user supplied."context_ops.rsmodule doc claiming entity types are discovered viasearch_skillsreturningschema_metadata— the claim that made the phantom referent look correct.Verification
Isolated daemon (
NODESPACE_HOME,served_db_pathconfirmed), purged DB, rebuilt daemon, E4B, n_ctx 32768.Verified against the persisted node, not just the tool call.
bun run eval:agent: 9/12, up from the honest post-#1839 baseline of 8/12. Scenario 4 passes itsminPropertiesassertion.Attribution caveat: all three changes shipped together, so this repro does not isolate which carries the effect. The rendering change is primary on mechanism — rewording cannot fix an instruction whose referent does not exist — but that is reasoning, not measurement, and n=1 on a nondeterministic model.
AC3: 8d/8e are not downstream of 8c
The issue proposed one fix might clear 6, 8d and 8e. Measured, it does not — three separate causes:
toolOncewith nominProperties, so it scores green on this very bugresolve_query— resolve_query must return a resolved node, not query fragments #1637's handoff gap8c cannot store the artist because
album_trackerwas created withis_returned/replacement_cost— a separate, pre-existing schema-contamination bug, filed as #1846. I tested explicitly whether this PR caused it (rendering types could plausibly make a retrieved schema a more copyable template): pre-fixbd29598fand post-fix produce identical contaminated fields, so it is not caused here.Testing
bun run test:all— exit 0, 171 files / 4112 frontend tests, no new failures vs baselinebun run quality:fix— clean, no unrelated reformattingformat_for_prompt_marks_required_fieldstest covers the required-flag path; existing schema-block test updated to the new formatNote:
packages/agent/tests/search_skills_latency.rsbenches fail locally againstllama3.1:8bneeding a live Ollama — confirmed identical on pre-fixbd29598f, and not part oftest:all.🤖 Generated with Claude Code