Repository navigation
Description
Problem Description
The roadmap Service sends model calls from the model lane of each repository in service.repos at the same time. The cluster's model is devops-background (qwen3.8:27b on ollama-48gib-slow), and that tier serves one request at a time (k8s/README.md, LLM Gateway). The other calls wait in the queue of the gateway and of Ollama. The gateway stops a call when the tier sends no token for 1,100 s, and the time in that queue counts. A refine investigation can make up to 12 calls, and a reply can be several thousand tokens, so a call that waits behind the other lanes can time out before its turn.
On 2026-10-28 at 22:39:26 UTC, Ollama answered POST /api/chat with 500 after 18m20s, and LiteLLM logged litellm.Timeout ... Timeout passed=1100.0, time taken=1100.002 seconds for model group devops-background, with no fallback. Refine of #1 failed at the same second. Since go-live (19:45), refine made 12 proposals and failed 4 times, 2 of them with this AIClientError.
Reproduction Steps
- Run the Service with 7 repositories whose model lanes have refine or intake work due.
- Watch the gateway log: calls to
devops-backgroundwait for the one slot, and a call that waits more than 1,100 s fails.
Expected vs Actual Behavior
Expected: the Service sends no more model calls at one time than the tier serves. A Service-wide limit on concurrent model calls, from a setting with the default 1 for the cluster, makes the other lanes wait in the Service, where no stall timer runs. The standard tool is a bounded semaphore from the standard library around the model call. #1534, which moves intake to its own triage lane on another model, does not remove this queue for refine.
Actual: up to 7 lanes send calls at once, and the calls that wait longest time out.
Environment Diagnostics
Image from main after 657b03d. Gateway pod llm-gateway-6cfc5c97bc-sfppz, tier pod ollama-48gib-slow-x467w. The cluster ConfigMap has no ai.max_retries yet, so a call that fails before its reply starts can also be sent five times.
Logs, Traces, or Terminal Output
ollama-48gib-slow: [GIN] 2026/10/28 - 22:39:26 | 500 | 18m20s | <gateway pod> | POST "/api/chat"
llm-gateway: 22:39:26 - LiteLLM Proxy:ERROR: common_request_processing.py:1208 - request failed after its SSE keepalive had opened the response: litellm.Timeout: Ollama_chatException - litellm.Timeout: Connection timed out. Timeout passed=1100.0, time taken=1100.002 seconds
llm-gateway: No fallback model group found for lookup_groups=devops-background.
roadmap-service: 22:39:26 WARNING Refine skipped #1: its model call failed (AIClientError, 0 schema violation(s)).
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The Service sends model calls from all repositories at the same time. The cluster model tier serves one request at a time. Calls that wait in the gateway queue for more than 1,100 seconds time out. This causes refine proposals to fail in production. The fix limits concurrent model calls in the Service.
Acceptance criteria
- Criterion 1: The Service limits concurrent model calls to a configured maximum, defaulting to 1.
Verification: Run the Service with 2 or more repositories due for model work. Observe that at most 1 model call is in flight at any time. - Criterion 2: A lane that waits for the model slot completes its round without an AIClientError.
Verification: Run a test where a second lane waits for the semaphore. Assert the round completes and no AIClientError is raised. - Criterion 3: The concurrency limit is set by a configuration value.
Verification: Set the configuration value to 2. Observe that 2 model calls can be in flight at the same time. - Criterion 4: The semaphore is from Python's standard library.
Verification: The code uses asyncio.Semaphore. No third-party concurrency package is added to the dependency list.
Key questions
- What concurrency primitive limits the model calls?: asyncio.Semaphore from Python's standard library. (proposed)
- Chosen: asyncio.Semaphore. Standard library. No new dependency. The body states the standard tool is a bounded semaphore from the standard library.
- Rejected: Third-party semaphore package. Adds a dependency for a standard-library solution.
- Rejected: Gateway-side rate limiting. The stall timer is in the gateway. The body states the fix is in the Service where no stall timer runs.
- What is the default concurrency limit?: 1, matching the one-slot tier. (best practice) [sources: k8s/README.md]
- Chosen: 1. The tier serves one request at a time. The body states the default is 1 for the cluster.
- Rejected: Higher number. The tier serves one at a time. A higher limit would not reduce the queue.
- Where is the semaphore placed?: Around the model call in the Service's model-call path. (best practice) [sources: src/devops_cli/roadmap/refine.py]
- Chosen: Service model-call path. The body states the fix is in the Service where no stall timer runs.
- Rejected: Gateway. The stall timer is in the gateway. Waiting there still times out.
- Rejected: CLI. fix(ai): gateway reviews keep requests in flight at the backend slot count, however many ai.ollama_urls are configured #1354 handles CLI concurrency separately.
- What must the tests demonstrate?: A lane that waits for the model slot does not fail its round. (best practice) [sources: src/devops_cli/roadmap/refine.py]
- Chosen: Waiting lane does not fail its round. The reply states the tests should show this. It proves the end-to-end behavior.
- Rejected: Only test the semaphore in isolation. Does not prove the lane completes its round.
- How is the concurrency limit configured?: A setting in the Service configuration, with a default of 1. (best practice) [sources: k8s/README.md]
- Chosen: Service configuration setting. The body states 'from a setting with the default 1 for the cluster'.
- Rejected: Hardcoded value. Not configurable. The body states it is from a setting.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 28, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
The Service sends more concurrent calls than the single-slot tier serves, causing production timeouts.Production refine proposals fail at 22:39 UTC on 2026-10-28 and 4 of 12 proposals failed since go-live.Unbounded concurrent calls cause real refine failures that block the roadmap Service.The fix is a standard-library bounded semaphore around the existing model call, scoped to one code path.Both cap concurrent model calls to the backend slot count, but #1354 clamps the CLI review --concurrency flag while the candidate adds a semaphore in the Service model-call path.dan-petty commentedon Oct 29, 2026
More evidence, 2026-10-28 23:30 to 2026-10-29 00:30 UTC: the gateway timed out three calls to
devops-backgroundafter 1,100 s (23:49:34, 00:00:13, 00:23:36). The refine ofdan-petty/dreamscaper#1 failed withAIClientErrorat 00:05:09 and 00:23:36, and at 00:23:36 the Service logged: "The roadmap job refine of dan-petty/dreamscaper failed 3 rounds in a row, so it does not run again until its input changes."So the queue now stops refine for a whole repository:
_record_failure(src/devops_cli/roadmap/refine.py), which records only a failure that the item's own text caused (fix(roadmap): refine records an item whose model call failed or whose body would exceed the size limit, so it waits for a body change instead of being retried every poll #1526), does not record it. The next round selects the same item again.raise_for_failed_itemsfails the job for one failed item, and three failed rounds suspend the job (fix(service): a restart keeps the halt, the budget window and the failure ledger, and a secondary limit or a suspended installation stops every worker #2474). Every other item of that repository then waits until its input changes.The fix of this issue removes the timeouts at their source. Its tests should also show that a lane that waits for the model slot does not fail its round.
devops-cli-service commentedon Oct 29, 2026
Status set to Ready at b32348a (see proposed design in issue body).