Skip to content

No guard prevents a new schema rule from silently missing the in-app agent prompt #2438

Closed

Description

@malibio

Problem

A new SchemaRule can be registered in SCHEMA_RULES and never reach the in-app agent's prompt. Nothing catches it.

This is not hypothetical — it happened during review of PR #2435. DELETE_A_SCHEMA was written, registered, and rendered into the shipped SKILL.md, but was never interpolated into schema_creation_guidance(). The result: the external shell agent got the new guidance, and the in-app local agent — the surface holding both create_schema and delete_node — did not. The rule existed and did not fire.

Why the existing guards miss it

SchemaRule carries two renderings (packages/agent/src/skill_rules.rs:25-32), consumed by two different renderers, as the module doc at :14-18 states:

  • prose → the shipped SKILL.md, via gen_skill_md
  • imperative → the in-app agent prompt, via schema_creation_guidance() (packages/agent/src/skill_pipeline.rs:75-84)

Two tests exist, and neither closes this:

  • every_schema_rule_reaches_the_skill (packages/cli/tests/skill_md_generation.rs:541) iterates SCHEMA_RULES but asserts only rule.prose. Its own doc comment describes this bug class — "registering a rule in the SCHEMA_RULES array is NOT enough to publish it" — so it is half-guarded by construction.
  • The prompt_assembly_snapshot golden cannot catch it. An unwired rule never enters the rendered prompt, so the golden never changes. It detects modifications to rules already wired in, and stays silent on exactly the omission that matters.

Current state

SCHEMA_RULES has 15 entries (skill_rules.rs:161-177). 10 are interpolated into schema_creation_guidance() (skill_pipeline.rs:75-84). The 5 that are not:

  • NO_NAME_TITLE_FIELD
  • FIELDS_FROM_REQUEST_ONLY
  • NAME_PLACEHOLDER_EXCEPTION
  • ENUM_FORMAT
  • ENUM_EDGE_FIELDS

All five are field/enum shape rules — the category ADR-064 deliberately moved onto create_schema's tool schema rather than the prompt. So the omissions are correct today; what is missing is anything recording that they are deliberate.

Fix

A test over SCHEMA_RULES asserting each rule is either interpolated into schema_creation_guidance() or present in an explicit prose-only exclusion list.

The exclusion list is the substance, not the boilerplate: it must name the five rules above and record the ADR-064 rationale inline, so a future reader can tell a deliberate omission from a forgotten one. That is the fact currently written down nowhere.

Trade-off, considered and accepted

This was raised during review and deliberately deferred, on the argument that a hand-maintained exclusion list is itself a drift source. That is a fair objection, and it is why this is a separate issue rather than a change bolted onto PR #2435.

The counter-argument: an exclusion list drifts loudly — a rule added to the list without justification is visible in review. The status quo drifts silently, and has already produced one shipped defect. A list of 5 entries against 15 rules is a manageable surface.

Acceptance criteria

  • A test asserts every SCHEMA_RULES entry is either interpolated into schema_creation_guidance() or explicitly listed as prose-only
  • The exclusion list names the 5 rules above and records the ADR-064 rationale inline
  • The test fails when a new rule is added to SCHEMA_RULES without being wired or excluded — verify by temporarily adding one
  • The failure message says what to do (wire it, or add it to the list with a reason), not just that a count mismatched

Activity

  1. malibio commented on Sep 8, 2026

    @malibio
    CollaboratorAuthor

    Frontend: 4895 passed

  2. self-assigned this
    on Sep 8, 2026
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