Skip to content

Delete the create_schema description-inference route: an undocumented second meaning for the description parameter, with a 27% silent-wrong-type rate #1800

Closed

Description

@malibio

Overview

create_schema's description parameter has two meanings. The tool schema documents one; the code implements a second, undocumented one.

packages/agent/src/local_agent/tools.rs:615-618 declares:

"description": {
  "type": "string",
  "description": "Brief description of what this entity type represents"
}

A prose blurb. Nowhere does it say that omitting fields causes description to be parsed into a field list — inferring both field names and field types from English.

Every bug in the create_schema cluster (#1777, #1785, #1789) is a consequence of that hidden second meaning. This issue removes it.

Why inference cannot be made trustworthy

The inference is built on contains_any (packages/core/src/schema/mod.rs:1362), a plain substring match over the whole description. Simulated against 26 realistic descriptions, 7 are mistyped — a 27% silent-wrong-type rate:

Description Inferred Correct Cause
notes, note, notes text boolean string contains no
nominee boolean string contains no
summary number string contains sum
country number string contains count
timezone date string contains time

is_field_required (:1353) has the same defect — any description containing "must" or "critical" anywhere marks the field required. AdditionalConstraints' matching is substring-based and bidirectional (req.contains(field.name) || field.name.contains(req), :1380-1383), so required_fields: ["date"] marks every field whose name contains "date".

These are not ambiguous prose losing a coin flip. They are plain words mistyped by an implementation detail — and the wrong type is silent: the schema is created, the UI renders the wrong control, and writes fail validation later.

Name inference has the same character. #1789 added STRIPPABLE_TYPE_KEYWORDS and INTRINSIC_KEYWORD_PREFIXES — a hand-maintained list of English nouns recording which ones own the word "number" (invoice, phone, ticket, flight, …). That list grew from 12 to 24 entries within a single PR's review cycle, is English-only in a product with no such constraint, and each entry's correctness is unfalsifiable. Its own follow-up commit had to add 24 assertions that prove the list contains what the list contains.

The premise behind that work was correct — "capacity number" and "invoice number" are structurally identical, so intent cannot be read from the phrase. The right conclusion is to require the caller to state the type, not to encode a lexicon.

The route is barely used anyway

The eval traces show the model does not reach for prose. On the failing scenario it supplies neither fields nor description — just name + title_template (see #1799). So the inference engine is a maintenance burden on a path the model barely takes, while making fields look optional in a way the tool schema never intended.

Work

Delete from packages/core/src/schema/mod.rs (~450 lines, roughly :972-1409 plus the struct at :168):

parse_field_descriptions, split_field_descriptions, parse_single_field_description, extract_field_name, extract_before_paren, extract_before_keyword, strip_trailing_type_keyword, STRIPPABLE_TYPE_KEYWORDS, INTRINSIC_KEYWORD_PREFIXES, infer_field_type, extract_enum_values, is_field_required, contains_any, apply_constraints, normalize_inferred_fields, InferredField, AdditionalConstraints, and the additional_constraints parameter.

Keep the description parameter. It is load-bearing for a different reason: create_description_subtree (:895) stores it as a child node so it lands in the schema's embedding and enables semantic discovery. Unaffected by this change.

Move, do not lose: RESERVED_CORE_PROPERTIES and its shadowing warning currently fire only on the inferred path (normalize_inferred_fields, :1435). Deleting the route would drop that check entirely. Move it to run over explicit fields, where it is currently absent — this is the ADR-063 shadowing rule and applies to caller-supplied names at least as much as inferred ones.

Keep unconditionally: the tightened assert_eq! assertions from #1789 wherever they apply to surviving code. .contains() on a schema field list is precisely the weakness that made #1775's regression tests vacuous (#1783).

Acceptance Criteria

  • The description-inference route is gone; create_schema with a description and no fields creates a schema with no inferred fields
  • A call with no fields returns an actionable error naming what is missing, rather than silently creating a property-less type
  • Tool-schema text for description closes the ambiguity at source: "Brief prose summary of what this entity type represents. This is NOT parsed into fields — define every field explicitly in \"fields\"."
  • RESERVED_CORE_PROPERTIES shadowing warning fires on explicit fields, with a test that fails without it
  • AdditionalConstraints and additional_constraints removed; CLI docstring updated (packages/cli/src/commands/schema.rs:5)
  • No remaining references to the deleted functions anywhere in the workspace
  • Existing tests updated or deleted, not weakened — no .contains() assertions reintroduced on field lists

Relationship to other issues

Notes

No migration needed. The inference behavior was never advertised in the tool schema, so this deletes an undocumented behavior, not a contract. The CLI (packages/cli/src/commands/schema.rs) and gRPC seam (packages/daemon/src/services/node_service.rs:1145) are JSON passthroughs; no frontend caller exists.

Activity

  1. malibio commented on Jul 29, 2026

    @malibio
    CollaboratorAuthor

    Documentation impact

    Checked nodespace-docs for whether the inference route is specified anywhere as intended design. It is not. No ADR decides it; the tool schema documents description as a prose blurb. It appears only descriptively.

    Two updates belong in this issue's PR, after the code change:

    • components/schema-management.md:83 — reword "Both create_schema routes (explicit fields and inferred description) store the name they are given" once only one route remains.
    • decisions/063-namespace-prefixes-scope.md — its decision (bare names on user-defined types, prefixes only on core types) is unaffected and stays. But line 40's mechanism sentence — "The description route therefore stops namespacing inferred fields on user-defined types, and both routes converge on the caller's names" — describes a route that will no longer exist. Needs a short amendment noting the convergence is now structural.

    Worth recording: ADR-063 line 29 already stated "The agent uses the explicit-fields route almost exclusively", and line 70 flagged the name-inference divergence as "out of scope here." That scoping was correct for that ADR, but downstream it was read as "a bug to fix on its own terms" rather than "an open question about whether this route should exist" — which is how #1789 came to add a 24-entry English noun keep-list to a route the same ADR described as barely used.

  2. self-assigned this
    on Jul 29, 2026
  3. mstomar125 commented on Jul 29, 2026

    @mstomar125
    Contributor

    Picking this up now (remote/mini session).

  4. mstomar125 commented on Jul 29, 2026

    @mstomar125
    Contributor

    Handing this to @malibio — it falls under the local-agent / skills work he flagged he's actively on, so reassigning to avoid a collision. Unassigning myself; not starting or continuing it on the remote side.

  5. malibio commented on Jul 30, 2026

    @malibio
    CollaboratorAuthor

    Cross-reference: #1809 also edits the create_schema region of packages/agent/src/local_agent/tools.rs — it removes an ENUM FIELDS line from resident prose that contradicts the tool schema's (correct) coreValues key at tools.rs:630/:698.

    Different defect, adjacent lines. Worth coordinating if both are in flight, though they should not conflict — this issue removes the description-inference route, #1809 touches the enum-values key and deny_unknown_fields.

    Both are instances of the same underlying pattern now recorded in ADR-064: a parameter carrying two meanings across two instruction channels, with the undocumented one winning.

  6. malibio commented on Jul 30, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 4111 passed, 1 flaky (architecture-benchmarks.test.ts perf threshold — known machine-load flake, not related to this issue). 170/171 test files passed.

  7. added a commit that references this issue on Jul 30, 2026
    7c87ac1
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