Repository navigation
Description
Problem Description
devops roadmap eval verify stops a case with a connection reset during the read of a model reply, and a resume of the same case fails the same way. On 2026-11-13, case 2169-the-qdrant-retry-the-process-fake failed 4 times in a row from one checkout (17:41Z, 17:43Z, 17:50Z and 18:20Z), each time with:
AIClientError: The investigation's model call failed (ModelConnectionError, phase read, ConnectionResetError: [Errno 104] Connection reset by peer).
The run of the same case from the checkout of the branch of #5411, which does not change the AI client, ended with no error between 17:52Z and 18:17Z. That run made a call of 230.9 s with 12,537 output tokens, so the streaming path holds a long call.
Reproduction Steps
uv run devops roadmap eval verify --case 2169 --model deepseek-v4.1-flash-1017- If the case fails, run the command again with
--resume <report>.
The failure is intermittent. It came after 0, 1 and about 25 model calls of the case.
Expected vs Actual Behavior
Expected: the agent run of the case ends, or the error names the cause of the reset (the edge, the gateway or the upstream provider).
Actual: the case ends failed with a reset in the phase read, and the resume starts the agent run of the case again from its first call.
Environment Diagnostics
- DevOps CLI Version: 0.130.0 (origin/main 59d140d)
- The log of the gateway container
litellmholds nochat/completionsline other than200 OKfrom 17:23Z to 17:52Z. - The local spend records hold no call longer than 104 s before a failure.
Related
#4345 (closed: the error now names the class and the text of the cause), #4753 (a short connect failure stops intake).
Alternatives check of 2026-11-26: in-use.
The repository already uses this tool.
Tool: tenacity (https://pypi.org/project/tenacity), Apache-2.0, last activity 2026-10-07, maintained.
Reason: Searches found no tool that resumes an eval run at the first call without a result; tenacity, already used by the project, supplies only the retry, backoff and stop budget, so the per-call records and the resume stay project code.
Covers:
- Retry policy for a failed attempt
- Exponential backoff between attempts
- Stop budget of attempts and elapsed time
Lacks:
- No per-call result record in the verify eval report
- No resume that starts at the first call with no result
- No replay of a stream cut after its first event
- No call index in the raised error
Proposed design
Problem statement
devops roadmap eval verify ends a case as failed when the read of a streaming model reply stops with ConnectionResetError in the read phase. The error already names the phase and the class of the cause, but a resume of the case starts the agent run at its first model call, so the work of the completed calls is lost. The project gives the gateway the retries and the fallbacks and sends a gateway call again only when it never reached the gateway or its stream failed before its first event, so a reset after the first event ends the call once and is not replayed. The change records the result and the index of each completed model call in the report and starts a resume at the first call with no result, and it names the index of the call that failed.
Acceptance criteria
Requirement: Record each completed model call
The verify eval report SHALL record the result and the call index of each model call that the agent run of a case completes.
Scenario: A completed call is in the report
- WHEN the agent run of a case completes its first model call in
tests/roadmap/stage/test_roadmap_stage_verify_eval.py - THEN the test asserts that the report holds one record for that call with its call index and its result.
Requirement: Resume at the first call with no result
devops roadmap eval verify --resume <report> SHALL start the agent run of a case at the first model call that has no recorded result in the report.
Scenario: Resume after a completed first call
- WHEN a report holds a result for the first model call of a case and no result for the second call in
tests/roadmap/stage/test_roadmap_stage_verify_eval.py - THEN the test asserts that the run sends the second call first and sends no request for the first call.
Requirement: Name the read reset cause
When a model call fails with a connection reset in the read phase, the raised AIClientError MUST hold the phase, the class of the cause and the index of the call.
Scenario: A read reset names its call
- WHEN a fake agent model raises a connection reset in the read phase on the third model call of a case in
tests/roadmap/stage/test_roadmap_stage_verify_eval.py - THEN the test asserts that the error text holds
ModelConnectionError,phase read,ConnectionResetErrorandcall 3.
Requirement: No replay after the first event
A model call that fails after its stream emitted its first event MUST end once, with no replay.
Scenario: A stream cut after the first event
- WHEN a fake gateway answers a streamed call with status 200, one chunk of text and then a cut connection in
tests/ai/models/test_gateway_call.py - THEN the test asserts that the run raises
ModelConnectionErrorwith phasereadand that the gateway received one call.
Existing Tool Considered
tenacity (https://pypi.org/project/tenacity), verdict in-use: the repository already uses it (src/devops_cli/ai/retries/__init__.py:15). It covers the retry, the backoff and the stop budget of the direct client transport. The alternatives block of the issue names what tenacity lacks; the change builds those parts itself, because they are the eval report and the resume, not a retry policy. Written cost for the per-call record and the resume: about 30,000 output tokens to build, about 2,000 output tokens a month to keep and fix, and about 2 hours of elapsed time.
Key questions
- Does the AI client retry a connection reset in the read phase today?: It retries a reset before the first event: a stream that the gateway cuts before its first event, an error frame before its first event, or a connect that fails, gets one more send (
tests/ai/models/test_gateway_call.py:112). It does not replay a stream that emitted its first event: a cut after the first event raisesModelConnectionErrorwith phasereadafter one call (tests/ai/models/test_gateway_call.py:149), as the current spec requires (openspec/specs/ai-agent-stream-retry/spec.md:23). The issue's error is that post-first-event case, so the agent run needs the per-call resume, not another retry. [sources: tests/ai/models/test_gateway_call.py:112, tests/ai/models/test_gateway_call.py:149, openspec/specs/ai-agent-stream-retry/spec.md:23, src/devops_cli/ai/models/gateway.py:53, src/devops_cli/ai/client/unified.py:1131] - Where should the model call of a verify eval case be retried after a read-phase reset?: It should not be retried automatically after the first event. The client retries a call before its first event (
src/devops_cli/ai/models/gateway.py:53), and the gateway owns the retries and the fallbacks of a call (k8s/llm/gateway/config.yaml:344). A failure after the first event ends the call once, as the project's spec records (openspec/specs/ai-agent-stream-retry/spec.md:23). The verify eval records each completed model call and resumes at the first call with no result, so the completed work is not lost and the failed call is sent again only as a new run. (best practice) [sources: openspec/specs/ai-agent-stream-retry/spec.md:23, src/devops_cli/ai/models/gateway.py:53, k8s/llm/gateway/config.yaml:344, src/devops_cli/roadmap/stage/stage_verify_eval.py:373]- Chosen: Record each completed call and resume at the first call with no result. It does not add a second retry layer, it keeps the project's no-replay rule, and it loses no completed call of the case.
- Rejected: Retry the whole model call in the agent run. It is a second retry layer above the gateway and the client, it repeats the tool calls of the run, and it contradicts the project's one-retry-layer decision (fix(ai): one retry layer for a gateway call #5965).
- Rejected: Retry inside the AI client stream. The client already sends a reset before the first event again, and the project's spec forbids a replay after the first event.
- Rejected: Rely on the gateway fallback. LiteLLM does not retry or fall back inside a stream after its first event; the fallback covers a call that the group cannot answer before the stream.
- How does the report record the model calls of a case?: The report records the result and the call index of each completed model call. A resume reads the records and starts at the first call index with no result. The current report holds one outcome for each case, so the change adds the per-call records to that outcome and to the resume reader (
src/devops_cli/roadmap/stage/stage_verify_eval.py:373). (best practice) [sources: src/devops_cli/roadmap/stage/stage_verify_eval.py:373, src/devops_cli/roadmap/stage/stage_verify_eval.py:401, tests/roadmap/stage/test_roadmap_stage_verify_eval.py]- Chosen: One record for each completed call. A resume finds the exact call that failed and repeats no completed call.
- Rejected: One record for each case. A resume cannot tell which call failed, which is the current behavior.
- Rejected: Restart the whole agent run on resume. It repeats completed calls and can hit the same reset again.
- Which open, maintained tool supplies the retry, the backoff and the stop budget?: tenacity (https://pypi.org/project/tenacity), Apache-2.0, last activity 2026-10-07, maintained, verdict in-use: the repository already uses it (
src/devops_cli/ai/retries/__init__.py:15). It supplies the retry, the backoff and the stop budget of the direct client transport; the per-call report record and the resume are code of this project. (best practice) [sources: https://pypi.org/project/tenacity, src/devops_cli/ai/retries/init.py:15]- Chosen: tenacity. The repository already uses it, and it supplies the retry, the backoff and the stop budget.
- Rejected: A hand-written retry loop. It duplicates a maintained library that the repository already uses.
- Rejected: The LiteLLM router retries. The gateway owns the retries and the fallbacks of a call, but it does not retry a stream after its first event.
- Should the change add a LiteLLM fallback group for deepseek-v4.1-flash-1017?: No. The gateway already falls back from
deepseek-v4.1-flash-1017todeepseek-v4.1-flashthrough the same provider and the same filters (k8s/llm/gateway/config.yaml:397,SECURITY.md:40). The fallback covers a call that the group cannot answer before the stream; LiteLLM does not retry or fall back inside a stream after its first event (k8s/llm/gateway/config.yaml:344). The change leaves the gateway fallback as it is and resumes at the first call with no result. (best practice) [sources: k8s/llm/gateway/config.yaml:397, k8s/llm/gateway/config.yaml:344, SECURITY.md:40]- Chosen: Leave the gateway fallback as it is. The fallback already exists, and a mid-stream reset is not covered by a fallback that LiteLLM does not run.
- Rejected: Add another fallback group. It duplicates the existing fallback and does not cover a reset after the first event.
- Rejected: Rely on the gateway alone. The gateway log holds only 200 OK, and LiteLLM has no retry or fallback inside a stream after its first event.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both target ModelConnectionError in the verify eval, but #4345 fixed the error message format while the candidate asks for the case to complete or name the reset edge.dan-petty commentedon Nov 13, 2026
More evidence from 2026-11-13 18:26Z to 18:37Z, with the same command on two other cases from the checkout of the branch of #5411:
AIClientError: The investigation's model call failed (ModelServerError).At 18:37Z the log of the gateway containerlitellmholds429 Too Many RequestsforPOST /v1/chat/completions. The cause in the log israte_limit_exceededfrom the upstream provider ofdeepseek-v4.1-flash-1017(limit_source: upstream_provider_shared_pool), after 5 retries of LiteLLM, and the gateway has no fallback group for this model.ConnectionResetErrorin the phaseread.So the resets came in the same period as the rate limit of the shared upstream pool. A check of the cause can compare the time of each reset with the 429 lines of the gateway.
devops-cli-service commentedon Nov 18, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
devops-cli-service commentedon Nov 20, 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 21, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
chore(main): release 0.247.0 (#7752)
devops-cli-service commentedon Nov 29, 2026
Released in v0.247.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.247.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:17 UTC