Repository navigation
Description
What happened
Every attempt of a step uses the same model tier. The Service runs on the homelab tiers, and the XML tool-call parser bug of one model family (#2953) fails the same call every time it is repeated. A harder step gets no stronger model.
What should happen
- A ladder in config: tier per attempt and per step class (plan, edit, repair, review), for example a fast local model first, a stronger local tier on round 2, a configured fallback tier on round 3. Gateway tier health is read before a choice.
- A step that fails on a provider error moves down the ladder without spending a repair round.
Acceptance criteria
- A replay with a provider error on tier 1 succeeds on tier 2 and the trace names both.
- The ladder is a setting and
devops config showprints it. - The token cost per tier is recorded per item.
- No hosted-provider call happens unless the setting names one.
Related: tracker for this set (filed with it), #2908 (issue workflow), #2867 (draft PR evaluator), #3005 (task kind), #3010 to #3015 (plan gates), #2919 (stuck-item metrics), #2953 (Ollama parser).
Proposed design
Problem statement
Every retry of a step uses the same model tier. A model-specific defect, such as the Ollama XML parser bug (#2953), fails the same call on every repeat. A step that needs a stronger model gets none. This issue adds a tier ladder so each attempt can use a different tier, and a provider error moves the step to the next tier without spending a repair round.
Acceptance criteria
Requirement: Ladder config
The ladder SHALL be a config setting that maps each step class to a list of tiers, one per attempt.
Scenario: config show prints the ladder
- WHEN a ladder is set and
devops config showis run - THEN the output lists the tier for each attempt of each step class
Requirement: Provider error tier move
A step that fails on a provider error SHALL advance to the next tier without incrementing the repair round counter.
Scenario: replay with provider error on tier 1
- WHEN a step fails with a provider error on tier 1
- THEN the next attempt uses tier 2 and the trace names both tiers
Requirement: Token cost per tier
The token cost SHALL be recorded per tier per item in the item trace.
Scenario: cost recorded after a step completes
- WHEN a step completes on a given tier
- THEN the item trace includes the token count attributed to that tier
Requirement: No hosted provider unless configured
No hosted-provider call SHALL happen unless the ladder setting names one.
Scenario: default ladder names only local tiers
- WHEN the ladder setting names only local tiers
- THEN no request is sent to a hosted provider
Requirement: Gateway tier health check
Gateway tier health SHALL be read before a tier is chosen for an attempt.
Scenario: unhealthy tier is skipped
- WHEN a tier in the ladder is reported unhealthy by the gateway
- THEN the step skips that tier and uses the next healthy tier
Existing Tool Considered
No check has run. The project builds its own ladder logic on top of its existing model routing. The written cost is the tokens to implement the config schema, the tier-advancing retry logic, the gateway health check, and the per-tier cost tracking, plus the tokens to keep and fix that code until it matches a general-purpose router.
Key questions
- How is the ladder configured?: A new config key holds a map of step class (plan, edit, repair, review) to a list of tiers, one per attempt. The list is ordered from weakest to strongest tier. (proposed)
- Chosen: Per-step-class list of tiers. The body states tier per attempt and per step class. This allows a fast local model for plan and a stronger tier for repair.
- Rejected: Single global list of tiers. Simpler, but does not allow different ladders for different step classes. The body requires per-step-class.
- Rejected: Per-attempt only, no step class. Does not distinguish plan from repair. The body requires per-step-class.
- How does a provider error trigger a tier move without spending a repair round?: The step executor catches a provider error (HTTP 4xx or 5xx from the model gateway) and advances the attempt index. The repair round counter is not incremented. The next attempt uses the next tier in the ladder. (proposed)
- Chosen: Catch provider error and advance tier. The body states a provider error moves the step down the ladder without spending a repair round. This is the direct reading.
- Rejected: Treat as a normal failure and use a repair round. Wastes a repair round on a model defect. The body explicitly avoids this.
- Rejected: Retry same tier with backoff. Does not help when the defect is in the model itself, as in chore(k8s): bump Ollama image for qwen3-coder parser fix #2953.
- How is gateway tier health read before a choice?: Before choosing a tier for an attempt, the executor queries the gateway health endpoint for that tier. An unhealthy tier is skipped and the next tier in the ladder is used. (proposed)
- Chosen: Query gateway health before each choice. The body states gateway tier health is read before a choice. This is the direct reading.
- Rejected: Cache health for a TTL. Adds complexity and a stale-cache risk. The body does not mention caching.
- Rejected: No health check. The body requires a health check. Rejecting it contradicts the requirement.
- How is token cost per tier recorded per item?: Each step completion records the tier used and the token count in the item trace, keyed by tier. The trace accumulates one entry per tier per item. (proposed)
- Chosen: Per-tier token count in item trace. The body states the token cost per tier is recorded per item. This is the direct reading.
- Rejected: Aggregate total only. Loses the per-tier breakdown. The body requires per-tier.
- Rejected: Per-step only, no tier key. Does not attribute cost to a tier. The body requires per-tier.
- Which existing tool or library covers the need for a per-step-class model tier ladder with gateway health checks and per-tier cost tracking?: No check has run. LiteLLM (BerriAI/litellm) provides fallback routing between models, but it does not provide per-step-class ladders, gateway tier health checks before choice, or per-tier token cost tracking per item. The project builds its own ladder logic on top of its existing model routing. [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 1, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.Improves retry resilience but does not block current functionality; no security or data-loss risk.Reduces wasted calls and lets harder steps reach a stronger model, but the service already retries with a fixed tier.Requires new config schema, gateway health read, per-attempt routing logic, and trace/cost recording.Both concern what the step does after a failure; #3053 delivers the bounded-round retry loop, the candidate delivers the specific tier-selection ladder and provider-error routing within it.dan-petty commentedon Nov 1, 2026
Live evidence (2026-11-01): 2 of 13 stops were
HTTP 400 ... XML syntax error on line 35/70: unexpected EOFfrom Ollama (#2559, #2462; upstreamollama/ollama18563). Each ran on the same model tier and ended the item at the first error. A retry on a second tier, or on the same tier with a smaller step, is the case this ladder serves.devops-cli-service commentedon Nov 2, 2026
Status set to Ready at 853987e (see proposed design in issue body).
feat(roadmap): classify a failure and name its class in the stop (#3195)
devops-cli-service commentedon Nov 2, 2026
Staged: branch
feat/3060-a-model-ladder-for-retries-with, draft pull request #3225. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
The plan run made 5 model request(s), and used 236750 input tokens and 6553 output tokens. The tool calls, in order:
list_files({"directory":""})list_files({"directory":"src"})search_code({"text":"tier"})search_code({"text":"config show"})search_code({"text":"devops-coder"})search_code({"text":"implement"})search_code({"text":"gateway"})search_code({"text":"step_class"})list_files({"directory":"src/devops_cli/roadmap"})list_files({"directory":"tests/roadmap"})A model review of the plan found these points. They stop no draft, and a person judges them:
task_orderat group 3: The group 3 test needs the run record to name both tiers. Group 5 builds that record inimplement_run.py, and group 3 does not change that file. The test cannot pass at group 3. Evidence: "Add a failing replay test where tier 1 returns a provider error, tier 2 succeeds, and the run record names both tiers"otherat group 2:config showprints only keys fromsetting_variables()andsecret_keys(). The plan registers no variable for the ladder, for example inconfig/env.py. The ladder would not appear in the output, and group 2 changes onlycommands/config.py. Evidence: "for key in sorted(setting_variables().keys() | secret_keys())"criterion_droppedat criteria (group 1): The plan maps the no-hosted-call criterion to group 1. That group tests only the default value and adds no task to stop hosted calls when the ladder names only local tiers. The step code of groups 3 and 4 has no such task either. Evidence: "Add a failing test that the ladder maps each step class to an ordered tier list and that the default names only local tiers"docs(openspec): plan #3060 update model tier ladder for retries
docs(openspec): plan #3060 merge main and resolve spec overlap
docs(openspec): plan #3060 plan model tier ladder for retries (#3225)
test(roadmap): cover the model tier ladder and its factory (#3060)
devops-cli-service commentedon Nov 3, 2026
Released in v0.53.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.53.0
devops-cli-service commentedon Nov 3, 2026
Live since 2026-11-03 20:33 UTC
fix(roadmap): refuse task groups that write change files (#3413)
test(roadmap): add the stage task and the spend of the stage eval (#3564