Repository navigation
Give resolve_query's sub-prompt the enum values it tells the model to use (#1857) - #1861
Conversation
… use The sub-prompt instructs the model to map "a status word to an enum/status field", but rendered fields as `name (type)` — so an enum arrived as `condition (enum)` with its legal values nowhere in sight. The model had to invent one, and an invented value yields a filter matching nothing, which reads exactly like a request that legitimately had no match. This is the same no-referent shape as the guidance that told the model to populate `properties` from field metadata the prompt never carried: the instruction names something the prompt does not supply, and the failure is silent. Rendered through `EntityFieldDescriptor` rather than a local spelling, so this is the third call site on one renderer instead of a fourth hand-written one. `from_schema_field` becomes public to allow it. The notation now also matches the entity block the model sees elsewhere in the same conversation. The test asserts on the prompt text, not the tool's return value — the return value is well-formed whether or not the model guessed. Verified by mutation: against the old renderer the prompt shows `- condition (enum)` and the test fails. Eval: 6/12 with this change, and 6/12 on an unmodified build of the same commit — identical failures scenario for scenario, so this is neutral on the matrix. Note that baseline is down from the 10/12 measured before #1859 landed; scenario 6 (this change's target) fails in both arms for want of a resolve_query call at all, so the fix cannot be scored by the matrix today. Worth a look at whether #1859 regressed schema creation — 4, 8b and 8c all fail on rejected schemas or unpersisted properties, which is that area. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
Review TypeInitial review — PR #1861, single commit Verification actually run (not taken on faith):
Requirements Check
Findings🟡 1. The
|
malibio
left a comment
There was a problem hiding this comment.
Review posted above: COMMENT. Net-positive change, all claims independently verified (agent 400 green, core 1068+ green, clippy clean, mutation check re-performed). One item worth a decision before merge: EntityFieldDescriptor::render() appends , required — a node-creation obligation — into resolve_query's isolated filter-emission sub-call, where it has no guidance to ground it. See finding 1.
Reusing `render()` wholesale carried ", required" into `resolve_query`'s prompt. Reproduced before fixing: a required field rendered as `- replacement_cost: number, required`. That is not cosmetic. `required` has exactly one definition in front of this model — the node-creation guidance's "MUST be included in the properties map" — which is an obligation on a *write*. This sub-call is a lone user message with no system prompt and no tools, so the word arrives with no definition at all, and a model applying the one it knows would filter on a field the request never mentioned. That matches nothing, which is indistinguishable from a genuinely empty result: the same silent failure this PR set out to remove, reintroduced from the other side. Split `render_shape` (name, type, enum values) from `render` (that plus required-ness). The entity block keeps `render` — required-ness is exactly what it should say when the model is about to create a node. Read and filter prompts get `render_shape`. Both still share one renderer, so the convergence this PR is about is intact. Pinned by assertion rather than left to inspection: the fixture's number field is now required, so the test proves the suffix is suppressed rather than merely absent. Mutation-verified — restoring `.render()` fails it. Also corrected a comment claiming this notation "matches the entity block the model sees elsewhere in the same conversation." There is no same conversation; this is an isolated sub-call. The maintenance argument for convergence carries the change on its own. Reviewer's other findings needed no code change: `pub` is correct (`pub(crate)` cannot work across crates), the notation is coherent with the surrounding prompt, and the CapturingEngine/FixedJsonEngine duplication is worth consolidating at a third double, not a second. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
|
| contents | used by | |
|---|---|---|
render() |
name: type (values) + , required |
entity block — the model is about to create a node, so required-ness is exactly right |
render_shape() |
name: type (values) |
read/filter prompts — no write-time obligations |
Both still share one renderer, so the convergence this PR is about is intact. This is a split by context, not a fork.
Pinned, not assumed
The fixture's replacement_cost is now required, so the test proves the suffix is suppressed rather than merely absent — otherwise it would pass for the wrong reason. Mutation-verified:
--- mutant: .render_shape() → .render() ---
write-time obligations must not leak into a read/filter prompt
test result: FAILED
--- restored: ok ---
Entity block unaffected — renders_type_field_enum_required_and_template and required_and_enum_values_survive_the_routing_path both still green.
Also corrected
The reviewer caught that my comment claimed this notation "matches the entity block the model sees elsewhere in the same conversation." There is no same conversation — this is an isolated sub-call. Removed; the maintenance argument for convergence carries the change on its own without a model-facing-coherence claim that isn't true.
Findings needing no change
pubis correct — confirmednodespace-agentis a separate crate, sopub(crate)cannot work. Agreed it also narrows drift: the struct and its fields were alreadypub, so hand-construction was always possible; exposing the canonical conversion is the safer surface.- Notation coherent — the prompt refers to the list only as "the fields above" /
<field name>, both notation-agnostic. CapturingEngineduplication — consolidate at a third double, not a second. Deliberately skipped.
On the eval AC framing
Reviewer's pushback is fair and I'll restate it their way: nothing here shows the model uses the values, only that they reach it. "The behavioural half is deferred to #1862" is the honest phrasing, not "unmeasurable." And their point that finding 1 is exactly what that blind spot would hide is well taken — a prompt-presence test would not have caught the required leak either. It took a human-style read of what the word means to this model.
Checks
nodespace-agent 400 green · nodespace-core 1068 green · clippy clean · pre-push gate passed in full.
Re-Review Decision
Decision: NO RE-REVIEW NEEDED
Rationale: One finding, addressed exactly as scoped. The change is a two-method split with no new logic — render() is byte-identical in behaviour for its existing caller (proven by the unchanged entity-block tests), and the new render_shape() is render() minus one conditional suffix. The guard is mutation-verified in both directions. Nothing architectural moved, and the remaining findings were explicitly no-change or deferred-by-agreement.
Ready for merge, pending your call.
Closes #1857.
The defect
resolve_query's sub-prompt instructs the model to map "a status word to an enum/status field", but rendered fields asname (type):So an enum reached the model as
- condition (enum)— the instruction names a mapping the prompt gives it no way to perform. It has to invent a value, and an invented value produces a filter matching nothing, which is indistinguishable from a request that legitimately had no match.This is the same no-referent shape as the guidance that told the model to populate
propertiesfrom field metadata the prompt never carried (#1841): an instruction naming something the prompt does not supply, failing silently.The change
Rendered through the shared
EntityFieldDescriptorinstead of a local spelling:That makes this the third call site on one renderer rather than a fourth hand-written one — the same convergence #1848 did for the two entity-block renderers.
EntityFieldDescriptor::from_schema_fieldbecomespubto allow it.Side benefit: the notation now matches the entity block the model already sees elsewhere in the same conversation, so one concept has one spelling.
Test
Asserts on the prompt text, not the tool's return value. The return value is well-formed whether or not the model guessed — that property is exactly what made this class of defect expensive to diagnose last time. Added a
CapturingEnginethat records the prompt it was handed.Verified by mutation, not by inspection. Against the old renderer:
With the fix, passes. The guard genuinely fails when the values go missing.
Eval: neutral, and currently unscoreable
c98169c5+ this changec98169c5unmodifiedIdentical failures scenario for scenario — this change is neutral on the matrix.
It cannot be scored today: scenario 6 (
"The 2400 one came back — set it to returned"), the exact case this addresses, fails in both arms because the model never callsresolve_queryat all. No call means the sub-prompt is never built, so the enum values never matter. The fix is verified at the prompt level instead, which is where the defect lives.Note on the 6/12 baseline
That number is below the 10/12 measured earlier today on
c5659f43, but this PR is not implicated — the unmodified arm scores identically. A separate regression investigation is being opened for it (see #1857 discussion); part of the earlier drop turned out to be a tightened eval fixture in #1859 rather than a behaviour change, which is being isolated properly there.Checks
nodespace-agent400 green ·nodespace-core1068 green · clippy clean · pre-push gate passed in full.🤖 Generated with Claude Code