Skip to content

fix(roadmap): refine's failure warnings name no repository and drop the reason, so a gateway timeout and a bad model reply look the same #2562

Description

@dan-petty

Problem Description

When a refine round fails for one item, its warning names neither the repository nor the cause. An operator cannot tell a call that waited too long at the gateway from a reply that the model got wrong:

  • Refine skipped #N: its model call failed (AIClientError, 0 schema violation(s)). gives only the class of the error.
  • Refine's investigation of #N stopped with no proposal (UnexpectedModelBehavior); the item keeps its open questions. gives only the class too: investigate() (src/devops_cli/roadmap/refine_investigation.py:282) keeps type(stopped).__name__ and drops the reason.

The Service runs refine for 7 repositories, and issue numbers repeat across them (#1, #2), so a warning without the repository cannot be traced to its issue.

Reproduction Steps

  1. Run the Service with more than one repository.
  2. Let a refine model call time out at the gateway, or let an investigation end with UnexpectedModelBehavior.
  3. Read the warning: no repository and no reason.

Expected vs Actual Behavior

Expected: each warning names the repository and a reason that holds no model text. For UnexpectedModelBehavior, pydantic-ai's message attribute is its fixed description, such as the end of the output retries or an empty reply; its body holds the model's text and stays out of the log. For an AIClientError, the warning gives its error code and the gateway's status or timeout, as _refine_error already sorts them.

Actual, in the cluster on 2026-10-28 (UTC): four warnings in four hours, with no repository and no reason. The gateway log alone showed that the 22:39 failure was a LiteLLM timeout after 1,100 s.

Environment Diagnostics

Image from main after 657b03d, pods roadmap-service-777f5c87b6-8c58j and roadmap-service-c645459dc-58wgp.

Logs, Traces, or Terminal Output

19:54:08 WARNING Refine skipped #1330: its model call failed (AIClientError, 0 schema violation(s)).
22:39:26 WARNING Refine skipped #1: its model call failed (AIClientError, 0 schema violation(s)).
22:45:08 WARNING Refine's investigation of #1330 stopped with no proposal (UnexpectedModelBehavior); the item keeps its open questions.
22:58:27 WARNING Refine's investigation of #2 stopped with no proposal (UnexpectedModelBehavior); the item keeps its open questions.

Pre-Submission Checklist

  • I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
  • I have checked existing issues and pull requests to ensure this is not a duplicate.

Proposed design

Problem statement

Refine's failure warnings omit the repository name and the failure reason. An operator cannot tell a gateway timeout from a bad model reply. The Service runs refine for 7 repositories, and issue numbers repeat across them, so a warning without the repository cannot be traced to its issue.

Acceptance criteria

Requirement: Repository name in warning

Each refine failure warning SHALL include the repository name.

Scenario: Warning includes repository

Requirement: AIClientError reason in warning

For an AIClientError, the warning SHALL include the error code and the gateway status or timeout.

Scenario: AIClientError warning shows code and status

  • WHEN A refine model call fails with an AIClientError whose code is LLM_INFERENCE_ERROR and whose gateway status is a timeout after 1100 s
  • THEN The warning text contains 'LLM_INFERENCE_ERROR' and 'timeout' or '1100'

Requirement: UnexpectedModelBehavior message in warning

For an UnexpectedModelBehavior, the warning SHALL include the message attribute of the exception.

Scenario: UnexpectedModelBehavior warning shows message

  • WHEN A refine investigation stops with UnexpectedModelBehavior whose message is 'output retries exhausted'
  • THEN The warning text contains 'output retries exhausted'

Requirement: No model text in log

The warning SHALL NOT include the body attribute of UnexpectedModelBehavior.

Scenario: Model body is excluded

  • WHEN A refine investigation stops with UnexpectedModelBehavior whose body contains the string 'SECRET_MODEL_TEXT'
  • THEN The warning text does not contain 'SECRET_MODEL_TEXT'

Existing Tool Considered

No external tool covers this need. The change modifies 2 log format strings in src/devops_cli/roadmap/refine_investigation.py and passes the repository name and the exception reason into them. Build cost: about 30 lines of code change plus 20 lines of test updates. Keep cost: log format strings are stable; no ongoing maintenance. Fix cost: the change is additive; no regression risk beyond the existing log path. Total elapsed time to implement: about 15 minutes.

Key questions

  • Where in the call chain is the repository name available at the point where the warning is logged?: The refine function receives the repository as a parameter. The Service calls refine once per repository, so the repository name is in scope at the warning site in refine_investigation.py. The body confirms the Service runs refine for 7 repositories. [sources: src/devops_cli/roadmap/refine_investigation.py, src/devops_cli/roadmap/refine.py]
  • What fields does _refine_error produce that can be logged for an AIClientError?: _refine_error at line 222 sorts the ModelAPIError into an AIClientError. The body states that the warning should give the error code and the gateway's status or timeout, and that _refine_error already sorts them. The AIClientError definition in docs/ERRORS.md lists the code LLM_INFERENCE_ERROR. [sources: src/devops_cli/roadmap/refine_investigation.py:222, docs/ERRORS.md:26]
  • Which attribute of UnexpectedModelBehavior holds the safe-to-log description?: The body states that pydantic-ai's message attribute is the fixed description (such as the end of the output retries or an empty reply), and that the body attribute holds the model's text and stays out of the log. The UnexpectedModelBehavior definition in docs/ERRORS.md confirms the class and its code UNEXPECTED_MODEL_BEHAVIOR. [sources: docs/ERRORS.md:119, openspec/changes/archive/2026-10-28-2398-refine-investigates-questions/design.md:39]
  • Should the warning include the body attribute of UnexpectedModelBehavior?: No. The body states that the body attribute holds the model's text and stays out of the log. Only the message attribute is logged. (best practice) [sources: docs/ERRORS.md:119]
    • Chosen: Log the message attribute only. The body states that the message is the fixed description and the body holds model text that must stay out of the log. Logging only the message satisfies the operator's need without leaking model output.
    • Rejected: Log both message and body. Rejected. The body explicitly states that the body attribute holds the model's text and stays out of the log. Logging it would violate the expected behavior.
  • What is the exact warning format for each error type?: For AIClientError: 'Refine skipped #N in : its model call failed (, ).' For UnexpectedModelBehavior: 'Refine's investigation of #N in stopped with no proposal (); the item keeps its open questions.' The repository name is added to both existing formats, and the reason replaces the bare class name. (best practice) [sources: src/devops_cli/roadmap/refine_investigation.py:282, src/devops_cli/roadmap/refine_investigation.py:285]
    • Chosen: Add repository and reason to the existing warning format. The body's expected behavior names the repository and a reason that holds no model text. Adding two fields to the existing format is the minimal change that satisfies the operator's need.
    • Rejected: Replace the warning with a structured log (JSON). Rejected. The Service already uses plain-text warnings. Changing to structured logging is a larger change that affects all log consumers and is not asked for by the body.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    status/new
    value/medium
    effort/low
    on Oct 28, 2026
  2. dan-petty commented on Oct 28, 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 warnings omit the repository name and the failure reason, which is a defect in the logging output.
    • Priority: P2-Medium. Operators cannot distinguish a gateway timeout from a bad model reply, which hampers incident response but does not break the service.
    • Value: Medium. Better warnings let an operator trace a failure to its repository and cause, reducing mean time to resolution.
    • Effort: Low. The code already sorts errors in _refine_error and pydantic-ai exposes a message attribute; the fix adds two fields to existing log lines.
    • Related: fix(roadmap): refine records an item whose model call failed or whose body would exceed the size limit, so it waits for a body change instead of being retried every poll #1526, which asks for a different change. Both address refine's handling of model call failures, but #1526 records state to prevent re-polling while the candidate improves the warning message content.
  3. added
    priority/p2-medium
    on Oct 28, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 29, 2026
  5. devops-cli-service commented on Oct 29, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at a3eb41f (see proposed design in issue body).

  6. added
    scope/roadmap
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Oct 30, 2026
  7. removed
    status/in-review
    on Oct 30, 2026
  8. added a commit that references this issue 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

    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