Skip to content

fix(roadmap): the stage schema refuses a null reference reason #4214

Closed

Description

@dan-petty

Problem

The prompt of the stage planner tells the model to send null for reason in an entry of references. The schema of the reply does not allow null there. A reply that follows the prompt fails the schema, and the job ends the item with StructuredOutputValidationError.

  • src/devops_cli/ai/tasks/roadmap_stage_change.md, key references: "reason is a non-empty string when unchanged is true, else null." (added by feat(roadmap): require a move plan to cover each reference #4166, commit c3cf983, 2026-11-08).
  • src/devops_cli/roadmap/stage/stage_change.py, class StageReference: reason: Line = "". Line is str. The JSON schema that pydantic-ai sends is {"type": "string", "default": ""}.

Reproduction on 2026-11-09 (one live run, devops roadmap stage --plan --item 3576, with the violations printed):

loc=('references', 0, 'reason') type=string_type msg=Input should be a valid string input=None
loc=('references', 1, 'reason') type=string_type msg=Input should be a valid string input=None
loc=('references', 3, 'reason') type=string_type msg=Input should be a valid string input=None

Offline: StageReference.model_validate({"path": "src/a.py", "kind": "import", "unchanged": False, "reason": None}) raises string_type on reason.

The log of the Service holds only "N schema violation(s)" (#4204), so this cause stayed hidden. A model that follows the prompt exactly fails; a reply that fails this way also costs the return try of the item.

Note: in this run the model that answered was deepseek-v4.1-flash-1017, not claude-sonnet-5-5 (see #4205). The defect does not depend on the model: the prompt asks for null.

Expected

The prompt and the schema agree on the value of reason when unchanged is false. A reply that follows the prompt passes the schema.

Acceptance criteria

  1. uv run devops ci test tests/roadmap/stage/test_roadmap_stage_content.py holds a test that validates a StageProposal with references: [{"path": ..., "kind": ..., "unchanged": false, "reason": null}] and gets no ValidationError. Today the test fails with string_type.
  2. uv run devops ci test tests/roadmap/stage/test_roadmap_stage_prompt_rules.py holds a test that reads the references line of the prompt and builds the example reply from it. The reply passes StageProposal. Today the reply built from the prompt fails.

Existing tool considered

pydantic: StageReference.reason: Line | None = None (the schema then shows null), or one word in the prompt ("else an empty string"). No new library or helper. The smallest change is the prompt line, because the schema and the code that reads ref.reason already use a string.

Cost

Tokens to build: about 20,000 (one line of the prompt or one type, two tests). Tokens to keep: none. Tokens to fix: none. Elapsed time: 30 minutes.

Related

#4204 (the violation text is not logged), #4205 (placeholder replies; the gateway sends the stage call to the fallback model), #4166 (added the prompt line).

Source: #4204

Activity

  1. added
    source/agent
    on Nov 9, 2026
  2. added
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 9, 2026
  3. dan-petty commented on Nov 9, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. A model that follows the prompt fails validation, but the fix is one word or one type annotation. The regression commit c3cf983 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Value: Medium. It unblocks correct model replies that currently end the item with a StructuredOutputValidationError.
    • Effort: Low. The change is one line in the prompt or one type annotation plus two tests, about 30 minutes.
    • Related: fix(roadmap): remove the cause of placeholder stage replies #4205, which asks for a different change. Both items address stage reply failures, but #4205 removes the cause of placeholder replies while this item fixes a prompt/schema mismatch on the reason field.
  4. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 9, 2026
  5. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  6. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 10:07 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions