Skip to content

fix(roadmap): an implement step stops when Ollama cannot parse a qwen3-coder tool call, and the stop hides the cause #2922

Description

@dan-petty

What happened

The implement Job for #2747 (a manual runner Job devops-cli-runner-20261031-194509-b3ab) stopped at group 1 with:

ModelHTTPError: HTTP 400, model devops-coder, body: litellm.BadRequestError: Ollama_chatException - KeyError: <text>, Got unexpected response from Ollama: {<text>: <text>}
Refused commands: cd 2, python 1. Other retries: 0.

The pod log of ollama-48gib (condor) shows the cause twice in 11 seconds:

19:47:38 level=WARN source=qwen3coder.go:87 msg="qwen tool call parsing failed" error="XML syntax error on line 50: unexpected EOF"
19:47:49 level=WARN source=qwen3coder.go:87 msg="qwen tool call parsing failed" error="XML syntax error on line 70: unexpected EOF"

The model wrote a tool call as XML, and the XML stopped before it closed. Ollama's parser for qwen3-coder refused the call and answered with an error, which the gateway turned into HTTP 400. The resend of #2797 ran once (the second line) and failed the same way, so the step stopped and discarded its work. The same error stopped #2656 on 2026-10-30 (#2794 was filed for it; its fix shows the body and resends once, and the first part now hides the real cause, because the masked body text reads <text> for every quoted word, so the stop comment no longer says "XML syntax error").

In both cases the call was a large edit or a new file with code in it. The first success of #2735 and #2739 had small edits.

What should happen

  • Find why the call ends early. Check, with evidence: the Ollama version and its release notes and issue list for qwen3coder.go parse failures; whether the file content (angle brackets, &, ]]>, a long line) breaks the parser; whether the model emits EOS inside the call (a sampling setting such as repeat_penalty, temperature or stop tokens in the model file); and whether devops-chat (qwen3.8) does not fail on the same step.
  • The stop comment keeps the cause words of a provider error: the masker keeps the exception class and the text up to the first colon-separated clause, and hides only values that look like secrets.
  • Fix at the cause: an Ollama update or a model setting, or a fallback of the step to another model route after the second parse failure, or a smaller edit rule in the step prompt. State the choice with the measurement (replay the failing step against each option).

Evidence

Acceptance criteria

Proposed design

Problem statement

The implement step stops when Ollama's qwen3-coder parser rejects a tool call with an XML syntax error. The gateway turns the error into HTTP 400 and the masker replaces the cause words with a placeholder. The step discards its work and the stop comment no longer says what failed. This happened on #2747 and #2656, always with large edits or new files that contain code.

Acceptance criteria

Requirement: Cause identification

The proposal SHALL name the root cause of the XML parse failure with a reproduction or state that it is not reproducible.

Scenario: Cause documented in stop comment

  • WHEN The implement step encounters a qwen3-coder tool call parse failure
  • THEN The stop comment or the proposal names the specific cause with evidence, such as truncated XML, max output tokens, or a parser buffer limit

Requirement: Error cause visibility

The stop comment SHALL preserve the exception class name and the text up to the first colon-separated clause of a provider error.

Scenario: Masker preserves cause words

  • WHEN The gateway returns an HTTP 400 with a provider error body that contains an exception class and a cause clause
  • THEN The stop comment shows the exception class and the cause clause in plain words, and hides only values that match a secret pattern

Requirement: Step completion

A replay of the failing step SHALL end done, or the proposal SHALL state why it cannot.

Scenario: Replay of #2747 step

Requirement: CI gate

The command uv run devops ci SHALL pass on the branch that delivers this change.

Scenario: CI passes on the fix branch

  • WHEN The pull request for this change is opened
  • THEN All required checks report a passing status

Existing Tool Considered

No alternatives check has run. The existing tools are Ollama (model server) and LiteLLM (gateway). The fix modifies the project's own error-handling and routing code. The written cost is approximately 400 tokens of Python for the fallback retry loop and 100 tokens for the masker fix, plus the elapsed time to replay the failing step and verify the stop comment.

Key questions

  • How should the stop comment preserve the cause of a provider error?: The masker keeps the exception class name and the text up to the first colon-separated clause. It hides only values that look like secrets, such as tokens, keys, or passwords. (proposed)
  • What is the fix strategy for the parse failure?: Add a fallback to another model route after the second parse failure, and fix the error masking. Investigate the Ollama version and model settings as a secondary measure. Replay the failing step against each option to measure the result. (proposed)
    • Rejected: Update Ollama. Depends on an upstream release. Does not guarantee the parser handles all large tool calls.
    • Rejected: Adjust model settings such as repeat_penalty, temperature, or stop tokens. May reduce the frequency of truncation but does not eliminate it. The model may still truncate a large tool call.
    • Chosen: Fallback to another model route after the second parse failure. Resilient regardless of the Ollama version. The step completes with a working model. A standard resilience pattern.
    • Rejected: Smaller edit rule in the step prompt. Reduces the chance of truncation but does not handle the case where the model still truncates. Less robust than a fallback.

Open questions

  • What causes the qwen3-coder tool call to end before its XML closes? (missing verified source)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Oct 31, 2026
  2. dan-petty commented on Oct 31, 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: P1-High. A recurring production failure blocks implement steps on multiple roadmap items.
    • Value: High. It prevents implement steps from completing and hides the true cause from operators.
    • Effort: Medium. Requires investigating Ollama parser, model settings, a possible fallback, and the masker logic.
    • Related: fix(roadmap): a model call that Ollama refuses for a broken tool call ends the step with no cause #2794, which asks for a different change. Both address Ollama tool-call parse failures hiding the cause, but #2794 delivered showing the body once, while the candidate asks to keep cause words in the masker and fix the root cause at Ollama or model level.
  3. added
    priority/p1-high
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Oct 31, 2026
  4. removed
    status/in-review
    on Oct 31, 2026
  5. added a commit that references this issue on Oct 31, 2026
  6. devops-cli-service commented on Oct 31, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 84c8db0 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • What causes the qwen3-coder tool call to end before its XML closes? (missing verified source)
  7. added a commit that references this issue on Nov 1, 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/p1-highscope/roadmapsource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions