Skip to content

fix(roadmap): an implement step that stops on UnexpectedModelBehavior hides the cause and logs no tool call #2758

Description

@dan-petty

Problem or Motivation

The first end-to-end implement run on #2656 (Job devops-cli-runner-20261030-034947-9476, 2026-10-30) stopped after about four minutes with this reason:

Stopped at group 1. Reason: UnexpectedModelBehavior. Last message of the agent: Let me run the test directly in the project directory:

The reason holds only the class name of the exception. implement_step.py builds it with type(stopped).__name__ for UsageLimitExceeded and UnexpectedModelBehavior. The message of the exception names the real cause, for example that a tool exceeded its retries (CONST_ROADMAP_IMPLEMENT_TOOL_RETRIES is 5) or that the model's output was invalid. The Job log holds only the summary, with no line for a tool call, so a person cannot tell which of these happened. The diff that the stop comment now shows (#2744) is a scratch test script and no fix, which fits a model that kept calling a command the shell refused, but nothing proves it.

Proposed Solution & Architectural Design

  • The stop reason holds the class name and the message of the exception, masked with mask_secrets and cut to a constant size. The existing cut of the reason (CONST_ROADMAP_IMPLEMENT_REASON_CHARS) applies.
  • The Job log gets one line for each tool call of the agent: the tool name, the first word of a shell command, and the outcome (ok, refused with the reason, or retry). The line holds no file content and no output. It is the evidence a person needs when a step stops.
  • A refused shell command and a tool that raises a retry are counted apart in the stop reason: "N refused commands, M other retries", so the person sees at once when the model keeps asking for a program that the allowlist refuses.

Target Subsystem

src/devops_cli/roadmap/implement_step.py, src/devops_cli/roadmap/implement_run.py, src/devops_cli/lang/en/messages.py.

Existing Tool Considered

pydantic-ai's run messages (capture_run_messages, already used by the refine investigation) and its capability hooks for tool calls (Hooks with before_tool_execute or after_tool_execute, as the project's spend capability uses after_model_request). Nothing new is built.

Acceptance criteria

  • With the model faked as a pydantic-ai FunctionModel, a model that calls a refused program until the retry limit ends the step stopped, and the reason holds the exception's message and the count of refused commands.
  • A secret-looking string in the exception message is masked in the reason.
  • A step logs one line per tool call with no file content.
  • uv run devops ci passes, and devops docs generate --sync-readme is run.

Evidence: Job devops-cli-runner-20261030-034947-9476 and the stop comment on #2656 at 03:54 UTC.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Oct 30, 2026
  2. dan-petty commented on Oct 30, 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. Operators cannot diagnose why an implement step stopped, but the step still halts safely and no data is lost.
    • Value: Medium. Faster diagnosis of implement step failures reduces operator time, but it does not change user-facing behaviour.
    • Effort: Medium. Three files change, the design is specified, and pydantic-ai hooks already exist, but masking, counting, and log formatting add work.
    • Related: 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, which asks for a different change. Both fix vague failure reasons that show only the exception class name, but #2562 targets refine warnings while the candidate targets the implement step stop reason and adds tool-call logging.
  3. added
    priority/p2-medium
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Oct 30, 2026
  4. removed
    status/in-review
    on Oct 30, 2026
  5. 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/mediumpriority/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