Skip to content

create_schema/update_schema tool JSON schema declares unique_case_insensitive, but SchemaField requires camelCase uniqueCaseInsensitive #2801

Closed

Description

@mstomar125

Summary

The local agent's own native tool schemas for create_schema and update_schema (packages/agent/src/local_agent/tools.rs) declare the unique-field flag's JSON key as unique_case_insensitive — the same wrong spelling documented (and now fixed) in skill_rules.rs per #2788. But unlike the doc-text bug, this is a live, functional defect: it's the actual JSON Schema handed to the LLM to shape its tool-call arguments, and those arguments are deserialized through the exact same path as the CLI.

Where

  • packages/agent/src/local_agent/tools.rs:1352 (def_create_schema's fields item schema)
  • packages/agent/src/local_agent/tools.rs:1443 (def_update_schema's add_fields item schema)

Both declare:

"unique_case_insensitive": { "type": "boolean", "description": "..." }

in a properties block where every other multi-word key is already correctly camelCase (friendlyName, coreValues).

Why it's a real bug, not just a doc mismatch

SchemaField (packages/nodespace-types/src/schema.rs:147-148) carries #[serde(rename_all = "camelCase", deny_unknown_fields)], so a JSON payload containing the key unique_case_insensitive is rejected as an unknown field.

exec_create_schema/exec_update_schema (packages/agent/src/local_agent/tools.rs, ~line 3594/3618) pass the LLM's raw tool-call args: Value straight through to handle_create_schema/handle_update_schema (packages/core/src/schema/mod.rs), which deserialize the whole payload directly into CreateSchemaParams/UpdateSchemaParams (nesting SchemaField) via serde_json::from_value — no key normalization or translation layer in between.

So when the in-app agent's own tool-calling model follows its tool schema and sets "unique_case_insensitive": true on a field, the call is rejected with the same unknown field error the CLI reproduction in #2788 hit. This isn't hypothetical or only theoretical — it's the identical code path, just reached through a different caller (exec_create_schema vs. the CLI's schema create --params).

I did not find a test that exercises this specific path (a JSON payload built from the tool's own declared schema, deserialized through the real handle_create_schema), which is presumably why it's gone unnoticed — unique_field_tool_descriptions_state_advisory_only_semantics (local_agent/tools.rs) checks the description wording (advisory-only claim) but not that the key itself round-trips through the real deserializer.

Suggested fix

Rename both occurrences to uniqueCaseInsensitive in the tool JSON schemas, matching the unique sibling key's already-correct camelCase treatment (single-word keys are identical in both conventions, same root cause as #2788). Add a test that builds a minimal tool-call payload from Tool::CreateSchema/Tool::UpdateSchema's own declared schema (or just a literal field object using the declared key) and deserializes it through SchemaField, so this can't silently reoccur.

Scope note

packages/agent/src/local_agent/ is Michael's lane — not fixed here, filed for pickup.

Found via

Investigating #2788 (skill_rules.rs doc text had the same wrong key). Traced every consumer of the doc text to rule out a second, opposite-direction bug, and found the tool schema itself carries the same mistake independently.

Activity

  1. added
    bug
    on Sep 22, 2026
  2. malibio commented on Sep 22, 2026

    @malibio
    Collaborator

    Root-cause context from the same investigation (#2809, #2810, #2811 filed alongside):

    This is the third instance of one bug class — a Rust field name written into the wire layer. #2788 was the skill prose, this is the live tool schema, and #2809 is the same mistake in components/schema-management.md.

    The reason it keeps recurring is documented in #2810: schema field names are snake_case (due_date) and field metadata keys are camelCase (uniqueCaseInsensitive), and they sit side by side in one payload. So in tools.rs:1352 / :1443, unique_case_insensitive looks right next to "name": "lowercase snake_case" in the very same properties block. Neither eyeballing nor 'match the neighbours' catches it — only deny_unknown_fields does, at runtime.

    Confirms the fix as written is correct conformance rather than a workaround: friendlyName and coreValues in those same blocks are already camelCase, so this is a single outlier, not a convention question.

    Verified still unfixed on main at 639e61c.

  3. malibio commented on Sep 22, 2026

    @malibio
    Collaborator

    Baseline (worktree issue-2801-tool-schema-unique-key): Frontend: 260 test files, 5240 tests passed.

  4. self-assigned this
    on Sep 22, 2026
  5. added a commit that references this issue on Sep 22, 2026
    535ec36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions