Repository navigation
Description
Problem
Refine does not work reliably on local/qwen3.8:27b. From 00:07Z to 03:08Z on 2026-11-16 (release 0.159.0), refine ran on the local model. 4 of its 15 results in that window stopped with no proposal:
Refine's investigation of #4895 ... stopped with no proposal (UnexpectedModelBehavior: Tool <text> exceeded max retries count of 2. Consider raising the retry limit, or see the docs on tool retries).
The same error stopped #4895 (01:06Z), #4899 (01:18Z and 02:07Z) and #4904 (02:50Z). The log masks the tool name (<text>), so the log does not show if the output tool or a function tool failed. Refine allows 2 retries for a tool and for its output (CONST_ROADMAP_REFINE_INVESTIGATION_RETRIES, src/devops_cli/config/constants.py; refine_investigation.py, retries={"tools": ..., "output": ...}). Refine went back to DeepSeek at 03:08Z (#5909). On DeepSeek, refine had 103 of 120 in 24 hours with no such error.
Owner, 2026-11-16: investigate why refine does not work on the local model. Refine stays on DeepSeek until then.
Expected behavior
The investigation answers, with evidence:
- Which tool fails: the output tool (the structured reply) or a function tool. Use the Tempo traces of the four runs, or a replay.
- What the model sent: invalid JSON arguments, a missing field, a wrong type, text in place of a tool call, or a tool name that does not exist.
- Whether the cause is the model, the Ollama tool-call template of the model, the output mode of pydantic-ai (tool output against
NativeOutputorPromptedOutput), the schema of the refine reply, or the retry limit of 2. - Whether the same items pass on
local/qwen3.8:27bwith a changed output mode or a higher retry limit, in a replay (devops roadmap evalor a local run against the gateway) that compares the results with DeepSeek on the same items.
The result is a short report on this issue and, for each cause, a fix item or a change of the model choice. Also file the masked tool name in the log as its own fix if the log must name the tool.
Related
- fix(roadmap): each job reads a model setting of its own #5909 (a model for each job), fix(k8s): alternatives returns to DeepSeek #5934 (alternatives back to DeepSeek), fix(roadmap): each job reads a model setting of its own #5903.
Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: pydantic/pydantic-ai (https://github.com/pydantic/pydantic-ai), MIT, last activity 2026-11-24, maintained.
Reason: Searches found no diagnostic or tracing tool for this failure; the agent framework that raises the retry error, sets the per-tool limit, offers the output modes and provides the offline test double is the one the project already uses.
Covers:
- Per-tool retry limit that raises the retry error
- Selectable structured output: tool call, NativeOutput, PromptedOutput
- FunctionModel test double reproduces the stop with no live model
- Ollama models reachable through the gateway
Lacks:
- Stop text names no registered tool names or output mode
- No trace analysis of the four historical runs
- No replay that compares the local model with DeepSeek
- No check of the model's Ollama tool-call template
Proposed design
Problem statement
Refine stops on local/qwen3.8:27b with UnexpectedModelBehavior: Tool <text> exceeded max retries count of 2, and 4 of its 15 results in that window stopped with no proposal. The stop text does not say which tool failed or what the model sent, so the cause stays unknown, and refine stays on DeepSeek. This change makes the stop text answer those questions on the next run. It moves the reading of the four historical runs to its own item.
Acceptance criteria
Requirement: The refine stop names the tool
The refine investigation MUST write the name of the tool that exceeded its retry limit, and the tool names that it registered, into the stop reason.
Scenario: A model calls a tool that the investigation did not register
- WHEN the investigation runs against a pydantic-ai
FunctionModelthat returns a tool call named<text>on every turn - THEN the stop reason holds the name
<text>and the list of the tool names that the investigation registered.
Requirement: The refine stop records the output mode and the parts
The refine investigation MUST write its structured-output mode and the kind of each part of the last model response into the stop reason.
Scenario: The model returns text in place of the output call
- WHEN the investigation runs with
NativeOutputagainst aFunctionModelthat returns a text part and no output tool call - THEN the stop reason states the output mode
NativeOutputand the part kindtext.
Existing Tool Considered
pydantic-ai (https://github.com/pydantic/pydantic-ai), verdict in-use; the alternatives check in this issue body lists what it covers and lacks. The proposal keeps its per-tool retry limit, its output modes and the retry error as they are. It adds the registered tool names, the output mode and the part kinds to the stop reason, which the tool does not record, and it reproduces the stop with the FunctionModel test double of the tool. The tool gives no trace analysis, no model-comparison replay and no check of the Ollama template; the deferred item reads the traces and runs the replay.
Key questions
- How does the refine investigation report which tool exceeded its retries?: Catch
UnexpectedModelBehaviorinrefine_investigation.py. Write a stop that holds the exception text, the tool names that the investigation registered and the kind of each part of the last model response. Do not parse the tool name out of the message. (best practice) [sources: src/devops_cli/roadmap/refine/refine_investigation.py]- Chosen: Stop text with the registered tool names. The message names the tool as the model sent it, and the registered names show at once whether that name exists.
- Rejected: Parse the tool name out of the exception message. The message format belongs to pydantic-ai, and a change of that format breaks the parse.
- Rejected: Log the exception at DEBUG and keep the current stop. The Service keeps no DEBUG line of a stopped run, so the next run answers nothing.
- How does a test reproduce the stop with no live model?: Use the
FunctionModeltest double of pydantic-ai. It returns a fixed response on every turn, so the test needs no gateway and no Ollama host. (best practice) [sources: src/devops_cli/roadmap/refine/refine_investigation.py]- Chosen:
FunctionModeltest double. It runs offline, and it gives the exact tool name and part kinds that the test asserts. - Rejected: A recorded HTTP cassette of the gateway. It pins one private answer and breaks when the model or its template changes.
- Rejected: A live run against the gateway. CI has no gateway and no
local/qwen3.8:27b.
- Chosen:
- Does this change raise the retry limit of 2?: No. The tool limit and the output limit stay at the value of
CONST_ROADMAP_REFINE_INVESTIGATION_RETRIES. A higher limit delays the same stop, and no evidence shows that the model sends a different call at a higher count. (best practice) [sources: src/devops_cli/config/constants.py:3457]- Chosen: Keep the limit of 2 and record the failure. The stop text then shows the tool, the mode and the parts, and the deferred replay decides if the limit matters.
- Rejected: Raise the limit to 5. The four runs stopped at the limit, and no evidence shows that more retries change the call of the model.
- Rejected: Make the limit a setting. No evidence yet that another value helps, and a new setting needs a default and a document.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
Both target the local qwen3.8 model in the roadmap subsystem, but #3956 runs a verification pass while the candidate investigates why refine stops on that model.devops-cli-service commentedon Nov 17, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 18, 2026
Status set to Ready at c49fd02 (see proposed design in issue body).
Moved to new items: #6305.
fix(roadmap): log tool, mode, and parts on refine stop (#5991)
fix(roadmap): type investigate output_type without type ignore (#5991)
chore(main): release 0.219.0 (#7177)
devops-cli-service commentedon Nov 25, 2026
Released in v0.219.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.219.0
devops-cli-service commentedon Nov 25, 2026
Live since 2026-11-25 17:09 UTC