Skip to content

fix(roadmap): intake asks the model again when its proposal names a value off the list, and a --title candidate it still cannot place exits non-zero #1677

Closed

Description

@dan-petty

Friction

  • On 2026-10-18 a person ran devops roadmap intake --title ... --body-file ... --confirm over a queue of 23 drafts. Two drafts whose titles start perf( were dropped: "skipped, nothing written: the model's proposal is not valid: type 'type/perf' is not one of type/feature, type/bug, type/security, type/refactor, type/docs, type/infra, type/test, type/chore". Neither was filed, borrowed or folded, and nothing names an item to add it to.
  • Both runs exited 0, so the loop's exit=0 read as success. The candidate is lost unless a person reads every run's text.
  • In the same run, another perf(ci) draft was filed as type/infra (perf(ci): the structural-invariants hook runs the stdlib metric once per commit, with no uv sync #1667). So the model maps the Conventional Commit prefix to a type only some of the time, and one bad answer drops a valid candidate.
  • An earlier queue run the same day left 12 of 48 drafts unfiled with no trace on GitHub. A skip that exits 0 is one way that can happen unseen.

Evidence

Checked at release/v0.2.37 66ff3d6.

  • ModelProposal.type is plain text by design (src/devops_cli/roadmap/intake_model.py:44-60; the module docstring says "code, not the schema, decides which values stand"). validate_proposal (src/devops_cli/roadmap/intake.py:844-862) raises _InvalidProposal for any value off its list.
  • _decide (intake.py:1159-1180) catches it and returns _skipped (:1182-1185): nothing is written. The model is never asked again, though one more call with the problem named would usually fix a single off-list value.
  • .github/labels.yml declares no type/perf, and Conventional Commits' perf type has no label it maps to.
  • fix(roadmap): refine sends the model the proposal schema and never caches a reply that fails it, and one failed item skips only that item #1363 made refine send the model the proposal schema and refuse to cache a reply that fails it; intake has no equivalent retry for a value off its list.

Remedy

  • When the proposal names a value off its list, ask the model once more in the same request. Name each invalid field and its allowed values, using the existing intake_invalid_value text. Code stays the judge: the second answer goes through validate_proposal again, and a second failure skips as today. Use pydantic-ai's output-validator retry (ModelRetry) if the LLM client exposes it; otherwise one extra call through ProposalClient. Do not hand-roll a retry loop around the client.
  • A run whose --title candidate ends skipped exits non-zero, naming the reason, so a script that files a queue notices. A run over existing candidates keeps exit 0 and lists its skips, as today.
  • The prompt's type list says which label a Conventional Commit prefix such as perf, build or ci takes, from one table in config/constants.py. Whether to add a type/perf label to .github/labels.yml instead is the owner's call.

Acceptance criteria

  • Tests first, offline, with a fake ProposalClient:
    • a first reply with type/perf and a second with type/infra files the candidate as type/infra after exactly two calls;
    • two off-list replies skip the candidate, with both problems in the report;
    • an off-list value or effort is retried the same way.
  • devops roadmap intake --title ... --body-file ... --confirm whose candidate is skipped exits non-zero; the same skip in a run over existing issues exits 0 and lists it.
  • --plan and --dry-run keep their contracts: the retry is one more model call, counted in --plan's spend line, and --dry-run makes no request.

Proposed design

Problem statement

The intake process fails to handle model proposals that name values not on the allowed list by skipping the candidate entirely without retrying. This causes valid candidates to be lost, especially when the model's first answer contains an invalid type like 'type/perf' which maps to no label in .github/labels.yml, and also exits 0 even when a candidate is skipped, making it hard for automation scripts to detect failures.

Acceptance criteria

  • Criterion 1: A proposal with an invalid type field should be retried once with corrective feedback before skipping the candidate.
    Verification: Test with a fake ProposalClient that returns 'type/perf' on first call and 'type/infra' on second call; verify that the second call is made and the candidate is filed as 'type/infra'.
  • Criterion 2: Multiple invalid fields in a proposal should be retried once with all problems listed for correction.
    Verification: Test with a fake ProposalClient that returns both 'type/perf' and 'effort/invalid' on first call; verify that both invalid fields are reported and corrected on second call.
  • Criterion 3: A run whose --title candidate is skipped should exit non-zero to indicate failure.
    Verification: Run devops roadmap intake --title ... --body-file ... --confirm with a candidate that will be skipped, and verify the process exits with non-zero code.
  • Criterion 4: A run over existing candidates that skips items should exit 0 and list the skips.
    Verification: Run devops roadmap intake --title ... --body-file ... --confirm over existing issues; verify it exits 0 and lists skipped candidates in output.
  • Criterion 5: The --plan and --dry-run flags maintain their contracts with retry logic included in the plan spend line.
    Verification: Run devops roadmap intake --plan --title ... --body-file ... and verify that a retry is counted in the spend line; run --dry-run and ensure no actual model calls are made.

Key questions

  • Does pydantic-ai's output-validator retry (ModelRetry) support retrying proposals with invalid values?: The context indicates that pydantic-ai's output-validator retry is available as ModelRetry and has been used in other parts of the codebase, but it's not explicitly stated whether it supports retries for invalid field values specifically. [sources: src/devops_cli/roadmap/intake_model.py:109, docs/agent/tasks/task-601-one-verdict-writer-cited-refutations-and-no-unverified-fix-c.md:17]
  • What is the current behavior when a proposal contains an invalid type value?: When a proposal contains an invalid type, _decide catches _InvalidProposal and returns _skipped, meaning nothing is written and the model is never asked again. [sources: src/devops_cli/roadmap/intake.py:1159-1180, src/devops_cli/roadmap/intake.py:1177-1185]
  • Should the fix implement a retry mechanism using pydantic-ai's ModelRetry or a custom approach?: The remedy section explicitly states to use pydantic-ai's output-validator retry if available, otherwise use one extra call through ProposalClient and not hand-roll a retry loop. (proposed)
  • Should the exit code change for skipped candidates?: Yes, a run whose --title candidate ends skipped should exit non-zero, while runs over existing candidates that skip items should keep exiting 0. (proposed)

Fit

Needs splitting into 3 items:

  1. Implement retry mechanism for invalid proposal values using pydantic-ai's ModelRetry or custom approach
  2. Update exit codes to distinguish between skipped candidates and skipped existing issues
  3. Modify intake logic to re-ask model when proposal contains invalid values

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    on Oct 18, 2026
  2. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Type: type/bug. The candidate describes a problem where the model's proposal is not valid and causes candidates to be dropped, which is a bug in the intake process.
    • Priority: P1-High. The issue causes valid candidates to be lost and exits with 0, making it hard to detect and fix without manual inspection.
    • Value: High. Fixing this ensures all valid candidates are processed correctly, preventing loss of valuable work.
    • Effort: Medium. Requires changes to the intake logic to retry model calls and update exit codes, but doesn't involve major architectural changes.
  3. dan-petty commented on Oct 18, 2026

    @dan-petty
    OwnerAuthor

    Proposal needs splitting into 3 items at 25e2cda (see proposed design in issue body).

  4. added this to the v0.2.37 milestone on Oct 19, 2026
  5. added
    status/in-progress
    status/in-review
    and removed
    status/in-progress
    on Oct 19, 2026
  6. dan-petty commented on Oct 20, 2026

    @dan-petty
    OwnerAuthor

    What changed

    #1709, merged into release/v0.2.37 as 9bae4fc.

    Description

    When devops roadmap intake asks the analysis model for a proposal, the model may return values outside the allowed domain (such as an unrecognized type or non-standard Value/Effort). Previously, any validation failure immediately skipped the candidate. Additionally, when a candidate passed via --title and --body-file with --confirm was skipped, the CLI exited 0 as if it succeeded.

    This PR implements:

    • Single retry with structured feedback (problem field) in ProposalRequest when validate_proposal raises _InvalidProposal.
    • System prompt instruction informing the model to correct invalid values when problem is present, with conventional commit mappings for prefixes without dedicated labels.
    • Comprehensive skip reporting joining both problems in the decision and rendered report when both attempts fail validation.
    • Model call spend accounting for retry attempts.
    • Non-zero CLI exit (code 1) when a --title candidate cannot be placed and is skipped under --confirm, preserving exit code 0 for existing candidate runs.

    Closes #1677.

    8 file(s) changed.

    How it was verified

    Check runs at c7b7382:

    • Prune PR DevContainer Images: pass
    • Audit Defect PR Hardening: skipping
    • zizmor: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Rule Pack Tests: pass
    • Fail-to-Pass Self-Check: pass
    • Changed-Test Independence: pass
    • Tests & Coverage: pass
    • Fail-to-Pass Check: pass
    • Analyze (actions): pass
    • Static Analysis: pass
    • Analyze (python): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1677-intake-retry-invalid-proposal.md:

    • Proposal retry on off-list value: An off-list type, value, or effort triggers a single retry with feedback detailing which fields failed validation.
    • Successful recovery: A valid second proposal places the candidate normally.
    • Combined error report on dual failure: Two invalid proposals skip the candidate and include both failure reasons in the decision and rendered report.
    • Spend accounting: Retry attempts are counted in the proposal call spend report.
    • CLI exit code: devops roadmap intake --title ... --confirm exits with code 1 when the candidate is skipped, while existing issue batch runs maintain exit code 0.
  7. removed
    status/in-review
    on Oct 30, 2026
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

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions