Skip to content

Description-only create_schema always fails: namespaced field names contain ':' which the field-name validator rejects #1777

Closed

Description

@malibio

Found while investigating #1775. Independent of that issue; not fixed there.

Symptom

create_schema called with a description and no explicit fields array fails for every inferred field:

Failed to create schema node for 'venue': Node validation failed: Properties validation failed:
Invalid field name 'custom:contact_email': must contain only alphanumeric characters and underscores

Reproduction

Against unmodified main (ebf8350c), added as a temporary test in packages/core/src/schema/schema_test.rs:

let result = handle_create_schema(
    &svc,
    json!({ "name": "Venue", "description": "contact email and capacity number" }),
).await;
assert!(result.is_ok(), "{:?}", result);

Fails as above. Any description that yields at least one inferred field reproduces it.

Cause

The description path runs parse_field_descriptions → normalize_and_namespace_fields, which prefixes inferred field names with custom: (the namespace convention from the node-type system). The schema node is then validated by the field-name check at packages/core/src/behaviors/mod.rs:1250, which permits only alphanumerics and underscores — so the : in the namespace prefix is always rejected.

The explicit-fields path is unaffected, which is why this has gone unnoticed: the agent nearly always sends explicit fields, and that is what the eval exercises.

Fix direction

Decide where the namespace prefix belongs relative to validation — either the validator should accept the <namespace>: prefix on schema field names, or namespacing should be applied after per-field name validation. Worth checking whether the explicit-fields path namespaces at a different point, since it does not hit this.

Acceptance criteria

  • create_schema with a description and no fields array creates the schema successfully
  • A regression test covers the description-only path end-to-end
  • The chosen rule for namespace prefixes vs. field-name validation is stated in the code, and the two paths agree on it

Activity

  1. added
    bug
    on Jul 28, 2026
  2. malibio commented on Jul 28, 2026

    @malibio
    CollaboratorAuthor

    Sized while deciding whether to fold this into #1775. Keeping it separate — the blocker is not effort, it is that the fix requires picking between two conventions the codebase currently asserts simultaneously:

    • packages/core/src/ops/query_ops.rs:358 asserts custom:field is a valid identifier.
    • packages/core/src/behaviors/mod.rs:1248 (validate_schema_field) rejects any name containing :.
    • packages/core/src/schema/mod.rs:1395-1571 has tests pinning custom:-prefixed names as the correct output of normalize_and_namespace_fields.

    There is also a second, related inconsistency that any fix has to resolve: the two create_schema routes disagree about namespacing. The description path calls normalize_and_namespace_fields and emits custom:status; the explicit-fields path (schema/mod.rs:144-146) takes fields "already properly typed by caller" and emits a bare status. The same schema therefore gets differently-named fields depending on which route created it — so this is not only "description-only is broken", it is "the two paths do not agree on what a field is called".

    Deciding this means deciding whether schema field names carry namespace prefixes at all, which is the namespace-enforcement question CLAUDE.md flags (issue #400), and the explicit-fields path needs changing too so both routes agree. That is a design call, not a drive-by fix.

    Suggest whoever picks this up settles the convention first and states it in code, per the third acceptance criterion.

  3. malibio commented on Jul 28, 2026

    @malibio
    CollaboratorAuthor

    A third path silently produces the same empty-fields outcome

    Confirming this issue is real and correctly diagnosed, and flagging an adjacent case it does not cover — worth deciding together since the fix direction here ("where does the namespace prefix belong relative to validation") may as well settle both.

    handle_create_schema (packages/core/src/schema/mod.rs:144-165) has three branches:

    1. explicit fields — works
    2. description, no fields — always fails, per this issue
    3. neither — falls to else at line 163: // No fields and no description - create schema with empty fields and returns Ok with fields: []

    Branch 3 is what an agent turn actually hit during matrix diagnosis: the model called create_schema({"name":"Invoice Tracker"}) with no fields and no description, and got back {"description":"Schema for Invoice Tracker","fields":[],"isCore":false} — success, zero typed fields.

    The downstream consequence is the same as this issue's, just reached silently instead of loudly: a typed container with no typed properties. resolve_query then has no field to resolve "$500" against and returns an empty resolution, which is one of the compounding defects behind the still-open Scenario 6 failure (see #1637).

    So the two branches fail in opposite directions — 2 always errors, 3 always succeeds vacuously — and neither yields a usable schema. Whether branch 3 should stay permissive is a separate call from this bug (an agent creating a bare container may be legitimate), but if it stays, the emptiness should at least be visible to the caller rather than indistinguishable from a fully-specified schema.

    Not proposing scope creep — just noting it so the namespace-vs-validation decision is made with branch 3 in view.

  4. malibio commented on Jul 28, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 170 test files passed, 4104 tests passed (0 failures).

  5. self-assigned this
    on Jul 28, 2026
  6. added 2 commits that reference this issue on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions