Skip to content

feat(roadmap): park jobs while the gateway is offline #5967

Not planned

Description

@dan-petty

Problem

When the model gateway or its provider is down, the roadmap jobs keep starting work that cannot finish. On 2026-11-16 from 10:40Z to 11:35Z, OpenRouter timed out, and the Service still ran refine, alternatives, stage and implement: 12 steps failed with class=provider, two implement Jobs stopped after their groups had used tokens, and stage planned #3655 three times. Each failed item then waits for its retry rule, and an implement item can spend a digest clear.

Expected behavior

  • The Service checks the health of the gateway and of each upstream group that a job uses (for example the gateway's readiness and the recent failure share of the group) before it starts a round or a Job.
  • While a group is unhealthy, the jobs that use it are parked: no new round or Job starts, a running step is not cut, and nothing counts as a failure of the item.
  • A parked job resumes by itself when the group is healthy again, and the Service logs the park and the resume, and shows them on the dashboard.

Related

  • The retry and deadline issue of the same outage (filed with this one).

Alternatives check of 2026-11-24: in-use.
The repository already uses this tool.
Tool: BerriAI/litellm (https://github.com/BerriAI/litellm), NOASSERTION, last activity 2026-11-24, maintained.
Reason: Searches confirm LiteLLM as the open LLM API gateway, and the issue body already names it as in use; it reports gateway readiness and per-group deployment health, but holds no parking, resume or park records.

Covers:

  • Gateway readiness for the proxy
  • Per-deployment health and cooldown of each model group
  • Load balancing across the providers of a group

Lacks:

  • Valkey park key shared by lanes and replicas
  • Automatic resume when a group turns healthy
  • Park and resume records for logs and dashboard
  • Rule that a parked step is not an item failure

Proposed design

Problem statement

On 2026-11-16 the model gateway timed out for 55 minutes. The Service kept starting refine, alternatives, stage and implement work that could not finish. Twelve steps failed with class=provider, two implement Jobs spent tokens, and stage planned #3655 three times. Each failed item then waited for its retry rule. The change makes the Service ask the gateway health before it starts a round or a unit of work. It parks the rows of an unhealthy model group and resumes them by itself when the group recovers.

Acceptance criteria

Requirement: Health gate before a round

The Service MUST ask the gateway health gate before it starts a lane round.

Scenario: An unready gateway holds the round

  • WHEN the gateway readiness check fails and a lane is due for a round
  • THEN the lane starts no round and the gate returns park with the gateway reason

Requirement: No unit for an unhealthy group

The Service MUST create no unit of work and no runner Job for a row whose model group is unhealthy.

Scenario: A row of a group in cooldown gets no unit

  • WHEN the sweeps runs and one model group of a due row is in cooldown at the gateway
  • THEN the sweeps creates no unit and no runner Job for that row, and writes one park record with the group and the reason

Requirement: Park state in Valkey

The Service MUST keep each park in Valkey with a TTL, so that each lane and each replica sees the same park.

Scenario: A second replica sees the park

  • WHEN one replica writes a park for a repository and a model group
  • THEN the gate of another replica returns park for that repository and model group

Requirement: No item failure during a park

The Service MUST NOT write a failure entry or change the status of an item whose step stops while its group is parked.

Scenario: A provider stop during a park

  • WHEN a runner step exits 1 with class=provider and the gate returns park for its group
  • THEN the job record holds no failure entry and the item keeps its status

Requirement: Resume by itself

The Service MUST clear a park and resume its row when the group becomes healthy, with no person action.

Scenario: A healthy check resumes the row

  • WHEN the next sweeps finds the group healthy and a park record exists
  • THEN the Service deletes the park key, writes one resume record, and creates the unit of work that the park held

Requirement: A running step is not cut

The Service MUST NOT stop a running unit when its group becomes unhealthy.

Scenario: A running unit keeps its claim

  • WHEN the gate turns to park while a unit holds an item
  • THEN the Service sends no stop and the unit keeps its claim

Requirement: Park and resume records

The Service MUST write one structured record for each park and each resume, with the repository, the group, the reason and the time.

Scenario: The records carry their fields

  • WHEN a park and then a resume occur for a repository and a model group
  • THEN two records are written with event=park and event=resume and the four fields

Requirement: Health policy settings

The health policy MUST read its switch and its check interval from roadmap.health in .github/roadmap.toml, and MUST use a default when a key is absent.

Scenario: Defaults when the table is absent

  • WHEN the loader reads a config that has no roadmap.health table
  • THEN it returns enabled=true and check_interval_seconds=60

Existing Tool Considered

BerriAI/litellm, verdict in-use: the repository already uses this tool, so no person decision applies (alternatives check of 2026-11-17 in the issue body). The check in the issue body lists what the tool covers and lacks: it gives the readiness and the per-deployment health of each model group, and it lacks parking, automatic resume, park and resume records, and the rule that a parked step is not an item failure. The proposal reads the tool health for the gate and builds only that lacking layer: the Valkey park key, the start-only gate at unit creation, the resume on a healthy check, and the records. Cost to build and keep that layer: about 250 lines of Python, about 30k tokens to write, about 5k tokens a year to keep, and about 2 days.

Key questions

  • Which health signal tells the Service that a model group is unhealthy?: The gateway readiness for the proxy, and the per-deployment health and cooldown of each model group. The Service reads the gateway answer for each group that a row names, and keeps no second failure counter. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md]
    • Chosen: Gateway readiness and per-group health. The alternatives check in the issue body shows that the gateway already reports readiness and per-deployment health, so the Service reads one source.
    • Rejected: Synthetic check request for each group. A check spends tokens and can fail for a reason that is not the health of the group.
    • Rejected: Failure share that the Service computes from its own result lines. It duplicates the gateway cooldown and is behind the gateway by one window.
  • Where does the Service check the gate: at unit creation, in the lane round, or in the runner?: At the one place that creates a unit of work or a runner Job, which the router and the sweeps both call, and in the lane round before it starts. The runner does not gate itself. (best practice) [sources: CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: The unit-creation path and the lane round. Only the router and the sweeps create a unit, so one gate covers both (CONTEXT.md, Sweep).
    • Rejected: The runner pod. The Job already costs a pod and a clone, and the issue says no Job starts.
    • Rejected: The router webhook only. A sweeps with no webhook would still start work.
  • Where does the Service keep the park state?: In Valkey, one key for each repository and model group, with a TTL. Each lane and each replica reads the same key. (best practice) [sources: CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: A Valkey key with a TTL. Lanes do not share memory, and a restart must not lose a park (CONTEXT.md, Lane; Due mark).
    • Rejected: The memory of the lane. A restart or a second replica loses it.
    • Rejected: A label on the issue. It changes the Status of the item, and the issue says a park is not a failure.
  • What does the Service do with a step that stops while its group is parked?: It records a park and writes no failure entry. The item keeps its status, and the normal retry rule takes the step after the resume. (best practice) [sources: CONTEXT.md, docs/ROADMAP_WORKFLOW.md]
    • Chosen: Park, with no failure entry. The issue says a parked step is not an item failure, and a failure would spend the retry budget.
    • Rejected: Count the stop as a failure. It contradicts the issue and it spends a digest clear.
    • Rejected: Mark the item Blocked. A person would clear a state that the Service can clear by itself.
  • How does a parked row resume?: Each sweeps checks each parked group. When the gateway reports the group healthy, the Service deletes the park key, writes one resume record, and lets the normal due logic create the unit on that tick. (best practice) [sources: CONTEXT.md, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md]
    • Chosen: Check on each sweeps. The sweeps is the reconcile round that creates units, so the resume needs no new schedule (CONTEXT.md, Sweep).
    • Rejected: Wait for a person to clear the park. The issue requires a resume by itself.
    • Rejected: Use the cooldown expiry as the wake time. The gateway does not tell the Service when the group is healthy again.
  • Does the Service stop a running unit when its group becomes unhealthy?: No. The gate is read before a start only, and the stop path never consults it. (best practice) [sources: CONTEXT.md]
    • Chosen: Start-only gate. The issue says a running step is not cut.
    • Rejected: Stop the unit. It discards work that the unit can still finish.
  • Which settings hold the health policy?: roadmap.health.enabled and roadmap.health.check_interval_seconds in .github/roadmap.toml, with the defaults true and 60. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: A roadmap.health table. The road map settings already live in one file (ADR 0004 cites .github/roadmap.toml).
    • Rejected: A fixed interval with no setting. A person cannot turn the gate off during an incident.
    • Rejected: A separate file. It splits the road map settings.
  • Which records show a park and a resume?: One structured log line for each event, with event, repository, group, reason and time, and one counter increment with the group and event labels. The dashboard panel is a new issue. (best practice) [sources: CONTEXT.md]
    • Chosen: A log line and a counter. The log line gives the detail, and the counter gives the dashboard a series (CONTEXT.md, Road map step; TELEMETRY.md).
    • Rejected: A log line only. The dashboard needs a metric.
    • Rejected: A new state file. Valkey already holds the state.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/feature
    on Nov 16, 2026
  2. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor
  3. added
    source/agent
    scope/roadmap
    status/new
    value/medium
    effort/medium
    priority/p2-medium
    on Nov 16, 2026
  4. dan-petty commented on Nov 16, 2026

    @dan-petty
    OwnerAuthor

    Related: #5965 (one retry layer and a deadline for a gateway call), filed from the same outage.

  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    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:

    • LiteLLM proxy health check readiness endpoint upstream deployments, results: 5
    • LiteLLM router cooldown allowed_fails failure threshold per deployment, results: 5
    • Argo Workflows suspend workflow pause jobs until dependency healthy, results: 5
    • litellm docs health endpoint proxy readiness "cooldown" deployments, results: 5
    • litellm, results: 5
    • argo workflows, results: 5
    • LiteLLM health check endpoint proxy readiness, results: 5
    • LiteLLM cooldown allowed_fails router fallback documentation, results: 5
    • "litellm" "/health/readiness", results: 5
    • docs.litellm.ai health readiness endpoint, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 18, 2026
  7. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at c49fd02 (see proposed design in issue body).

    Moved to new items: #6304.

  8. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Returning #5967 to New per Rule 2 (AGENTS.md): key parts of the Proposed design rely on unshipped ADR 0021 components and a deleted configuration path.

    Verified against origin/main (0b9c6983f)

    1. No sweep or unit-of-work creation exists yet (CONTEXT.md:153-160, src/devops_cli/server/service.py, src/devops_cli/roadmap/run.py):
      • #5967 requires a start-only park gate "At the one place that creates a unit of work or a runner Job, which the router and the sweeps both call, and in the lane round before it starts", and its scenarios specify that "sweeps creates no unit and no runner Job" and "deletes the park key ... and creates the unit of work that the park held".
      • On origin/main, #4517 (feat(roadmap): move Service work to Workflows and Valkey), #4566 (WorkflowLauncher), and #4574 (feat(roadmap): run the reconcile sweep on a cluster schedule) are still open. There is no Sweep or router/sweep unit-creation layer in src/devops_cli/server/service.py or src/devops_cli/roadmap/run.py (CONTEXT.md:158: "Until #4574 merges, the poll of the Service does this work."). Only the single-pod RepoWorker lane loop and RunnerUnit (src/devops_cli/roadmap/job_launcher.py, used by implement_submit, fix_checks_row, infra_plan, and infra_apply) exist today.
    2. Deleted configuration file .github/roadmap.toml (docs/adr/0016-labels-hold-the-roadmap-items-fields.md:42, src/devops_cli/config/constants.py:3945):
      • #5967 requires reading roadmap.health.enabled and roadmap.health.check_interval_seconds from .github/roadmap.toml.
      • Per ADR 0016 (docs/adr/0016-labels-hold-the-roadmap-items-fields.md:42), .github/roadmap.toml was deleted; repository toolchain config lives in .devops/roadmap.toml and Service/roadmap policy settings live in config.yaml (load_settings().roadmap).

    Next: Either hold #5967 on #4574 / #4517 and update the configuration source to config.yaml (or .devops/roadmap.toml), or narrow #5967 to probe gateway health cleanly before RepoWorker lane rounds and RunnerUnit launches in the current single-pod Service.

  9. added
    status/new
    and removed
    status/ready
    on Nov 25, 2026
  10. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    Evidence from the provider cut of 2026-11-25, 13:12Z to 20:43Z, for the narrow form of this item.

    • The key of the hosted provider had too few credits. The provider answered HTTP 402, and the gateway cooldown answered HTTP 429 between the 402 replies. The result lines hold 439 attempts with class=provider in those 8 hours (refine 315 on 119 items, stage 87, alternatives 34, implement 3) and 4 successes. That is about half of all failed attempts of the 7-day window.
    • A health probe does not see this case. The gateway stayed ready, and a small request still passed, because the key could pay for it. Only a request with a large max_tokens got the 402.
    • The Service already has a park: the failure ledger (FailureLedger, roadmap/run.py) suspends a row after service.max_failed_rounds failed rounds and probes it after RETRY_AFTER of the failure class, with no Valkey key. It did not park on 2026-11-25, because a job fails only the item for an AIClientError and stops its round only for AICredentialsError. So no round failed.
    • fix(ai): read an HTTP 402 of the provider as a spent key #7261 (pull request fix(ai): read an HTTP 402 of the provider as a spent key #7265) classes the 402 as a spent key, which stops the round, suspends the row and fires RoadmapProviderKeySpendLimit.

    What stays open for this item after #7261: a short provider failure with no cause in its reply (HTTP 429 of the cooldown, a timeout) still fails one item after the other. A narrow form that needs no probe and no new state: a job ends its round with a provider error when a set number of model calls in a row fail with the class provider, so the ledger that exists suspends the row.

  11. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor

    This item closes as not planned (AGENTS.md Rule 2: newer code replaces it, and the design cannot be built as written).

    • The design needs a park key in Valkey, a sweep and .github/roadmap.toml. None of them is in main (comment of 2026-11-25).
    • A health probe, the signal of this design, does not see the cut that cost the most. On 2026-11-25 the gateway stayed ready for 8 hours while the provider key had too few credits, and 439 attempts failed.
    • fix(ai): read an HTTP 402 of the provider as a spent key #7261 (pull request fix(ai): read an HTTP 402 of the provider as a spent key #7265, merged 2026-11-26) covers that case with the park that exists: a spent key stops the round, the failure ledger (FailureLedger) suspends the row and probes each hour, no item gets a failure, and RoadmapProviderKeySpendLimit fires. The gauge devops_cli_service_job_suspended and the alert RoadmapServiceRowSuspended show each suspended row with its class.
    • What stays open is small: a short provider failure with no cause in its reply (the cut of 2026-11-16 gave 12 failed steps in 55 minutes) still fails one item after the other. File that with its count when a new cut shows it. The narrow form is in the comment of 2026-11-26: a job ends its round after a set number of provider failures in a row, so the ledger suspends the row.
  12. removed
    status/new
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions