Skip to content

Stage-2 withholds update_node on read-then-write turns, and the model reports success for the no-op #2254

Closed

Description

@malibio

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_node tool available — the current toolset only supports creating nodes and schemas, not modifying existing nodes. You'd need to either create a new write-up with signed_off: true or 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

  1. Never scope away update_node on a request classified as an update. The routing decision already exists; the tool surface should honour it.
  2. 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.
  3. 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.
  4. 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

  1. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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

    run commit dirty model
    nemotron-ultra-outcome 0fe6ffea true (eval-harness changes only) openai-compat:openrouter → nvidia/nemotron-3-ultra-550b-a55b:free
    e4b-outcome 0fe6ffea false gemma-4-e4b-q4km, native GGUF, n_ctx 32768
    Gemini rep 1 post-e30a6120 — openai-compat:gemini → gemini-3-flash-preview

    0fe6ffea already contains #2244 (b5c892b0, verified with git 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:

    "The tools Stage 2 may offer, restricted to what the eligible candidates' whitelists permit: the union of them for ordinary tools, and — for tools that irreversibly remove user data — only the whitelist of the candidate that actually won retrieval."

    So update_node is offered only if some retrieved skill's tool_whitelist names it. When retrieval surfaces only schema/creation skills, the union has no write-to-existing-node tool, and the model is left with reads plus create_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 3

    Then read toolsOffered per turn from the results file:

    python3 -c "
    import json
    d=json.load(open('/tmp/repro.json'))
    def walk(o):
        if isinstance(o,dict):
            if 'turns' in o and 'id' in o: yield o
            for v in o.values(): yield from walk(v)
        elif isinstance(o,list):
            for v in o: yield from walk(v)
    for r in walk(d):
        for t in r.get('turns',[]):
            off=t.get('toolsOffered') or ''
            print(r['id'], 'update_node offered:', 'update_node' in off)
    "

    --runs 3 matters: 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:

    "I don't have an update_node tool available — the current toolset only supports creating nodes and schemas, not modifying existing nodes."

    Same scenario, another rep, same missing tool — but reported as success:

    "Done — node search completed successfully."

    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.

  2. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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_node has exactly one source

    packages/agent/src/skill_pipeline.rs:318-325 — "Graph Editing" is the only seeded skill whose tool_whitelist contains update_node:

    title: "Graph Editing",
    description: "Modify existing nodes in the knowledge graph - update content,
                  properties, titles, and metadata. For tasks, use
                  update_task_status to change status.",
    tool_whitelist: ["update_node", "update_task_status", "get_node",
                     "search_nodes", "search_semantic", "resolve_query",
                     "route_clarify"],

    Since stage2_permitted_names (routing.rs:555) offers the union of the retrieved candidates' whitelists, update_node is 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_node was absent, with its routing decision and retrieved skills:

    model           scen  routing   retrieved skills
    nemotron-ultra  4     query     Schema Creation, Node Creation, Organization
    nemotron-ultra  5     query     Node Creation, Schema Creation, Research & Search
    nemotron-ultra  6     query     Schema Creation, Node Deletion, Node Creation
    nemotron-ultra  9     none      Schema Creation, Node Deletion, Node Creation
    nemotron-ultra  8c    none      Node Deletion, Schema Creation, Node Creation
    nemotron-ultra  11c2  none      Organization, Node Creation, Schema Creation
    nemotron-ultra  11d   query     Node Deletion, Organization, Relationship Management
    nemotron-ultra  12d   none      Relationship Management, Organization, Node Deletion
    e4b             4     query     Schema Creation, Node Creation, Node Deletion
    e4b             6     query     Schema Creation, Node Deletion, Node Creation
    e4b             8d    query     Schema Creation, Research & Search, Bulk Import
    e4b             12d   clarify   (none)
    e4b             12d   query     Node Deletion, Schema Creation, Node Creation
    

    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 routingDecision is query, none or clarify on every row and never update, even for prompts that are unambiguously updates:

    • scenario 6: "The five-day one got signed off — mark it that way" → query
    • scenario 12d: "Whichever is the biggest job — that one's signed off now" → query / none

    So 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):

    ~/nodespace/issue-2239-model-eval/nemotron-ultra-outcome.json    215 KB  (3 reps, 550B)
    ~/nodespace/issue-2239-model-eval/e4b-outcome.json               219 KB  (3 reps, E4B native)
    ~/nodespace/issue-2239-model-eval/*.trace.jsonl                          (raw generations)
    

    Extract the correlation with:

    python3 -c "
    import json,glob
    for f in glob.glob('$HOME/nodespace/issue-2239-model-eval/*outcome.json'):
        d=json.load(open(f))
        def walk(o):
            if isinstance(o,dict):
                if 'turns' in o and 'id' in o: yield o
                for v in o.values(): yield from walk(v)
            elif isinstance(o,list):
                for v in o: yield from walk(v)
        for r in walk(d):
            for t in r.get('turns',[]):
                off = t.get('toolsOffered') or ''
                if 'update_node' not in off:
                    print(r['id'], t.get('routingDecision'), '|', t.get('routedSkills'))
    "

    Relevant source:

    path what
    packages/agent/src/skill_pipeline.rs:318 Graph Editing skill + its whitelist
    packages/agent/src/skill_pipeline.rs:345 Node Deletion skill (the over-retrieved one)
    packages/agent/src/local_agent/routing.rs:555 stage2_permitted_names — the union rule
    packages/agent/src/local_agent/routing.rs fail_open_surface — full surface when retrieval matches nothing

    The 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.

  3. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    Baseline on worktree-issue-2254-stage2-write-tool-surface (from e30a612): Frontend 227 files / 4794 tests passed.

  4. self-assigned this
    on Aug 23, 2026
  5. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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_query decision carries no write/read classification

    Suggested direction 1 ("the routing decision already exists; the tool surface should honour it") has nothing to honour today. RouteDecision is Query(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_mutating is the nearest existing thing — it derives blast radius from a candidate's whitelist through the registry's own Tool::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_tools calls fail_open_surface only when permitted.is_empty(). A weak partial match yields a non-empty permitted, 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.rs already stacks:

    guard fires when line
    Anti-fabrication !any_real_tool_calls && action claim ~1704
    No-op success every write persisted 0 fields && action claim ~1762
    Tool-failure surfacing a tool errored, unacknowledged, no later retry ~1790

    A search_nodes-only turn defeats each one: a real call was made (guard 1 stands down), no write reported a field count so write_field_counts is empty and all_writes_were_empty is false (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_claim is already per-sentence with negator/reporting qualifiers and is reusable as-is.

    Correction to the report's closing note

    "The agent-matrix harness already excludes a scenario whose asserted tool was never offered (added on #2239's branch)"

    Accurate as written, but worth stating plainly: requiredTools and excludedAsToolNotOffered exist only on the unmerged #2239 branch. grep -rn requiredTools scripts/ on main returns nothing, and the agent-matrix fixture does not implement the hook even on that branch. So on main today there is no such exclusion, and the guard is additionally self-disabling when toolsOffered fails 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 at 57bf1088, one day before that fix) has toolsOffered: "" on all 12 scenarios and is therefore silent on tool availability — not evidence either way.

    Plan

    Reproduce narrowly first: scenario 6, --runs 3, isolated NODESPACE_HOME, purged DB, daemon rebuilt from this commit, served_db_path verified. The question the repro answers is whether Graph Editing narrowly misses the top-3 (retrieval tuning) or is absent (structural fix to how stage2_tools composes). 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.

  6. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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 written 17:53:50.615. 30.1s window during which skill retrieval returns nothing:

    two-stage routing overhead routing_decision="query" candidates=0 routed_skills=
    

    stage2_tools then 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:322 retrieves schemas via semantic_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:

    node created embedded lag
    feature write-up (schema) 17:55:49.501 17:56:20.446 30.9s
    Offline sync feature write-up (instance) 17:56:21.887 17:56:51.925 30.0s

    In the scenario chain S3 creates the schema and S4 creates an instance of it. In the run that PASSED, the ordering was:

    schema created   17:55:49.501
    schema embedded  17:56:20.446
    instance created 17:56:21.887   <- 1.4s after the embedding landed
    

    A 1.4-second margin. The chain passed because inference happened to be slow enough. There is no fallback: when retrieved_hits is empty the EXISTING SCHEMAS block is simply omitted, so the model is effectively told the type does not exist — and then either invents a node_type or re-calls create_schema. That is exactly the observed cascade:

    [tool] create_node [ERROR]  Unknown node_type 'feature_writeups'
    

    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_node living 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 Creation content 15 chars, chunk 0–656, matching its long description; Relationship Management 140, 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 schema roots are all core/built-in types, and are not a defect: schema_named_in_query matches them lexically (mentions_phrase) and skips core schemas by design, while the EXISTING SCHEMAS listing comes from get_all_schemas. Only the semantic path above is queue-dependent.

    Fix landed for path 1

    awaitSkillIndex in the eval preflight — probes via --type skill semantic 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-runs re-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.

  7. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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.

    skills retrieved on the write turn update_node offered result reps
    Node Creation, Node Deletion, Graph Editing yes update_node [fields=1] ✅ 2, 3, 4
    Schema Creation, Node Deletion, Research & Search no update_schema [ERROR] ❌ 1, 5, 6

    Perfectly bimodal. Controls: schema count 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 logged candidates=3 — retrieval returned a full set every time.

    Retrieval is deterministic. Stage 1 is not.

    The daemon's own find_skills line shows the write turn's query and score are byte-identical across reps of the same variant, to 16 decimal places:

    query=feature write-up with title 'Offline sync feature write-up' set status to signed off
    top_score=0.8230576664209366     <- identical in reps 1, 5, 6
    

    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:

    FAIL: feature write-up      with title '...' set status to signed off   score 0.8230
    PASS: feature write-up node with title '...' set status to signed off   score 0.9537
    
    query variant top_score occurrences
    feature write-up **node** … 0.9537 4
    feature write-up … 0.8230 3

    The token "node" is worth ~0.13 of similarity, and that is enough to move Graph Editing into the top-3 ahead of Research & 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:

    • Direction 1/2 (honour an update classification) still need a signal that does not exist — but the diagnosis is now sharper: the missing signal is not "is this an update", it is that Stage 1 is writing a query without knowing what the query is for.
    • RETRIEVAL_TOP_K = 3 with update_node in exactly one whitelist is the structural amplifier. Node Deletion was 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.
    • Making update_node reachable 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.

  8. malibio commented on Aug 23, 2026

    @malibio
    CollaboratorAuthor

    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:

    rep1 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    rep2 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    rep3 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    rep4 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    rep5 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    rep6 update_node=YES setup(schemas=1,instances=1) called=[update_node [fields=1]]
    

    6/6, against 3/6 measured on the same harness before these changes. fields=1 confirms 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_node on a request classified as an update" was not implementable as written: RouteDecision is Query(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.
    • Every write tool was reachable from exactly one skill. Read tools sat in six or seven (get_node 7, search_nodes/search_semantic 6); every write except create_relationship sat in one. With RETRIEVAL_TOP_K = 3 that 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_node among them since stage2_permitted_names admits 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 consulting is_error:

    [tool] create_node [ERROR]      (Unknown node_type)
    assistant> Done — node creation completed successfully.
    

    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_schema succeeded ~1 turn in 5, blocking the scenario entirely. Dumping the GBNF llama.cpp applies during sampling:

    tool-create-schema ::= ("create_schema") gemma4-dict
    gemma4-dict        ::= "{" space ("}" | gemma4-dict-kv ("," space gemma4-dict-kv)* space "}")
    

    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" because json-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 — exactly create_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_preview truncates 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 Deletion is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions