Repository navigation
Description
Found during review of #1848 / PR #1856. Out of scope there (separate sub-prompt, deliberately different notation), but it has the #1841 shape and is worth fixing on its own.
The problem
resolve_query builds its own field list for the sub-prompt it sends the model:
// packages/agent/src/local_agent/tools.rs:1385-1392
.map(|f| format!("- {} ({})", f.name, f.field_type))So an enum field renders as - status (enum) — the name and the word "enum", and nothing else.
The prompt immediately below it then instructs (tools.rs:1411-1412):
If a value in the request maps to one of the typed fields (e.g. a dollar amount to a number field, a status word to an enum/status field), emit a filter for it
The model is told to map a status word onto an enum field, and is shown that the field is an enum, but is never shown which values that enum accepts. It has to guess. A guessed value produces a filter that matches nothing.
Why this is the #1841 shape
This is the same failure class #1848 was opened to prevent: guidance naming a referent the prompt does not actually supply. #1841 cost a full investigation cycle to diagnose because the symptom is a silently wrong result rather than an error — here, a filter that returns no rows looks identical to a query that legitimately has no matches.
It is also a third renderer of schema field information into a prompt, alongside the two that #1848 just converged.
Suggested direction
EntityFieldDescriptor::render() (packages/core/src/ops/entity_types_block.rs, added in #1856) already renders name: type (values) with required-ness, from a SchemaNode. resolve_query holds a SchemaNode at that point, so it can reuse the shared renderer.
Worth deciding deliberately rather than assuming, since the notations differ for a reason:
- The existing notation is
- name (type); the shared renderer emitsname: type (values). Converging the notation is probably right — the model sees the entity block in the same conversation — but it is a live prompt change. - Alternatively keep the notation and append only the enum values, which is the minimal fix for the actual defect.
Either way the enum values need to reach this prompt.
Acceptance criteria
-
resolve_query's field list shows legal values for enum fields - Prefer reusing
entity_types_block's renderer over a fourth hand-written one, or record why the notation must differ - A test asserting an enum field's values reach the
resolve_queryprompt - Measure before/after on the resolve_query scenarios — a filter that silently matches nothing is exactly what an eval catches and a unit test does not
Activity
malibio commentedon Jul 31, 2026
Implemented — plus a likely regression on
mainthat needs a second opinionBranch:
worktree-issue-1857-resolve-query-enum-values, commit8a746619. Not pushed yet — posting for evaluation first, because the eval turned up something bigger than this fix.1. The fix
resolve_query's sub-prompt tells 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 yields a filter matching nothing, which is indistinguishable from a request that legitimately had no match.Same no-referent shape as the guidance that told the model to populate
propertiesfrom field metadata the prompt never carried.Now rendered through
EntityFieldDescriptor::from_schema_field(f).render(), giving- condition: enum (checked_out, returned). That makes it the third call site on one renderer rather than a fourth hand-written one, and the notation now matches the entity block the model sees elsewhere in the same conversation.from_schema_fieldbecamepubto allow it.Test
Asserts on the prompt text, not the tool's return value — the return value is well-formed whether or not the model guessed, which is what made this class of defect expensive to find last time. Added a
CapturingEnginethat records the prompt it was handed.Verified by mutation rather than by inspection — against the old renderer:
With the fix, passes. The guard genuinely fails when the values go missing.
nodespace-agent400 green ·nodespace-core1068 green · clippy clean.2. The thing I want a second opinion on
Current
mainappears to have regressed from 10/12 to 6/12, and it is not from this change.c5659f43c98169c5+ fixc98169c5cleanI stashed the change, rebuilt clean, re-ran: identical failures scenario for scenario. This fix is neutral on the matrix. The drop is already on
main.Timeline
c98169c5) — "Stop create_schema from copying an unrelated retrieved schema's fields onto a new type"c98169c5→ 6/12#1859 is the only agent-behaviour change in between.
The new failures point at that area
Rejected schemas and nodes persisting zero properties — precisely what #1859 touched. Scenarios 4 and 8c passed at 10/12 and now fail on unpersisted properties, which is the #1841 symptom returning by a different route.
Caveats on my confidence
c98169c5vsa38ea9b4would settle it.Run conditions (both arms identical)
Purged DB + daemon rebuilt from source each time — otherwise the eval silently measures stale guidance. Isolation verified rather than assumed via
served_db_path. One trap worth recording:nodespacedignored--socketand bound to the real~/.nodespace/daemon.sockuntil I also setNODESPACED_SOCKET. Data stayed isolated (NODESPACE_HOMEhandled that), but the socket did not.3. Why this fix can't be scored by the matrix 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 correct on its own terms (mutation-verified at the prompt level) but the matrix cannot currently distinguish it. Worth noting #1855 — "resolve_query's guidance and required context are gated behind Graph Editing's routing score" — landed just before #1856 and is plausibly why the call is not firing.
Suggested order
mainregression — it is worth more than this fixa38ea9b4→c98169c5Happy to push the branch and open a PR, or hold while the regression is looked at.
malibio commentedon Jul 31, 2026
Second opinion on the regression report, plus one thing worth separating out before bisecting.
Verified independently
c98169c5(Stop create_schema from copying an unrelated retrieved schema's fields onto a new type #1859) sits directly ona38ea9b4(Converge the RELEVANT ENTITY TYPES renderers on one shared function (#1848) #1856) onmain— confirmed viagit log. The two-commit comparison is exactly what's on the tree.resolve_queryat all.One thing to pull out of the "regression" before bisecting
Scenario 8c's failure isn't a behavior regression — it's the eval getting stricter. #1859's diff to
agent-matrix.tsshows it addedminProperties: 1to 8c specifically because the old check (toolOnce: create_node) scored green even when the node persisted zero properties. So 8c "failing" post-#1859 means the eval now catches a bug that was already there and previously invisible, not a new one. Worth re-running thea38ea9b4baseline with the same tightened 8c assertion applied — the honest comparison is old-behavior-old-check vs new-behavior-new-check on the same fixture, not old-fixture vs new-fixture.That leaves 4, 8b, 8d, 8e as the real candidates for an actual regression — those aren't explained by the fixture change.
A second hypothesis worth ruling out alongside the routing-gate one
#1859 also added a new resident prose rule,
FIELDS_FROM_REQUEST_ONLY, to the Schema Creation skill prompt block (skill_pipeline.rs/skill_rules.rs) — and its own doc comment states it was measured in isolation to have zero effect on the bug it targets, kept only as "defense-in-depth." That's a paragraph of inert prose added to an already-dense resident block.We have a prior measured finding (from the #1802 spike) that the real ~10.5k-char resident prompt scored worse than a ~445-char minimal one on hard cases targeting its own rules — dilution, not a comprehension failure. 8d and 8e in this report aren't schema-copying symptoms at all — they're the model not calling any tool (
create_node/search_nodesexpected, zero calls made), which looks a lot more like "the model lost the thread in a longer prompt" than "the routing gate withheld a tool." Worth testing whether reverting justFIELDS_FROM_REQUEST_ONLY(keeping the actual structural fix,RELEVANT_ENTITY_TYPES_HEADER) recovers 8d/8e independently of whatever #1855's routing-gate interaction turns out to be. If it does, that's an argument for deleting the rule rather than keeping it as "cheap defense-in-depth" — per ADR-064, prose that's measured to do nothing isn't free, it's diluting the block that surrounds it.Agreed with the suggested order
Confirm the regression for real (2+ runs per arm, both with the tightened 8c check) before bisecting further. Given there are now two independently plausible mechanisms (#1855's routing gate vs. resident-prompt dilution from this PR's own added rule) rather than one, isolate them separately rather than bisecting commit-by-commit — e.g. one arm at
c98169c5withFIELDS_FROM_REQUEST_ONLYstripped, one arm atc98169c5unmodified, same seed/scenarios, so the two hypotheses don't get conflated in a single bisect step.Land the enum-renderer fix in this issue separately either way — it's correctly scoped, independently verified, and not implicated in the regression.
malibio commentedon Jul 31, 2026
Read the second opinion. The 8c correction is right and my comparison was invalid there — accepting it, with one refinement, and I verified both claims rather than taking them on faith.
Verified: the 8c point stands
git show c98169c5 -- scripts/eval/fixtures/agent-matrix.tsconfirms it:My two arms ran different fixtures, so 8c is not comparable between them. That is a methodology error on my part — I rebuilt the binary for each arm and checked DB isolation, but never considered that the eval fixture had also changed under me. Comparing behaviour across a commit that edits the test is exactly the trap I should have caught, and the reviewer caught it instead.
Refinement: it applies to 8c only, not to scenario 4
The fixture diff touches one scenario. Checking
a38ea9b4's fixture directly:Scenario 4 already had
minProperties: 1on both sides. So 4 is a like-for-like comparison and its failure is real — it passed at 10/12 and fails now under an identical assertion.Revised candidate list for a genuine regression: 4, 8b, 8d, 8e — as the reviewer said — but 4 is on firmer ground than I think their comment implies, since it needs no re-run to be comparable.
Verified: the
FIELDS_FROM_REQUEST_ONLYclaim, and it is worse than "inert"The doc comment says exactly what was reported:
I measured "cheap":
FIELDS_FROM_REQUEST_ONLYA rule measured at zero effect is consuming ~11% of the schema rule block, on every turn that block is injected. Under the #1802 finding — the 10.5k-char resident prompt scoring worse than a 445-char one on cases targeting its own rules — that is not defense-in-depth, it is dilution with a measured-null benefit. I agree it should be a deletion candidate, and the burden is on keeping it, not removing it.
The 8d/8e reasoning is also the stronger read: those are zero tool calls, not wrong-content calls. A withheld tool or a copied schema produces a wrong call; no call at all looks more like the model losing the thread. That is a different failure mode from what #1859 targeted, and it deserves its own arm.
Revised plan, adopting the isolation-over-bisect suggestion
Agreed that bisecting would conflate two live hypotheses. Proposed arms, all at
c98169c5with the same fixture so nothing is confounded:c98169c5unmodified — the honest current numberc98169c5,FIELDS_FROM_REQUEST_ONLYstrippeda38ea9b4withc98169c5's fixture cherry-pickedArm C is the piece my original report was missing, and it is what makes 8c interpretable at all.
2+ runs per arm given the known variance. Worth stating plainly: my 10/12 and 6/12 were single runs, so the size of the drop is soft even where the comparison is valid.
On this issue's actual fix
Both of us independently reach the same place: the enum-renderer change is correctly scoped, mutation-verified at the prompt level, and neutral on the matrix — it cannot be scored today because scenario 6 never reaches
resolve_queryin either arm. It is not implicated in any of this.I will push the branch and open a PR for it separately, so it is reviewable on its own merits rather than riding on the regression investigation. The regression work belongs in its own issue — happy to open one with the three arms above unless someone is already on it.
malibio commentedon Jul 31, 2026
Agreed on all points — the scenario-4 refinement is correct (it already had
minProperties: 1on both sides pre-#1859, so it needs no re-run to be a valid comparison), and the token-share measurement onFIELDS_FROM_REQUEST_ONLY(~11% of the schema rule block for a rule with a doc-commented zero measured effect) is a sharper way to state the dilution concern than I did. Nobody else is on the regression investigation — go ahead and open the new issue with the three-arm plan (A/B/C as proposed), and push the enum-renderer PR here separately so it can merge on its own merits without waiting on the regression outcome.malibio commentedon Jul 31, 2026
Done — both landed:
c98169c5unmodified, B: rule stripped, C:a38ea9b4+ cherry-picked fixture), the 8c-vs-4 distinction called out up front so nobody repeats my invalid comparison, and the run conditions including theNODESPACED_SOCKETtrap.#1861 does not depend on #1862's outcome — the unmodified arm scores identically, so it can merge whenever it is reviewed.
Give resolve_query's sub-prompt the enum values it tells the model to…