Skip to content

create_schema enum fields silently discarded: prose teaches core_values, serde expects coreValues #1809

Closed

Description

@malibio

Overview

Every agent-driven create_schema call with an enum field fails, and the error message misdirects the reader. The cause is a casing contradiction between two instruction channels, made silent by missing deny_unknown_fields.

Problem Statement

packages/agent/src/agent_guidance.rs:27 instructs the model to emit "core_values". SchemaField (packages/nodespace-types/src/schema.rs:30) is #[serde(rename_all = "camelCase")], so deserialization expects coreValues. Neither struct in the path sets deny_unknown_fields, so the key is dropped without error and validation later fails with "enum has no values" — describing a symptom two layers from the cause.

The create_schema tool schema already says coreValues correctly (packages/agent/src/local_agent/tools.rs:630, :698). The model therefore receives both spellings in the same prompt and follows the prose.

That makes this more than a typo. It is a single-variable natural experiment with a known-correct control, showing resident prose overriding a correct tool schema — the strongest evidence behind ADR-064.

Evidence

  • packages/agent/src/agent_guidance.rs:27 — teaches "core_values"
  • packages/nodespace-types/src/schema.rs:30-38 — rename_all = "camelCase", field core_values → wire key coreValues
  • packages/core/src/schema/mod.rs:139 — CreateSchemaParams, no deny_unknown_fields
  • packages/agent/src/local_agent/tools.rs:630, :698 — tool schema correctly declares coreValues
  • Verified present in the live assembled system prompt
  • Channel-authority measurement: a rule in the tool schema produced 100% compliance, the same rule absent produced 62.5%, the same rule in prose produced 87.5%

Acceptance Criteria

  • deny_unknown_fields added to SchemaField — this is where the discard occurs. Adding it only to CreateSchemaParams does not fix the bug
  • deny_unknown_fields also added to CreateSchemaParams
  • The ENUM FIELDS line is deleted from agent_guidance.rs, not corrected. Argument shape belongs to the tool schema, which already carries it — correcting the prose would leave two sources to drift again
  • A test asserts a SchemaField payload using core_values is rejected with an error naming the unknown field
  • An agent-level test asserts create_schema with an enum field succeeds end to end

Architecture Impact

First application of ADR-064 rule 1 (tool schemas own argument shape). Note packages/agent/src/local_agent/tools.rs is also touched by the create_schema description-inference removal — coordinate if both are in flight.

Activity

  1. malibio commented on Jul 30, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 171 test files passed, 4112 tests passed (51.75s)

  2. self-assigned this
    on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions