You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
create_schema copies a retrieved schema's fields onto an unrelated new type (album_tracker gets is_returned/replacement_cost) #1846
create_schema reuses the field list of a semantically-retrieved schema when creating a different type, producing types whose fields are meaningless for them. Found while fixing #1841; measured to be independent of that fix.
In the agent-matrix eval all three create_schema calls of a run emitted byte-identical field arrays for Equipment Item, Album Tracker and Venue Tracker.
It is the retrieved schema, not conversation history
condition
"Start tracking albums" produces
clean DB, no equipment schema
genre ✅
equipment schema present, same chat
is_returned, replacement_cost ❌
equipment schema present, separate chat node
is_returned, replacement_cost ❌
Reproducing in a separate chat rules out conversation history. The carrier is the RELEVANT ENTITY TYPES block assembled by semantic schema retrieval (context_ops.rs): a schema injected as context is being consumed as a template.
Agent-matrix scenario 8c is unwinnable by construction: "Kind of Blue, it's by Miles Davis" cannot store an artist because album_tracker has no artist field. It currently scores green because its expectation is a bare toolOnce with no minProperties.
Suggested direction
Likely ADR-064 rule 5 (prose) or rule 1 (context surface): the entity block does not distinguish "types that already exist, do not recreate them" from "a shape to imitate." The Schema Creation guidance should state that a new type's fields come from the user's message only, and the entity block may need to separate "existing types" from anything template-like. Worth measuring the candidates against each other rather than assuming, as in #1841.
Acceptance Criteria
Determine the mechanism, measured rather than assumed
A new type's fields derive from the user's request, not from retrieved schemas, with an unrelated schema present
Add minProperties to agent-matrix 8c so it can no longer score green on an empty record
create_schema field contamination is caused by the RELEVANT ENTITY TYPES context block acting as an unintentional template. When the model creates a new type, any semantically-retrieved unrelated existing schema's fields are copied verbatim onto the new type — confirmed via a live isolated daemon (purged DB, gemma-4-e4b-q4km, n_ctx 32768): after creating an equipment_item schema (is_returned, replacement_cost), the request "Start tracking albums I mean to listen to" produced album_tracker with those exact same two fields.
Fix attempt 1 — prose rule (measured: no effect)
Added a FIELD SOURCE rule to the Schema Creation skill instructions (packages/agent/src/skill_rules.rs + skill_pipeline.rs + SKILL.md), stating fields must derive from the user's request, never from a schema shown in RELEVANT ENTITY TYPES.
Measured result: zero effect. Confirmed the rule was actually seeded and present in the live prompt (queried the skill node directly), yet album_tracker/venue_tracker still got byte-identical fields to equipment_item in the full eval run. This reproduces ADR-064's own finding that resident/skill prose is the weakest channel and cannot override what's sitting in the context block itself.
Put the anti-copy instruction inline in the context block header itself, right next to the data being misused, in two places:
packages/core/src/ops/context_ops.rs — the resident RELEVANT ENTITY TYPES block every turn sees.
packages/agent/src/local_agent/routing.rs — a second, previously-unguarded copy of the identical schema-fields text rendered per Stage-2 routing candidate. A full-prompt diagnostic dump (temporary instrumentation, reverted) showed this second site was reinforcing the exact contamination even after fixing site 1 alone.
Measured result across 5 independent trials (fresh purged DB each time, same equipment→album repro):
4 of 5 trials: clean, sensible fields (genre, or genre+artist)
1 of 5 trials (the full 12-scenario eval:agent suite run): still contaminated
This is a real, measured reduction — not zero effect like the prose-only attempt — but not a categorical fix. It matches ADR-064's documented finding that prompt/context-level interventions on this locked 4B model are probabilistic, not deterministic.
Recommendation
A fully deterministic fix would need to restructure context assembly to depend on the routing decision (e.g., excluding other custom-type schemas' fields from the entity block specifically when the turn is routed toward create_schema) — context_ops.rs currently assembles the block before ADR-038's Stage 2 routing runs, so this isn't a small change.
I'd propose shipping the structural fix now (both render sites, consistent framing) since it's a measured improvement with no observed downside, and moving further hardening (context-assembly-depends-on-routing) to a follow-up issue if the residual ~20% contamination rate is still unacceptable — rather than blocking this fix on a bigger architectural change. Also added minProperties: 1 to eval scenario 8c so it can no longer score green on an empty record (per the acceptance criteria), and confirmed scenario 8c's behavior changed from "calls no tool" to "calls create_node" across these runs (a related, distinct pre-existing gap from #1841 — it still doesn't reliably persist the properties it captures).
Proceeding to open a PR with this fix unless redirected.
Strong work — this is the third confirmed instance of the same channel-authority finding (prose can't override structural context, per ADR-064), and finding the second, previously-unguarded contamination site in routing.rs's Stage-2 candidate rendering is a real catch nothing else surfaced. The methodology (prose attempt measured to zero effect before trying structural, 5 independent trials rather than one lucky run) is exactly the discipline this workstream has needed.
Ship the structural fix now — agreed, don't block on the deterministic redesign. A measured 80%→clean improvement with no observed downside is a real win; holding it hostage to a bigger context-assembly-depends-on-routing change would be the wrong trade, especially since that change is genuinely large (context is assembled before Stage 2 routing runs today).
Two things before this closes:
The ~20% residual rate needs to live somewhere durable, not just this issue thread. Once this closes, "1 of 5 trials still contaminated" is gone unless it's carried forward. Two options: (a) a doc comment at both fix sites (context_ops.rs and routing.rs) stating the measured residual rate and pointing at the follow-up issue, so a future reader hitting this bug again isn't starting from zero; (b) file the follow-up issue now, referencing this measurement, rather than leaving "moving further hardening to a follow-up issue" as an intention with nothing tracking it. I'd do both — cheap, and this exact pattern (a finding evaporating because it only lived in a closed issue's comments) is what made Update scenario asks the user for a node ID instead of calling resolve_query, despite guidance and tool availability #1835 need re-investigation earlier in this workstream.
Confirm the two fix sites can't drift apart. You found contamination came from two copies of the same schema-fields text. If a future change touches one site's anti-copy framing without the other, this could silently regress at only one of the two sites — worth either a shared rendering function/constant for the instruction text (so there's one source, not two independently-maintained copies saying the same thing), or a test asserting both sites contain matching guidance. Given create_schema enum fields silently discarded: prose teaches core_values, serde expects coreValues #1809/create_schema copies a retrieved schema's fields onto an unrelated new type (album_tracker gets is_returned/replacement_cost) #1846 have now both been "same instruction spelled two ways, drifted" bugs, treating "keep N copies of an instruction consistent" as a known failure mode rather than trusting future-you to remember is worth the small extra effort here.
On scenario 8c's related finding — right call to note it as distinct from #1841 rather than fold it in. "Calls no tool" → "calls create_node but doesn't reliably persist properties" is real forward progress on a different mechanism, and conflating it with this issue's fix would muddy both.
Proceed with the PR. Please file the follow-up issue (or confirm you're folding the doc-comment approach into this PR) before closing.
Deduplicated the anti-copy header into a shared RELEVANT_ENTITY_TYPES_HEADER constant (packages/core/src/ops/context_ops.rs), imported and used by both render sites (context_ops.rs and local_agent/routing.rs). Added a test (schema_metadata_section_uses_the_shared_header) asserting the routing.rs site uses the exact constant, so the two can no longer drift apart silently.
Filed the follow-up issue: create_schema field contamination still occurs on ~1 in 5 turns after #1846's context-block fix #1858, documenting the measured residual rate (4/5 clean, 1/5 contaminated) and the proposed direction (context assembly depending on the routing decision). Also documented the residual rate directly in RELEVANT_ENTITY_TYPES_HEADER's doc comment so it's visible at the code site, not just in this closed issue's thread.
Full test suite (test:all) and quality:fix both pass. Proceeding to open the PR.
Activity
malibio commentedon Jul 31, 2026
Frontend baseline: 171 test files passed, 4113 tests passed.
malibio commentedon Jul 31, 2026
Mechanism found (measured, not assumed)
create_schemafield contamination is caused by theRELEVANT ENTITY TYPEScontext block acting as an unintentional template. When the model creates a new type, any semantically-retrieved unrelated existing schema's fields are copied verbatim onto the new type — confirmed via a live isolated daemon (purged DB,gemma-4-e4b-q4km, n_ctx 32768): after creating anequipment_itemschema (is_returned,replacement_cost), the request "Start tracking albums I mean to listen to" producedalbum_trackerwith those exact same two fields.Fix attempt 1 — prose rule (measured: no effect)
Added a
FIELD SOURCErule to the Schema Creation skill instructions (packages/agent/src/skill_rules.rs+skill_pipeline.rs+SKILL.md), stating fields must derive from the user's request, never from a schema shown inRELEVANT ENTITY TYPES.Measured result: zero effect. Confirmed the rule was actually seeded and present in the live prompt (queried the skill node directly), yet
album_tracker/venue_trackerstill got byte-identical fields toequipment_itemin the full eval run. This reproduces ADR-064's own finding that resident/skill prose is the weakest channel and cannot override what's sitting in the context block itself.Fix attempt 2 — structural (measured: partial improvement)
Put the anti-copy instruction inline in the context block header itself, right next to the data being misused, in two places:
packages/core/src/ops/context_ops.rs— the residentRELEVANT ENTITY TYPESblock every turn sees.packages/agent/src/local_agent/routing.rs— a second, previously-unguarded copy of the identical schema-fields text rendered per Stage-2 routing candidate. A full-prompt diagnostic dump (temporary instrumentation, reverted) showed this second site was reinforcing the exact contamination even after fixing site 1 alone.Measured result across 5 independent trials (fresh purged DB each time, same equipment→album repro):
genre, orgenre+artist)eval:agentsuite run): still contaminatedThis is a real, measured reduction — not zero effect like the prose-only attempt — but not a categorical fix. It matches ADR-064's documented finding that prompt/context-level interventions on this locked 4B model are probabilistic, not deterministic.
Recommendation
A fully deterministic fix would need to restructure context assembly to depend on the routing decision (e.g., excluding other custom-type schemas' fields from the entity block specifically when the turn is routed toward
create_schema) —context_ops.rscurrently assembles the block before ADR-038's Stage 2 routing runs, so this isn't a small change.I'd propose shipping the structural fix now (both render sites, consistent framing) since it's a measured improvement with no observed downside, and moving further hardening (context-assembly-depends-on-routing) to a follow-up issue if the residual ~20% contamination rate is still unacceptable — rather than blocking this fix on a bigger architectural change. Also added
minProperties: 1to eval scenario 8c so it can no longer score green on an empty record (per the acceptance criteria), and confirmed scenario 8c's behavior changed from "calls no tool" to "calls create_node" across these runs (a related, distinct pre-existing gap from #1841 — it still doesn't reliably persist the properties it captures).Proceeding to open a PR with this fix unless redirected.
malibio commentedon Jul 31, 2026
Strong work — this is the third confirmed instance of the same channel-authority finding (prose can't override structural context, per ADR-064), and finding the second, previously-unguarded contamination site in
routing.rs's Stage-2 candidate rendering is a real catch nothing else surfaced. The methodology (prose attempt measured to zero effect before trying structural, 5 independent trials rather than one lucky run) is exactly the discipline this workstream has needed.Ship the structural fix now — agreed, don't block on the deterministic redesign. A measured 80%→clean improvement with no observed downside is a real win; holding it hostage to a bigger context-assembly-depends-on-routing change would be the wrong trade, especially since that change is genuinely large (context is assembled before Stage 2 routing runs today).
Two things before this closes:
The ~20% residual rate needs to live somewhere durable, not just this issue thread. Once this closes, "1 of 5 trials still contaminated" is gone unless it's carried forward. Two options: (a) a doc comment at both fix sites (
context_ops.rsandrouting.rs) stating the measured residual rate and pointing at the follow-up issue, so a future reader hitting this bug again isn't starting from zero; (b) file the follow-up issue now, referencing this measurement, rather than leaving "moving further hardening to a follow-up issue" as an intention with nothing tracking it. I'd do both — cheap, and this exact pattern (a finding evaporating because it only lived in a closed issue's comments) is what made Update scenario asks the user for a node ID instead of calling resolve_query, despite guidance and tool availability #1835 need re-investigation earlier in this workstream.Confirm the two fix sites can't drift apart. You found contamination came from two copies of the same schema-fields text. If a future change touches one site's anti-copy framing without the other, this could silently regress at only one of the two sites — worth either a shared rendering function/constant for the instruction text (so there's one source, not two independently-maintained copies saying the same thing), or a test asserting both sites contain matching guidance. Given create_schema enum fields silently discarded: prose teaches core_values, serde expects coreValues #1809/create_schema copies a retrieved schema's fields onto an unrelated new type (album_tracker gets is_returned/replacement_cost) #1846 have now both been "same instruction spelled two ways, drifted" bugs, treating "keep N copies of an instruction consistent" as a known failure mode rather than trusting future-you to remember is worth the small extra effort here.
On scenario 8c's related finding — right call to note it as distinct from #1841 rather than fold it in. "Calls no tool" → "calls create_node but doesn't reliably persist properties" is real forward progress on a different mechanism, and conflating it with this issue's fix would muddy both.
Proceed with the PR. Please file the follow-up issue (or confirm you're folding the doc-comment approach into this PR) before closing.
malibio commentedon Jul 31, 2026
Both review action items done:
Deduplicated the anti-copy header into a shared
RELEVANT_ENTITY_TYPES_HEADERconstant (packages/core/src/ops/context_ops.rs), imported and used by both render sites (context_ops.rsandlocal_agent/routing.rs). Added a test (schema_metadata_section_uses_the_shared_header) asserting the routing.rs site uses the exact constant, so the two can no longer drift apart silently.Filed the follow-up issue: create_schema field contamination still occurs on ~1 in 5 turns after #1846's context-block fix #1858, documenting the measured residual rate (4/5 clean, 1/5 contaminated) and the proposed direction (context assembly depending on the routing decision). Also documented the residual rate directly in
RELEVANT_ENTITY_TYPES_HEADER's doc comment so it's visible at the code site, not just in this closed issue's thread.Full test suite (
test:all) andquality:fixboth pass. Proceeding to open the PR.Address review: clarify FIELDS_FROM_REQUEST_ONLY's measured-ineffecti…
Stop create_schema from copying an unrelated retrieved schema's field…
Retarget matrix scenario 9 to a field the schema actually has (#1937)
Gate no-op update_node calls and act on the persisted-field signal (c…
Fix five matrix-harness defects that corrupt or block scoring (#2282)