Repository navigation
Description
Summary
Stage-2 routing withholds update_node on turns that need it, and the tool surface for the same scenario differs between reps of the same run. When the write tool is absent the model searches, finds the target, and then either says so honestly or — worse — reports success for a turn that changed nothing.
Found while evaluating candidate models for #2239. It is model-independent: reproduced on Gemma 4 E4B (native GGUF), Nemotron 3 Ultra 550B and Gemini 3 Flash (both served).
The model diagnoses it correctly itself
Nemotron 550B, scenario 6 ("The five-day one got signed off — mark it that way"):
"I don't have an
update_nodetool available — the current toolset only supports creating nodes and schemas, not modifying existing nodes. You'd need to either create a new write-up withsigned_off: trueor use the NodeSpace UI directly to update the existing one."
The recorded surface for that turn:
search_nodes, search_semantic, get_node, create_node, create_schema, update_schema
update_node is absent. The model was right, and it was right in a way no amount of prompt tuning would improve — it cannot call a tool it was not given.
The surface is not stable across reps
Same scenario (12d), same model (E4B), same run, different reps:
rep A: search_nodes, search_semantic, get_node, create_node, create_schema,
update_schema, delete_node <- no update_node
rep B: search_nodes, resolve_query, search_semantic, get_node, update_node,
update_task_status, delete_node, create_nodes_from_markdown, route_clarify
Rep B has update_node; rep A does not. Nothing about the scenario changed between them. Skill retrieval is embedding-based on the request text, so this is retrieval variance selecting different skills and therefore different tool_whitelists.
That variance is itself a finding: a scenario's winnability currently depends on which skills happen to be retrieved that run.
Second, worse symptom: a success report for a no-op turn
Two of the observed cases did not report the missing tool. They claimed success:
scenario 6 → "Done — node search completed successfully."
scenario 12d → "• node search completed"
Nothing was written. The user is told the work is done. ADR-056 already records a model "reporting a write that never happened" as a failure mode worth taking seriously, and this is a mechanism that produces it reliably: give the model a read tool and no write tool for a write request, and a plausible completion message is the likeliest output.
This is arguably the highest-severity item here. A silently-failed write in a knowledge-management product is worse than a visible error.
Frequency
Failures whose ONLY tool call was search_nodes, across the runs on disk:
| model | count |
|---|---|
| Gemini 3 Flash | 7 (rep 1 alone: scenarios 6, 9, 10b, 11c, 11c2, 12d, 13) |
| Nemotron Ultra 550B | 3 |
| Gemma 4 E4B | 2 |
Scenarios affected: 6, 9, 10b, 11c, 11c2, 12d, 13 — every one a read-then-write chain.
Relationship to #2240
Same class as the Node Deletion misrouting: Stage-2 scopes the tool surface from retrieved skills, and a retrieval miss removes a tool the turn needs. #2244 gated destructive tools behind a score bar; this is the mirror case — a needed write tool being absent, which no destructive-tool gate addresses.
Suggested direction
- Never scope away
update_nodeon a request classified as an update. The routing decision already exists; the tool surface should honour it. - Detect the contradiction and say so. If a turn's retrieved skills offer no write tool while the routing decision is an update/create, that is a routing failure — log it rather than letting the model discover it at generation time.
- Do not let a turn report success when it called only read tools on a write request. Cheap guard, directly targets the silent-no-op failure.
- Consider whether tool-surface stability should be a property: the same request should not get different tools on different runs.
Note on eval impact
The agent-matrix harness already excludes a scenario whose asserted tool was never offered (added on #2239's branch), so these turns are recorded rather than silently scored against the model. That prevents the eval from misattributing the failure — it does not fix the product behaviour, which is what this issue is for.
Activity
malibio commentedon Aug 23, 2026
Added context: provenance, mechanism, and reproduction
The original report described the symptom without pinning where it comes from or how to see it. Filling that in.
Provenance of the cited runs
nemotron-ultra-outcome0fe6ffeaopenai-compat:openrouter→nvidia/nemotron-3-ultra-550b-a55b:freee4b-outcome0fe6ffeagemma-4-e4b-q4km, native GGUF,n_ctx32768e30a6120openai-compat:gemini→gemini-3-flash-preview0fe6ffeaalready contains #2244 (b5c892b0, verified withgit merge-base --is-ancestor). So the destructive-tool gating was in force for these runs, and it does not cover this case — that claim in the original report is checked, not assumed.Mechanism
packages/agent/src/local_agent/routing.rs:555—stage2_permitted_names:So
update_nodeis offered only if some retrieved skill'stool_whitelistnames it. When retrieval surfaces only schema/creation skills, the union has no write-to-existing-node tool, and the model is left with reads pluscreate_node.That also explains the run-to-run instability: retrieval is embedding-based over the request text, so a different candidate set yields a different union. Same scenario, different reps, different tools.
Note the fail-open path (
fail_open_surface) hands back the full surface when retrieval matches nothing. The failure here is worse than fail-open: retrieval matched something, just not something that whitelists the needed tool. A partial match is treated as authoritative where no match is not.Reproduction
Scenario 6 of the agent matrix is the shortest path — prompt "The five-day one got signed off — mark it that way" against a chat where a write-up node with a day count already exists.
# From the repo root, with a daemon on the test socket and a model loaded: NS_BIN=target/release/nodespace \ NODESPACED_SOCKET=/tmp/nodespaced-test/daemon.sock \ NS_LOG=/tmp/nodespaced-test/daemon.log \ NS_MODEL=gemma-4-e4b-q4km \ bun run scripts/eval/agent-matrix.ts repro /tmp/repro.json --runs 3Then read
toolsOfferedper turn from the results file:--runs 3matters: the point is that the answer differs between reps, so a single run can miss it entirely.What the trace shows, verbatim
Nemotron 550B on scenario 6, offered
search_nodes, search_semantic, get_node, create_node, create_schema, update_schema:Same scenario, another rep, same missing tool — but reported as success:
Scope of the no-op-reported-as-success symptom
Worth separating from the routing bug, because it would survive a routing fix. Any turn that ends having called only read tools on a write request can produce a completion message. The routing miss is one way to get there; a model that simply stops early is another. A guard at the turn boundary (no write tool fired on a write-classified request → do not claim completion) addresses both.
malibio commentedon Aug 23, 2026
Full diagnosis: "Graph Editing" is never retrieved on the failing turns
Traced it to a single cause. Recording the evidence and the paths so this needs no re-run.
update_nodehas exactly one sourcepackages/agent/src/skill_pipeline.rs:318-325— "Graph Editing" is the only seeded skill whosetool_whitelistcontainsupdate_node:Since
stage2_permitted_names(routing.rs:555) offers the union of the retrieved candidates' whitelists,update_nodeis present only when Graph Editing is retrieved. Nothing else can contribute it.It is retrieved on none of the failing turns
Every turn on record where
update_nodewas absent, with its routing decision and retrieved skills:Graph Editing appears zero times. Node Deletion appears in 8 of 13 — the same over-retrieval that #2240 documented, still crowding the candidate set after #2244 (which gated when a destructive tool may be offered, not how often the skill is retrieved).
Also note
routingDecisionisquery,noneorclarifyon every row and neverupdate, even for prompts that are unambiguously updates:queryquery/noneSo there are two failures stacked: Stage-1 does not classify these as updates, and Stage-2 retrieval does not surface the one skill that would supply the write tool.
Why the description may be the problem
Graph Editing's description leads with "Modify existing nodes in the knowledge graph" — vocabulary a user never uses. The failing prompts say "mark it that way", "that one's signed off now", "set that task's due date". Meanwhile Node Deletion's "remove, delete, or trash a node or record" ends in a generic noun tail that matches anything node-shaped, which is the attractor behaviour #2240 already identified.
This is the wording-sensitivity class that has measured large before in this repo — rank-1 retrieval accuracy moved 35% → 75% on description rewording alone, with no model or pipeline change.
Artifacts
Results files (each carries per-turn
toolsOffered,routedSkills,routingDecision,stage2CandidatesInjected, and the full reply):Extract the correlation with:
Relevant source:
packages/agent/src/skill_pipeline.rs:318packages/agent/src/skill_pipeline.rs:345packages/agent/src/local_agent/routing.rs:555stage2_permitted_names— the union rulepackages/agent/src/local_agent/routing.rsfail_open_surface— full surface when retrieval matches nothingThe fail-open asymmetry is worth fixing on its own
When retrieval matches nothing, the model gets the full toolset. When retrieval matches something — but not the right thing — it gets a truncated surface and no recourse. A partial match is trusted more than no match, which is backwards: a partial match is exactly the case where retrieval is demonstrably unreliable.
malibio commentedon Aug 23, 2026
Baseline on worktree-issue-2254-stage2-write-tool-surface (from e30a612): Frontend 227 files / 4794 tests passed.
malibio commentedon Aug 23, 2026
Code-level findings before the repro
Reading the code ahead of reproducing. Three things change the shape of the fix; one corrects a claim in the report.
1. The
route_querydecision carries no write/read classificationSuggested direction 1 ("the routing decision already exists; the tool surface should honour it") has nothing to honour today.
RouteDecisionisQuery(String) | Clarify{..} | Multi(Vec<String>)— a search query, a clarification, or several queries. No arm records that the turn is an update. Same for direction 2: the contradiction it asks to detect ("retrieved skills offer no write tool while the routing decision is an update") is not currently derivable, because the second half of that conjunction does not exist.So both need a signal built first.
routing::skill_is_mutatingis the nearest existing thing — it derives blast radius from a candidate's whitelist through the registry's ownTool::is_write— but that describes the retrieved skill, not the user's intent, and on exactly the failing turn the mutating skill is the one that was not retrieved.2. The partial-match asymmetry is the sharpest statement of the routing bug
From the earlier comment, and confirmed at
routing.rs:596-609:stage2_toolscallsfail_open_surfaceonly whenpermitted.is_empty(). A weak partial match yields a non-emptypermitted, so fail-open never fires and the narrow surface is treated as authoritative. Zero retrieval matches is safer than one bad match. That is fixable without any new classification, which makes it the tractable half of directions 1-2.3. Direction 3 is narrower than it looks — three guards already exist and this case slips between all of them
agent_loop.rsalready stacks:!any_real_tool_calls&& action claimA
search_nodes-only turn defeats each one: a real call was made (guard 1 stands down), no write reported a field count sowrite_field_countsis empty andall_writes_were_emptyisfalse(guard 2 stands down by design — its comment says "read-only turns are unaffected"), and nothing errored (guard 3 stands down).Guard 2's exclusion is correct for a genuine read. The missing distinction is whether the user asked for a write — the same absent signal as items 1-2, localised to one boolean.
contains_action_claimis already per-sentence with negator/reporting qualifiers and is reusable as-is.Correction to the report's closing note
Accurate as written, but worth stating plainly:
requiredToolsandexcludedAsToolNotOfferedexist only on the unmerged #2239 branch.grep -rn requiredTools scripts/onmainreturns nothing, and the agent-matrix fixture does not implement the hook even on that branch. So onmaintoday there is no such exclusion, and the guard is additionally self-disabling whentoolsOfferedfails to parse (if (missingTools.length > 0 && offeredTools.length > 0)— an empty parse reads as "no data" and scores the turn normally).Related:
parseTurnOutput's?? ""makes "marker absent" and "no tools offered" the same value. That is what let a scrape targeting a log line which never existed (scoped tool list/selected_tools=) go unnoticed across every recorded run until #1843 fixed it.results-e4b.json(recorded 2026-07-30 at57bf1088, one day before that fix) hastoolsOffered: ""on all 12 scenarios and is therefore silent on tool availability — not evidence either way.Plan
Reproduce narrowly first: scenario 6,
--runs 3, isolatedNODESPACE_HOME, purged DB, daemon rebuilt from this commit,served_db_pathverified. The question the repro answers is whether Graph Editing narrowly misses the top-3 (retrieval tuning) or is absent (structural fix to howstage2_toolscomposes). Those are different changes and the code cannot distinguish them.The no-op guard will be implemented regardless — it is independent of routing and is the symptom that reaches users.
malibio commentedon Aug 23, 2026
The embedding queue is a second, larger source of the instability
Following the skill-index finding, I checked every semantic retrieval path the matrix scenarios depend on. There are two, and both are subject to the same ~30s debounce (
EmbeddingService::process_stale_embeddings,debounce_duration_secs, default 30).Measured against the database directly, not inferred from logs.
Path 1 — skill retrieval (Stage-2 tool surface)
Daemon ready
17:53:20.538; all 8 skill embeddings written17:53:50.615. 30.1s window during which skill retrieval returns nothing:stage2_toolsthen fails open to the full 13-tool surface with no skill guidance injected. Fixed by gating the eval on skill-index readiness.Path 2 — semantic SCHEMA retrieval (the EXISTING SCHEMAS block)
context_ops.rs:322retrieves schemas viasemantic_search_nodes_of_type(q, "schema", …). A schema the model creates in one turn is not retrievable until it is embedded, and the lag is the same 30s:feature write-up(schema)Offline sync feature write-up(instance)In the scenario chain S3 creates the schema and S4 creates an instance of it. In the run that PASSED, the ordering was:
A 1.4-second margin. The chain passed because inference happened to be slow enough. There is no fallback: when
retrieved_hitsis empty the EXISTING SCHEMAS block is simply omitted, so the model is effectively told the type does not exist — and then either invents anode_typeor re-callscreate_schema. That is exactly the observed cascade:Why this matters for this issue
Both paths produce the same observable signature this issue reports: identical input, different tool surface, different outcome, no code change between runs. Any scenario whose setup turn creates a type its later turns depend on is racing a 30-second timer, and the matrix runs turns back-to-back.
That does not retire the routing question —
update_nodeliving in exactly one skill's whitelist is real and independent. But it does mean an unknown fraction of the recorded rep-to-rep variance is this artifact, and the frequency table in the original report cannot be cleanly attributed until measured on a warm index. The two runs I have that were clean end-to-end both retrieved Graph Editing successfully on the write turn.Also worth recording: what gets embedded
Skills embed name + description only, one chunk each — not the guidance children. Confirmed by chunk spans vs content length (
Schema Creationcontent 15 chars, chunk 0–656, matching its long description;Relationship Management140, matching its short one). Same shape for tools. So skill retrieval matches against the description text alone, which is consistent with the earlier finding that rewording descriptions moved rank-1 accuracy substantially.The 18 unembedded
schemaroots are all core/built-in types, and are not a defect:schema_named_in_querymatches them lexically (mentions_phrase) and skips core schemas by design, while the EXISTING SCHEMAS listing comes fromget_all_schemas. Only the semantic path above is queue-dependent.Fix landed for path 1
awaitSkillIndexin the eval preflight — probes via--type skillsemantic search (a type-only enumeration returns all 8 the instant the daemon boots and would wave the broken state through), requires all 8, waits rather than fails because--between-runsre-creates the cold window before every rep.Path 2 is not yet addressed. It is a product-shaped question rather than a harness one: a write followed by a read of the same type within the debounce window is a real user-facing sequence, not only an eval artifact.
malibio commentedon Aug 23, 2026
Clean measurement: the variance is real, and its cause is Stage 1, not retrieval
With both cold-start artifacts removed (skill index warm, schema recoverable by name), I ran the write turn 6 times against one daemon, one warm index, one seeded schema, each rep in a fresh chat replaying the identical three-turn chain.
3 of 6 failed. The issue's core claim is confirmed — this is not a harness artifact.
update_nodeofferedupdate_node [fields=1]✅update_schema [ERROR]❌Perfectly bimodal. Controls:
schemacount stayed at 19 across all six reps (the model reused the type rather than creating duplicates, so the accumulation confound that invalidated an earlier attempt is absent), and every turn loggedcandidates=3— retrieval returned a full set every time.Retrieval is deterministic. Stage 1 is not.
The daemon's own
find_skillsline shows the write turn's query and score are byte-identical across reps of the same variant, to 16 decimal places:So the embedding step is not the variable. What varies is the query Stage 1 writes, and the two variants differ by exactly one word:
feature write-up **node** …feature write-up …The token "node" is worth ~0.13 of similarity, and that is enough to move
Graph Editinginto the top-3 ahead ofResearch & Search. Graph Editing's description opens "Modify existing nodes in the knowledge graph" — the word matches its description almost verbatim, which is exactly what an embedding-based match rewards.What this means for the suggested directions
The failure is not that retrieval is noisy or that scores are miscalibrated. It is that a needed capability's availability hangs on whether a small model happens to include one domain word in a free-text query it writes for itself. Stage 1 is asked to produce a retrieval query, and it is not told that the query's wording determines which tools it will subsequently be allowed to call.
That reframes the fix options:
RETRIEVAL_TOP_K = 3withupdate_nodein exactly one whitelist is the structural amplifier.Node Deletionwas in the top-3 on all 18 turns, including every failing one, contributing nothing while occupying a slot the turn needed. Gate destructive tools behind winning retrieval and a destructive score bar #2244 gated its tool out of the surface but not the candidate out of the window — a skill that contributes no tool to the final surface still displaces one that would have.update_nodereachable from more than one skill, or not letting a zero-contribution candidate consume a slot, both address this without any new classifier.Note on the score bars
Both variants clear
MUTATING_SKILL_SCORE_BAR(0.30) comfortably at 0.82/0.95, so the bars are not what is filtering here — the top-K window is. Raising or lowering the bars would not change this outcome.Stop the agent eval reporting harness, isolation, and transport fault…
malibio commentedon Aug 23, 2026
Fixed — 3/6 → 6/6 on the write turn, with the root cause corrected
Final measurement on the locked model (E4B native), warm skill index, schema and instance purged between reps so every rep asks the same question of the same workspace state:
6/6, against 3/6 measured on the same harness before these changes.
fields=1confirms the write persisted a property rather than being an id-only no-op.Caveat kept visible: n=6 on a suite this repo documents as having a wide variance band. Indicative, not decision-grade — but the failing shape was previously deterministic (
Schema Creation, Node Deletion, Research & Search→ no write tool at all), and it no longer occurs.The report's suggested directions, revisited against measurement
Direction 1 — "never scope away
update_nodeon a request classified as an update" was not implementable as written:RouteDecisionisQuery(String) | Clarify | Multi, so there is no update classification to honour. Nor was one needed. The real mechanism:Node Deletion's description named the operations it excluded — "not to record, update, mark, or look something up". That clause was added to stop over-retrieval and caused it, because embeddings have no notion of negation: a sentence listing "record, update, mark" lands NEARER those intents. The write turn is "The five-day one got signed off — mark it that way". This skill was in the top-3 on all 18 turns of a 6-rep run.get_node7,search_nodes/search_semantic6); every write exceptcreate_relationshipsat in one. WithRETRIEVAL_TOP_K = 3that makes availability a lottery.Both are seed-data defects, fixed without any new classifier. A test now pins each: no description may contain a negated capability clause, and no write tool may be single-sourced (four documented exceptions,
delete_nodeamong them sincestage2_permitted_namesadmits destructive tools only from the retrieval winner).Direction 3 — "do not let a turn report success when it called only read tools" turned out to be a narrower and more serious bug than described. Three guards already existed; all three are gated on
!normalized.is_empty(), so a turn where the model emits no text reaches a fallback that formatted the LAST execution's name into "Done — {} completed successfully." without consultingis_error:Both such fallbacks now delegate to
summarize_executions, which already existed and labels a failed call "failed". Verified live: the identical failing call now renders "• node creation failed".Two blockers found underneath, both fixed
Embedding debounce (~30s) made retrieval a race. Seeded skills are inserted synchronously but embedded on a debounce, so a daemon on a purged DB serves turns with an EMPTY skill index —
candidates=0, fail-open to 13 tools, no skill guidance. Timing read from the database: daemon ready 17:53:20.538, all 8 skill embeddings 17:53:50.615. The same applies to schemas the model itself creates: a schema created at 17:55:49.501 was not retrievable until 17:56:20.446, and in the run that PASSED the instance was created 1.4s after that. The chain succeeded on timing alone. Fixed with a preflight gate (eval side) and a lexical backstop for a schema named outright in the request (product side — "track my write-ups" then "add one" is an ordinary user sequence).create_schemasucceeded ~1 turn in 5, blocking the scenario entirely. Dumping the GBNF llama.cpp applies during sampling:Arguments are constrained to any well-formed JSON object.
required: ["name","fields"]appears nowhere. This is a documented upstream limitation — a llama.cpp collaborator states "Gemma 4 only forces the structure, not the arguments" becausejson-schema-to-grammar.cpp"only produces rules for JSON and not Gemma's fc notation" (discussion 21839). PR #23247 has been open and unreviewed since May, and its own reported blocker is enum constraints on required properties — exactlycreate_schema's shape. Two related issues are closed as not planned.So the constraint is applied at our boundary: an actionable error naming the missing top-level key, plus dropping field entries that carry no information at all. 1/5 → 5/6 turns.
Correction to an earlier comment in this thread
I reported the retry as "corrupting the JSON" with escaped quotes. That was wrong and the error was mine:
args_previewtruncates at exactly 300 characters, so I was reading a log cut off mid-string and diagnosing the cut as corruption. Raising the cap showed well-formed JSON throughout. #1876/#1926 are not implicated on this path.Also corrected earlier in the thread:
Node Deletionis never rank-1 — it sits at rank 2 or 3 — so a slot-eviction fix I had drafted was simulated against the real whitelists, shown to drop the wrong candidate on the failing shape, and abandoned before commit.Address code review: narrow the brace detector, dedupe the schema fetch
Correct an overstated blast-radius claim in the Node Creation seed co…
Stop a same-tool failure hiding behind an earlier success
Keep the reported field position matching what the caller sent
Give the paired write tools guidance, and check reachability from the…
Fetch the schema corpus only when a consumer needs it
Bound each skill-index probe, and report broken seeding instead of wa…
Address re-review: drop the own-line marker, close two test gaps