Repository navigation
Description
Split from #5991.
Problem | Four refine runs on local/qwen3.8:27b stopped on 2026-11-16 with UnexpectedModelBehavior: Tool <text> exceeded max retries count of 2: #4895 at 01:06Z, #4899 at 01:18Z and 02:07Z, and #4904 at 02:50Z. The stop text does not say which tool failed or what the model sent. | ## Why deferred | The answer needs the Tempo traces of the four runs and a replay on the host that serves local/qwen3.8:27b. Neither is in this repository, and the implement job cannot query Tempo or load the model. The stop text of the next run now answers the same questions, and that part stays in the parent item. | ## Acceptance criteria | - The issue holds a short report that names the tool that failed in each of the four runs. | - The report names 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. | - The report names the cause: the model, the Ollama tool-call template of the model, the output mode of pydantic-ai, the schema of the refine reply, or the retry limit of 2. | - The report compares the same items on local/qwen3.8:27b and on DeepSeek, with a changed output mode and with a higher retry limit. | - Each cause that has a fix gets its own issue, and a change of the model choice gets its own issue.
Proposed design
Problem statement
Four refine runs on local/qwen3.8:27b stopped on 2026-11-16 with UnexpectedModelBehavior: Tool <text> exceeded max retries count of 2. The stop text hides the tool name and the model output. The item needs a report that names the failing tool, the model output and the cause. The Tempo traces and the replay host are outside this repository, so the item is blocked until a person with access provides them.
Acceptance criteria
Requirement: Failing tool of each run
The diagnosis report SHALL name the tool that the last execute_tool span of each of the four runs used.
Scenario: One trace names its last tool call
- WHEN
uv run devops telemetry profile --trace-id <id> --format jsonruns for the trace of one of the four runs - THEN The output lists the
execute_tool <tool>spans, and the report names the last span as the failing tool.
Requirement: Model output of each run
The diagnosis report SHALL name the model output: invalid JSON, a missing field, a wrong type, text not a tool call, or an unknown tool.
Scenario: The replay records the model reply
- WHEN The same item is replayed on the host that serves
local/qwen3.8:27bwithtelemetry.capture_llm_contentset to true - THEN The report names one of the five kinds for that run and quotes the masked reply.
Requirement: Cause of each stop
The diagnosis report SHALL name one cause of each stop: the model, the Ollama template, the output mode, the reply schema, or retry limit 2.
Scenario: One cause for one run
- WHEN The trace and the replay of one run are read
- THEN The report states one cause of the five for that run and the evidence that shows it.
Requirement: Comparison across models and settings
The diagnosis report MUST compare the same items on local/qwen3.8:27b and on DeepSeek, with PromptedOutput in place of ToolOutput and with a higher retry limit.
Scenario: Each item runs under each setting
- WHEN The same item runs on each model with
PromptedOutputand withCONST_ROADMAP_REFINE_INVESTIGATION_RETRIESraised above 2 - THEN The report shows the answer or the stop of each item for each of the four settings.
Requirement: One issue for each fix
The diagnosis report SHALL lead to one open issue for each fixable cause, and one for a model change.
Scenario: The follow-up issues exist
- WHEN The report names each cause and the model choice
- THEN Each fixable cause has one open issue that names it, and a model change has one open issue.
Existing Tool Considered
No alternatives check has run. Grafana Tempo is the open, maintained trace store that holds the four runs. The project already reads one trace with uv run devops telemetry profile --trace-id <id> --format json (src/devops_cli/commands/telemetry.py, src/devops_cli/telemetry/waterfall.py). Tempo lacks the raw model reply. The pydantic-ai spans keep the tool names and omit the text of prompts, replies and tool arguments unless telemetry.capture_llm_content is true (docs/TELEMETRY.md, docs/CONFIGURATION.md). No tool in the repository replays a model on that host. The item builds no code, so it has no build cost.
Key questions
- What does Tempo record by default about a tool call?: Each tool call makes an
execute_tool <tool>span. The pydantic-ai spans keep the tool names and the part types by default. They omit the text of prompts, replies and tool arguments unlesstelemetry.capture_llm_contentis true. [sources: docs/TELEMETRY.md, docs/CONFIGURATION.md, src/devops_cli/telemetry/library_spans.py] - Where does the refine investigation set the tool retry limit that the stop text reports as 2?:
CONST_ROADMAP_REFINE_INVESTIGATION_RETRIESis 2 atsrc/devops_cli/config/constants.py:3740. The refine investigation uses it as the retry limit of its tools insrc/devops_cli/roadmap/refine/refine_investigation.py. [sources: src/devops_cli/config/constants.py:3740, src/devops_cli/roadmap/refine/refine_investigation.py] - Does the diagnosis read the traces of the four past runs, or add a log line and wait for a new run?: Read the four past traces. The four stops are past events, and only their traces show the tool that each run called. The parent item fix(roadmap): Find why refine stops on the local qwen3.8 model #5991 owns the stop-text change, so this item adds no log line and waits for no new run. (best practice) [sources: docs/TELEMETRY.md, src/devops_cli/roadmap/agent_run.py]
- Chosen: Read the Tempo traces of the four runs. The four stops are past events. The
execute_tool <tool>spans name the tool of each run, and the parent item owns the stop-text change. - Rejected: Add a log line that names the tool and the model text, and wait for a new run. The parent item fix(roadmap): Find why refine stops on the local qwen3.8 model #5991 holds the stop-text change, and a new run cannot show what the four past runs sent.
- Chosen: Read the Tempo traces of the four runs. The four stops are past events. The
- Which output mode of pydantic-ai does the comparison change, and which mode does production keep?: Keep pydantic-ai's default
ToolOutputin production. Replay withPromptedOutputonly as a trial. Do not useNativeOutput: the gateway sends the schema to Ollama asformat, so the model can call no tool. (best practice) [sources: openspec/changes/archive/2026-10-28-2398-refine-investigates-questions/design.md, src/devops_cli/ai/client/network.py, src/devops_cli/roadmap/refine/refine_investigation.py]- Chosen: Keep
ToolOutputand usePromptedOutputonly in the comparison. The archive records thatqwen3.8:27bwrote its tool calls as JSON text underPromptedOutputand thatNativeOutputprevents tool calls, so production stays on the mode that works. - Rejected: Switch the production refine to
PromptedOutput. The archive records thatqwen3.8:27bwrote its tool calls as JSON text under this mode and the run failed. - Rejected: Switch the production refine to
NativeOutput. The gateway sends the schema to Ollama asformat, so the model could call no tool.
- Chosen: Keep
- Does the diagnosis raise the tool retry limit of 2, or keep it and raise it only in the replay?: Keep 2 in production and raise it only in the replay. The limit is a guard that stops a model that calls a tool the run does not offer. The archived record of feat(roadmap): the stage job plans with a read-only investigation toolbox #3037 shows the same stop on the third call after the tools are gone, so a higher limit only lets a broken call loop longer. (best practice) [sources: src/devops_cli/config/constants.py:3740, openspec/changes/archive/2026-11-02-3037-the-stage-job-plans-with-a/design.md]
- Chosen: Keep 2 and raise it only in the replay. The constant guards against a model that calls a tool the run does not offer, and the replay is where a higher limit answers the question.
- Rejected: Raise the tool retry limit for every refine run. The archive shows the same stop on the third call after the tools are gone, so a higher limit only delays it.
- Rejected: Make the tool retry limit a setting now. The diagnosis has not shown that the limit is the cause, and a setting adds configuration before the evidence.
Fit
Fits in one pull request.
Suspected block
The Tempo traces of the four runs of 2026-11-16 and a replay on the host that serves local/qwen3.8:27b: the implement job can reach neither.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 18, 2026
Both address refine stopping on local/qwen3.8:27b, but #5991 fixes the stop text while this item produces a diagnostic report from Tempo traces and a replay.[-]fix(roadmap): Diagnose the refine retry stop on local/qwen3.8:27b from the Tempo traces and a replay[/-][+]fix(roadmap): Diagnose the refine retry stop on local/qwen3.8:27b[/+]devops-cli-service commentedon Nov 18, 2026
The job shortened the title of this item. The summary had 86 characters, and the limit is 60. The type and the scope stay.
fix(roadmap): Diagnose the refine retry stop on local/qwen3.8:27b from the Tempo traces and a replayfix(roadmap): Diagnose the refine retry stop on local/qwen3.8:27bdevops-cli-service commentedon Nov 19, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 27, 2026
Owner question: See Suspected block in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence