Repository navigation
Description
Problem or Motivation
On 2026-11-10, five processes of devops roadmap eval verify --model deepseek-v4.1-flash-1017 ran at the same time against the gateway. 6 of 48 cases ended with AIClientError: The investigation's model call failed (ModelConnectionError), and the other 42 cases ended. A case that fails this way costs a full run again (about 0.18 USD and 5 to 10 minutes), because the run keeps nothing of the agent loop. The failed cases were 2531, 2524, good-3410, 2554, 2526 and 2559; each of them ran again with no error, so the cause is not the case.
Proposed Solution & Architectural Design
Find the cause before any change: read the gateway log and the client log for the times of the failures (the reports in .data/roadmap_eval/verify/ name the files), and decide if the failure is a connection limit of the gateway, a timeout of a long agent loop, or a stale connection of the client (#4319 describes a closed event loop in the Jev client; check if the agent client has the same problem). The fix is at the cause. If the cause is outside the project, add a check that fails when the problem returns, and do not add a retry that hides it.
Target Subsystem
src/devops_cli/ai/client, the LLM gateway, devops roadmap eval verify.
Existing Tool Considered
The client library (pydantic-ai with httpx2) and the gateway log. No new tool. Cost: the time to read two logs; the fix is unknown until then. Related: #4319, #4282.
Standards Compliance
- I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
- I am willing to submit a pull request implementing this feature with accompanying tests.
Proposed design
Problem statement
In one run of devops roadmap eval verify with five parallel processes, 6 of 48 cases ended with AIClientError: The investigation's model call failed (ModelConnectionError). Each failed case costs a full run again, about 0.18 USD and 5 to 10 minutes, because nothing of the agent loop is kept. The error text names only the class ModelConnectionError, so the cause cannot be read from it. The cause may be a gateway connection limit, a timeout of a long agent loop, or a stale connection of the agent client, as in #4319. The gateway log and the client log are not in the repository, so a person or the job that has them must read them.
Acceptance criteria
Requirement: Connection failure names its cause
model_call_error SHALL include the class name and the text of the underlying connection error, masked and cut, in the message of an AIClientError for a failed model call.
Scenario: Connection reset in the model call
- WHEN a
ModelConnectionErroris raised whose__cause__is an httpx error with a known text, such as a remote protocol error 'Server disconnected without sending a response' - THEN the
AIClientErrormessage contains the class name of the cause and its text, and contains no text of a model reply
Requirement: Client survives a new event loop
The agent client MUST NOT reuse a pooled connection that belongs to a closed event loop.
Scenario: Two runs in two event loops
- WHEN a test runs the agent against a local fake gateway in one event loop, closes that loop, and runs it again in a new loop with the same client factory
- THEN the second run ends with no
ModelConnectionError
Requirement: Cause is guarded by a check
The change SHALL add a test that fails when the confirmed cause of the failure returns.
Scenario: Confirmed cause returns
- WHEN the test reproduces the confirmed cause offline, such as a stale or limited connection to a fake gateway
- THEN the test fails on the base commit and passes on the fixed code
Requirement: No retry that hides the cause
The fix SHALL NOT add a blind retry of a failed model call that hides a cause outside the project.
Scenario: Cause outside the project
- WHEN the gateway refuses a connection for a reason that the client cannot fix
- THEN the run fails with the error of the first criterion and the fake gateway sees exactly one request
Existing Tool Considered
pydantic-ai with httpx2 already covers the client and offers retries (pydantic_ai.retries, httpx transport retries), but a retry would hide the cause, which the issue and AGENTS.md forbid. No new tool is needed. The cost is the time to read the gateway log and the client log, plus a small change to model_call_error (src/devops_cli/roadmap/agent_run.py:51) and one regression test. No check ran for alternatives.
Key questions
- What is the cause of the six ModelConnectionError failures?: It cannot be settled from the repository. The error text is only
The investigation's model call failed (ModelConnectionError).becausemodel_call_errorwrites the class name of the pydantic-ai error and nothing of its cause (src/devops_cli/roadmap/agent_run.py:57-61). The gateway log and the client log named by the reports in.data/roadmap_eval/verify/are needed. First step: make the message carry the class and text of__cause__, then rerun the five parallel processes. Then compare three causes: a gateway connection limit, a timeout of a long agent loop (the client read timeout and the pool of 30 s keepalive insrc/devops_cli/config/defaults.py:1034are the knobs), and a stale connection of the client. [sources: src/devops_cli/roadmap/agent_run.py:51, src/devops_cli/roadmap/refine/refine_investigation.py:601, src/devops_cli/config/defaults.py:1034] - Does the agent client have the closed event loop problem that fix(ai): a second Jev request on one model fails #4319 describes for the Jev client?: Possibly, and no test rules it out. The agent runs with
agent.run_sync(refine_investigation.py:601). The provider'shttp_clientis an unpooledasync_http_client(level)built once per provider increate_pydantic_ai_provider(src/devops_cli/ai/providers/__init__.py:118-126), with a keepalive pool in its own transport (src/devops_cli/http/entry.py:178-213). A client that serves tworun_synccalls, each in its own event loop, could hold a connection that belongs to a closed loop. Whether one provider serves more than one run in the eval is not shown in the files read, so the test of the second criterion decides it. [sources: src/devops_cli/roadmap/refine/refine_investigation.py:601, src/devops_cli/ai/providers/init.py:118, src/devops_cli/http/entry.py:178] - How must the fix handle a cause that lies outside the project?: Fix the cause at its source. If an outside constraint blocks the fix, add a check that fails when the problem returns, and add no retry that hides it. (best practice) [sources: AGENTS.md]
- Chosen: Fix at the cause, plus a regression check. The issue states it and AGENTS.md requires it.
- Rejected: Add a retry around the model call. It hides the cause and still costs time and tokens on each failed attempt.
- Where does the message of a failed model call get its cause?: In
model_call_error, which is shared by the investigation and the implement step (implement_step.py:834,refine_investigation.py:606). It adds the class name and the text ofexc.__cause__, passed throughbounded_textto mask secrets and cut the length. A connection error holds no model reply, so no reply text is shown. (best practice) [sources: src/devops_cli/roadmap/agent_run.py:51, src/devops_cli/roadmap/agent_run.py:64, src/devops_cli/roadmap/implement/implement_step.py:834]- Chosen: Add the cause to
model_call_error. One change serves both callers and keeps the masking ofbounded_text. - Rejected: Log the cause at each caller. It repeats code and the eval report would still show no cause.
- Chosen: Add the cause to
Fit
Fits in one pull request.
Suspected block
The gateway log and the client log of 2026-11-10 are outside the repository and must be read to name the cause.
Dependencies
None.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ai)scope of the title gives the scope.Six of forty-eight cases fail, wasting about 0.18 USD and 5 to 10 minutes per case, but the run still completes for most cases.Each failed case costs a full re-run and delays the verification pass, but the system still delivers results for the majority of cases.The fix depends on diagnosing whether the cause is a gateway limit, a timeout, or a stale client connection, and the solution is unknown until the logs are read.Both address the same 2026-11-10 incident where 6 of 48 cases failed with ModelConnectionError, but the candidate fixes the error at its source while #4344 stores results incrementally to reduce the cost of a failure.devops-cli-service commentedon Nov 10, 2026
Refine cannot set this item to Ready at 699026e 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.
dan-petty commentedon Nov 11, 2026
Investigation of the six
ModelConnectionErrorfailures of 2026-11-10 (the logs that the refine block names):200 OKlines (Loki,service_name="llm-gateway"): no error, no restart. The agent runs stream each request, and the server writes200 OKwhen the response starts, so this line alone does not prove that a stream ended.cloudflaredkept 8 HA connections. It logged one error in the window, at 03:38:00Z:stream ... canceled by remotefor a/v1/chat/completionsrequest. That is the line that a client which drops an open stream causes. No such line exists at the six failure times (03:30:56Z two times, 03:35:48Z, 03:35:54Z, 03:41:44Z, 04:01:31Z, from the Tempo traces of the five processes).ModelTimeoutErrorfor a timeout. All six messages nameModelConnectionError.ModelConnectionError; its failed model calls had an HTTP status (500 or 502).Result: the failed requests most likely had no open stream through the tunnel. The transport broke before the request reached the edge (name lookup, TCP or TLS on the client host), or the edge closed the client connection. Two processes failed in the same second, which fits a short loss of network or DNS on the client host. The cause is outside the project, and the logs cannot tell which part broke, because
model_call_errorwrote only the class name.The fix PR #4460 makes the message name the transport phase and the error of the HTTP library (masked), so the stored eval report of the next failure states the cause. It adds no retry.
devops roadmap eval verify --resume(#4344, merged) runs again only the failed cases of a stored report.devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC