Repository navigation
Description
Overview
A create_schema call returned is_error=false with result_field_count=2 and a fully-populated result payload, and the schema was never persisted. The agent then told the user the type had been created. Observed on a clean database with the locked native model (gemma-4-e4b-q4km).
This is the silent-degradation-plus-fabricated-completion class ADR-056 records as still open for Scenario 6 — "the miss degrades silently to an empty result reported as success" — but on the write path rather than the resolution path, and with the tool layer (not the model) producing the false success.
Problem Statement
Reproduced twice in a row, same daemon, same session, minutes apart. Two create_schema calls, identical in shape; the first persisted, the second did not.
Call 1 — persisted.
Tool executed tool=create_schema is_error=false duration_ms=0 result_field_count=1
args_preview={"fields":[{"name":"signed_date","type":"date"}],"name":"Company Sold To"}
result_preview={"description":"Schema for Company Sold To","fields":[{"friendlyName":"Signed date",...
Result: schema company_sold_to exists and is retrievable.
Call 2 — reported success, did NOT persist.
Tool executed tool=create_schema is_error=false duration_ms=0 result_field_count=2
args_preview={"fields":[{"name":"booking_date","type":"date"},{"name":"capacity","type":"number"}],"name":"Event Venue"}
result_preview={"description":"Schema for Event Venue","fields":[{"friendlyName":"Booking date","indexed":false,"name":"booking_date","protection":"user","type":"date"},{"friendlyName":"Capacity",...
Agent's reply to the user:
"The new type, 'Event Venue,' has been set up to track events with a name (which is the node's title), booking date, and capacity."
Verified afterwards against the daemon:
nodespace search --type schemareturns 20 nodes- 20 ids, 20 content names
Company Sold To/company_sold_topresentEvent Venue/event_venueabsent from both the id list and the content list
No error, warning, or rejection appears anywhere in the daemon log for that call. The only nearby warnings are unrelated OCC notices (OCC bypassed: version not provided for batch update) that also accompany the call that did succeed, so they do not distinguish the two.
Three defects compound, and the third is the damaging one:
- The write did not land.
- The tool layer reported
is_error=falsewith a populated result payload describing fields that were never stored. - The agent, correctly trusting its own tool result, told the user the type existed.
A user in this state has been told a type was created, sees no error, and will hit a confusing failure later when they try to use it. This also defeats the existing no-op guard (persisted_field_count), which is designed to catch a write that persisted zero fields — here the result claims two.
Reproduction
Against a clean database (NODESPACE_HOME pointed at an empty dir), locked model loaded:
bun run scripts/aichat.ts ask "Set up a new type for the companies we sell to, with a name and the date we signed them."
bun run scripts/aichat.ts ask "Set up a new type for the places we hold events, with a name, a booking date and a capacity."
nodespace search --type schema | grep -E "^id:"Expected: both company_sold_to and an event_venue-shaped id. Actual: only the first.
Not yet established whether this is deterministic for this particular phrasing or an intermittent race — it reproduced once, in the ordering above. Establishing that is the first task.
Investigation Notes
The OCC bypassed: version not provided for batch update (race condition possible) warnings fire on a node id immediately before each create_schema execution, including the successful one. They are therefore not by themselves the cause, but a write-path race is the obvious first hypothesis given the warning text and the fact that two structurally identical calls diverged.
Worth checking in order:
- Whether the
create_schemaresult payload is constructed from the input rather than from the persisted row — which would explain a populatedresult_previewfor a write that never landed, and would make the false success systematic rather than racy. - Whether a second schema creation in quick succession in the same session collides on the OCC-bypassed batch update above.
- Whether the id derivation (
Event Venue→event_venue) collides with or is rejected by something that does not surface as an error.
Acceptance Criteria
- Determine whether the failure is deterministic for this input or intermittent, and record which
- Root-cause why the write did not persist while the tool reported success
-
create_schemareports an error, or a result that does not claim fields, when the schema was not persisted - The result payload reflects persisted state rather than requested state (or, if it cannot, the tool verifies persistence before returning success)
- A regression test pins the failing case: revert the fix and confirm the test fails
- Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
packages/agent/src/local_agent/tools.rs—create_schema's handler and the result payload it constructspackages/core/src/ops/schema_ops.rs— the schema write pathpackages/daemon/src/services/node_service.rs— theOCC bypassed: version not provided for batch updatewarning sitepackages/agent/src/local_agent/agent_loop.rs—persisted_field_countand the no-op-success guard this case evades
Related
../nodespace-docs/decisions/056-gemma-4-e4b-locked-native-model.md— Scenario 6's open "silent degradation, fabricated completion" finding; same class, different path- Found while building the decision eval for Make schema and operation selection explicit, recorded decision points with a measured Gemma baseline #2802; unrelated to that issue's scope
Activity
malibio commentedon Sep 22, 2026
Frontend: 5240 passed (260 test files)
malibio commentedon Sep 22, 2026
Investigation: not reproducible in-process; the write path is sound
Wrote a probe replicating the exact two-call sequence (
Company Sold TothenEvent Venue) against a fresh DB viahandle_create_schema. Both persisted. So AC#1's answer: the failure is not deterministic for this input, and the "write did not land" premise does not hold at the core layer.Verified sound:
with_transaction(core/services/node_service/mod.rs:594, db/sqlite_store/tx.rs:63) propagates commit errors; buffered events flush only on Ok.INSERT INTO nodeis a plain insert (noOR IGNORE);node.idis PRIMARY KEY, so a duplicate id errors rather than silently skipping.get_schema_nodereads committed state.OCC bypassedwarning is onupdate_nodes_batchonly — no create_schema path reaches it. It is a red herring, as the issue suspected.The three real defects
1. The result payload is an echo of the input —
packages/core/src/schema/mod.rs:1292.CreateSchemaOutputis built fromstored_fields/schema_id, both derived from the request. The value the transaction actually returned is discarded atmod.rs:1245aslet _created_schema_id. Nothing is read back, so the payload cannot distinguish a write that landed from one that didn't.2. The no-op-success guard is structurally blind to create_schema —
agent_loop.rs:1243computesresult["fields"].len(), which for create_schema is the model's own input. Its own doc comment atagent_loop.rs:2561asserts "the result is the executor's report of what it persisted, while args are only the model's report of what it asked for" — false for the first tool it names. Onlyfields: []trips the guard, and core treats that as a valid relationship-only schema.3. The exists-check swallows errors —
mod.rs:1180isif let Ok(Some(existing)) = .... AnErrfromget_schema_nodefalls through to the write. Andget_schema_nodereturnsOk(None)for a schema that physically exists whenSchemaNode::from_nodefails to parse it (db/sqlite_store/nodes.rs:3438warns, returnsOk(None)).One genuine divergence vector, noted not fixed here
The agent turn runs against its per-database
NodeServicewith no routing —LocalAgentServiceImpl::routeis only called bysubscribe_token_stream/cancel_turn/get_status, not the turn itself. A CLInodespace searchwith nox-ns-database-idheader resolves toregistry.default_database. If the chat ran in a non-default database, the write landed correctly and the CLI read a different one — which fits the reported evidence exactly (no error, populated payload, absent row). Filing separately rather than widening this issue.Fix being implemented
Read back the committed schema node and build the output from it; propagate
Errfrom the exists-check rather than treating it as absent; make the guard's field count reflect persisted state.Pin the resolved default database id on CLI reads (closes #2835)