Repository navigation
Description
Overview
resolve_query now reaches the model's offered tool surface when its owning skill routes and clears the mutating-skill score bar (fixed in #1893). But even when correctly offered, the model does not reliably call it for an indirect-target update — it instead fabricates a plausible-looking node id and reports success without ever resolving or mutating anything.
Problem Statement
Reproduced live against a purged, isolated daemon running gemma-4-e4b-q4km, with resolve_query confirmed present in toolsOffered for the turn:
- Prompt: "The 2400 one came back — set it to returned" (an update keyed on a bare value — replacement cost — rather than a directly-named field, exactly the case
resolve_query's own tool description and the Graph Editing skill's INDIRECT TARGET guidance call out). toolsOfferedincludedresolve_query,update_node, and the rest of the Graph Editing whitelist.- The model made zero tool calls. Its raw output:
"I've updated the laser cutter checkout record (nodespace://6d515ce1-f61c-4558-9a30-3de6a81d20d8) to show that it has been returned."— a fabricated node id, noresolve_querycall, noupdate_nodecall, false claim of success.
This is a distinct failure mode from the tool-availability bug fixed in #1893: the tool is present in the schema the model is given, and the Graph Editing skill's guidance already explicitly instructs "If the request identifies the target indirectly... call resolve_query(...) FIRST" — the model has both the tool and the instruction, and still doesn't follow either.
Proposed Solution
Not yet diagnosed — needs its own investigation before a fix is chosen. Candidate angles, none confirmed:
- Whether the guidance text reaches the model with enough salience once combined with the rest of the resident system prompt and the turn's actual candidate block (cf. prior findings that a large resident prompt can score worse than a minimal one on cases targeting its own rules).
- Whether the specific phrasing "the 2400 one" is being (mis)matched against
search_nodes-style direct lookup patterns the model has seen more examples of, rather than being recognized as the "bare value, no field named" caseresolve_query's description defines. - Whether this is a general have-tool-will-still-hallucinate failure mode independent of
resolve_queryspecifically, worth checking against other multi-step tool sequences.
Acceptance Criteria
- Reproduce the failure with a raw-output trace captured (
RUST_LOG=debug) across multiple runs to establish it is not a one-off - Determine whether the model ever considers
resolve_queryat all (check raw generation text for any mention/near-miss, not just the final tool call) or skips straight to fabrication - Identify what, if anything, changes the model's behavior (prompt-only test, no code changes, iterating on guidance wording/placement)
- Land a guidance or prompting change, backed by a measurement showing improvement over the baseline established above
- Agent-matrix scenario 6 ("The 2400 one came back — set it to returned") passes across repeated runs, at an n large enough to clear the demonstrated run-to-run noise band for this fixture
Technical Specifications
Reference Files
- Graph Editing skill guidance:
packages/agent/src/skill_pipeline.rs—graph_editing_guidance(), theINDIRECT TARGETparagraph - resolve_query tool definition:
packages/agent/src/local_agent/tools.rs—def_resolve_query() - Agent-matrix scenario:
scripts/eval/fixtures/agent-matrix.ts— scenario id"6" - Live-eval setup:
nodespace-docs/development/agent-eval.md
Related Issues
- Fix find_skills reading skill node properties flat instead of hoisted properties.skill.* #1893 (fixed the tool-availability bug this issue's reproduction depended on)
Activity
malibio commentedon Aug 1, 2026
Baseline (worktree issue-1894-resolve-query-guidance): Frontend: 171 test files passed, 4108 tests passed, 0 failed (49.8s).
malibio commentedon Aug 1, 2026
Investigation findings: the premise doesn't hold, and the real blocker is structural
Investigated on a purged, isolated daemon (
NODESPACE_HOME,served_db_pathverified) at currentmain(09a54074), E4B,n_ctx=32768.1. The reproduction in this issue measured a pre-#1893 daemon
The three runs the issue is built on (
/tmp/nodespaced-test/results-run{1,2,3}.json) recordevalCommit: 4b66ec4f— dated 10:31, while the #1893 fix (69a4f902) landed at 19:36. The runs executed at 17:04–17:11, i.e. before the fix existed.Their scenario-6
toolsOfferedwas:That is
Tool::ALLminussearch_skillsminusresolve_query— the fail-open surface, not a scoped one, andtools_count=12on every turn of that log. So the issue's stated premise ("resolve_queryconfirmed present intoolsOffered", "the tool is present in the schema the model is given") is not what those runs actually measured.resolve_querywas never offered, andRELEVANT ENTITY TYPESrendered 0 times in the entire log.This is not a model-guidance failure. The model never had the tool.
2. At current main, #1893's fix works — the surface is now genuinely scoped
Fresh run at
09a54074shows per-turn scoping varying by routed skill (5/6/7/8 tools rather than a constant 12):Graph Editing routes correctly (
routing_decision=query, candidates injected,top_scorewell above bar) and its other whitelisted tools appear.resolve_querystill does not — for a different and legitimate reason.3. The actual blocker:
resolve_queryis gated on a block that needs a custom schema to existagent_loop.rs:739retainsresolve_queryonly iftools_with_available_guidancecontains it, which requires an eligible candidate whose ownschema_metadatarenders a non-emptyRELEVANT ENTITY TYPESblock (routing.rs:311-341). This gate is deliberate and well-documented:resolve_query'snode_typeis required and its description says to copy the id from that block, so offering it without the block strands the model.The seeded Graph Editing skill (verified in the live DB, correctly hoisted under
properties.skill) declares nonode_types:With no
node_types,skill_ops.rs:203falls back to "all non-core schemas". So:no custom schema in the workspace → empty
schema_metadata→ no entity-types block →resolve_querywithheld.In my run, scenario 3 failed to create any schema (it called
create_node;create_schemawasn't even offered that turn — routing sent it to Node Creation). Semantic schema retrieval loggedcount=0on all 12 turns. Scenario 6 was therefore unwinnable by construction — exactly the hazard the fixture's own comment atagent-matrix.ts:277-287warns about, arriving via a path that comment doesn't cover.4. What the raw traces show about the model
Worth recording, since AC #2 asks. Across the pre-#1893 runs the model never mentions
resolve_query— it fabricates an id and claims success, or asks for one:At current main, same shape:
The model correctly identifies that it needs a resolved id — the exact gap
resolve_queryfills — and asks the user instead, because the tool isn't on its surface. That's reasonable behavior given its inputs, not a guidance-adherence failure. Guidance wording cannot be evaluated until the tool is actually offered.Proposed re-scope
The remaining acceptance criteria (iterate on guidance wording, measure improvement) are not yet testable — they presuppose an offered tool. I'd restructure as:
replacement_cost, a field of a custom type, so a correct run should have a schema by then. But a bare-value update against core types (task,text) can never satisfy this gate, soresolve_queryis structurally unreachable for them. Options: give Graph Editing an explicitnode_types; render the block from workspace schemas rather than per-candidate; or accept core types are out of scope forresolve_queryand say so in its description.create_nodeis a separate defect worth its own issue.Recommendation: proceed with (1), taking the explicit
node_typesroute on Graph Editing as the smallest change that makes the tool reachable, plus a regression test assertingresolve_queryis offered when a custom schema exists. Proceeding unless redirected.Note on measurement conditions
A second full run was aborted as invalid: every turn failed with
Decode Error -3(routing_decision="failed"×6) — two E4B instances contending on a 16 GB machine, as another eval session was running concurrently. Single-run matrix numbers are not decision-grade here; the tool-surface finding above is drawn fromtoolsOffered/log evidence, which is deterministic and unaffected by that noise.malibio commentedon Aug 2, 2026
Same pattern as #1899, twice in a row now: caught the issue's own premise didn't hold before building on it, this time via commit-timestamp vs. run-timestamp comparison (the reproduction predates #1893 by two hours) rather than taking the log's self-description at face value. Good discipline, worth keeping up as standard practice on every issue in this cluster from here — check the evidence a filing rests on before treating it as ground truth.
The structural finding at current main is the real content here, and the chain is concrete and checkable end to end (agent_loop.rs:739 → routing.rs:311-341 → Graph Editing's empty node_types → fallback to all-non-core-schemas → zero custom schemas → empty block → tool withheld). Agreed this makes the remaining acceptance criteria untestable as written — no point iterating on guidance wording for a tool that isn't on the model's surface, and the model's actual behavior (asking for an id instead of fabricating one) confirms it's behaving reasonably given what it was offered, not failing to follow instructions.
One pushback on the proposed fix before you build it: of the three gating options, I'd want more reasoning for picking explicit
node_typeson Graph Editing over rendering the block from workspace schemas broadly. A hardcoded (or even seeded-but-fixed)node_typeslist on a skill whose whole purpose is mutating arbitrary existing nodes/relationships risks becoming the same "doesn't scale with the registry" anti-pattern #1802 flags for resident prose — just as a maintained list instead of a maintained sentence, and one more thing to keep in sync as schemas are added. Rendering from workspace schemas generally (option 2) seems more consistent with ADR-038's "retrieval, not enumeration" position, even if it's a larger change. If there's a reason option 1 is actually the structurally correct answer and not just the smallest diff — e.g. a real cost/scoping concern with option 2 — lay that out, but "smallest change" alone isn't sufficient justification given what #1802 is about to spend a full pass scrutinizing exactly this kind of layering decision.Agreed on deferring measurement until the gate is fixed, and on filing the fixture's unwinnability (scenario 6 scoring as a resolve_query failure when the real fault is further upstream) as its own separate concern.
malibio commentedon Aug 2, 2026
Re: gating options — you're right, and option 1 is worse than I represented
I went looking for the cost/scoping justification for option 1 and found the opposite: option 2 is not the larger change, and option 1 is a clearer instance of the anti-pattern #1802 targets than I gave it credit for. Withdrawing the recommendation.
The machinery option 2 needs already exists and is already retrieval-based
build_workspace_context(context_ops.rs:280) already renders aRELEVANT ENTITY TYPESblock from schemas retrieved semantically against the turn's query —semantic_search_nodes_of_type(q, "schema", MAX_SEMANTIC_SCHEMAS=5, SCHEMA_SIMILARITY_THRESHOLD=0.2), blending the lastBLENDED_HISTORY_TURNS=2messages. It's resident, it's per-turn, and it scales with the registry by construction — no maintained list.Both sites already share one renderer (
entity_types_block) and one heading constant (RELEVANT_ENTITY_TYPES_HEADER), and the doc comment atcontext_ops.rs:100-108says why: the heading is rendered at exactly these two call sites, and a previous fix that touched only one left the other reinforcing the contamination the first was changed to prevent.So the layering today is: two independent injection sites for the same block, from two different retrieval paths, and
resolve_query's gate consults only one of them — the per-candidateschema_metadatapath, not the workspace-context path. That asymmetry is the actual defect.tools_with_available_guidanceasks "did this candidate carry entity types?" when the question the tool's requirednode_typeparameter actually needs answered is "will the assembled prompt contain an entity-types block?"Why that reframes option 1 as the anti-pattern
Your read is right, and it's sharper than "a list to keep in sync". Graph Editing's purpose is mutating arbitrary existing nodes; any fixed
node_typeson it is a claim about which types the user might edit, which is unknowable at seed time and wrong the moment someone adds a schema. It would also narrow today's behavior:scoped_type_idsnon-empty switchesskill_ops.rs:203from "all non-core schemas" to "exactly these", so I'd be trading an empty block for a wrong-but-non-empty one — passing the gate while handing the model a type list that may not contain the type it needs. That's worse than the current failure, which at least fails visibly.It also wouldn't fix the core-type case at all (
task/textareis_core, filtered out atskill_ops.rs:206regardless), so option 1 buys a green scenario 6 and leaves the structural hole.Revised recommendation
Make the gate depend on what the assembled prompt will actually contain, rather than on one of the two paths that can fill it. Concretely:
resolve_queryis offered when an entity-types block will render for the turn from either source — the candidate'sschema_metadataor workspace context's semantically-retrieved schemas.That keeps the gate's original purpose intact (never offer a tool whose required parameter points at a block the model can't see — the reason it exists per
tools.rs:1115-1124), removes the per-candidate coupling, and inherits registry-scaling from retrieval rather than from a maintained list. It's consistent with ADR-038's retrieval-not-enumeration position, and it composes with the follow-up already noted atcontext_ops.rs:112-117— making context assembly depend on the routing decision, which today runs after the context block is built.Two things I want to verify before building it, since both are load-bearing and neither is settled by reading:
context_ops.rs:112-117says context assembly happens before Stage-2 routing. If so, the workspace block's content is knowable at the retain inagent_loop.rs:739— but I want to confirm that against the actual call order rather than infer it from a doc comment, since that comment is describing a limitation, not a guarantee.parse_and_filter_non_core_schemas(context_ops.rs) andskill_ops.rs:206both dropis_coreschemas, so a bare-value update againsttask/textstill renders no block and still withholdsresolve_query— regardless of which option we pick. That's a genuine scope question about the tool, not a bug to fix incidentally: eitherresolve_queryis custom-types-only and its description should say so, or the block needs to carry core types too. My read is the former is correct for now (its examples are all custom-type: invoices, amounts, codes), but it should be stated rather than left implicit.Given #1802 is about to scrutinize exactly this layering, I'd rather land the narrow gate fix here — with the core-type scope written down explicitly — than pre-empt the spike with a broader restructuring of how entity types reach the prompt. If you'd rather I hold the gate fix entirely and fold it into #1802's pass, say so; it's a small enough change that either sequencing works.
malibio commentedon Aug 2, 2026
This is a sharper diagnosis than my objection deserved — the two-independent-injection-sites finding reframes this correctly: the gate is asking "did this candidate contribute the block" when it should ask "will the assembled prompt contain the block." And the concrete failure-mode comparison (option 1 trades a loud empty-block failure for a silent wrong-type-list pass) is exactly the kind of thing that's easy to miss chasing a single green scenario — good catch.
Agreed on all three points: revised gate (offered when either source will render the block), verify the ordering claim against actual call order rather than the doc comment describing a known limitation, and write down the core-type scope boundary explicitly rather than leave it implicit.
On sequencing: land the narrow gate fix now, don't hold for #1802. It's small, correctly scoped, fixes a real reachability bug, and documenting the core-type boundary explicitly is exactly the kind of thing #1802 will want as settled ground truth rather than another open question to resolve from scratch. The two-injection-site asymmetry you found is real and worth flagging for #1802's broader pass regardless — but this fix doesn't foreclose that review, it just stops the immediate bug from sitting open while a much larger architectural question gets answered on its own timeline. Proceed.
Offer resolve_query when either site renders the entity-types block (#…