Skip to content

feat(roadmap): a suspended intake row retries after a set time #4065

Description

@dan-petty

Problem

The FailureLedger (run.py) suspends a row after 3 failed rounds on one input digest. The suspension ends only when the digest changes (FailureLedger.suspended, _round_input).

Which lanes are affected. _lane_reads_changes is true only for a lane with a row that has a due_rule. Only the triage lane has one (row intake). The status lane and the model lane put the hour of the round into the digest (#2757). A suspended row there runs again in the next hour. Only the row intake stays suspended until an item changes. An outage that ends on its own does not end the suspension of intake.

The ledger stores the exception class name as the cause of each round (failed(), _count_failure). No alert exists on the gauge devops_cli_service_job_suspended. The gauge has no class label.

Expected

Add an optional retry_after time to the ledger record. Set it from RETRY_AFTER of the class (the issue #4060).

  • A row with retry_after in the past runs one probe round (half open).
  • A success clears the record.
  • A failure sets a new time.
  • Keep the digest rule: a new input restarts the row at once.

Store the class value as the cause of each round. Add the class to the suspension log line (MESSAGES.serve.job_suspended). Add the label class to the gauge devops_cli_service_job_suspended. Add one gauge with the seconds left.

Add the alert RoadmapServiceRowSuspended (suspended for 3 hours, warning, with the label class) to k8s/monitoring/prometheus-values.yaml. Add a case for it in the fixture tests/fixtures/prometheus_rules/roadmap_service_tests.yaml. Add a row in the alert tables of k8s/README.md.

Rollout rule for the old file. The new field is optional. _FailedRounds already accepts entries of 4 and 5 fields. Add the 6-field form. An old record loads with no retry_after and keeps the old rule. An unreadable file still raises, as today (read_state_record).

Acceptance criteria

  • uv run pytest tests/roadmap/test_roadmap_ledger_retry_after.py -k retry_after - a suspended row runs after its time with no new input.
  • uv run pytest tests/roadmap/test_roadmap_ledger_retry_after.py -k half_open - a failed probe round sets a new time. A success clears the record.
  • uv run pytest tests/roadmap/test_roadmap_ledger_retry_after.py -k new_input - a new digest runs the row at once.
  • uv run pytest tests/roadmap/test_roadmap_ledger_retry_after.py -k old_record - a record of 5 fields loads and the row keeps the old rule. It does not raise.
  • uv run pytest tests/roadmap/test_roadmap_ledger_retry_after.py -k class_cause - the ledger file holds the class value, and the gauge has the label class.
  • grep -q 'RoadmapServiceRowSuspended' k8s/monitoring/prometheus-values.yaml && grep -q 'RoadmapServiceRowSuspended' tests/fixtures/prometheus_rules/roadmap_service_tests.yaml && uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py - the alert and its promtool case exist and pass. The fixture is tests/fixtures/prometheus_rules/roadmap_service_tests.yaml.

Every command above fails on the unchanged code. The pull request cites the fail-to-pass run (devops ci fail-to-pass --base <ref>).

Feasibility

I read these files at origin/main: run.py (FailureLedger, _FailedRounds, _round_input, _lane_reads_changes, STATUS_LANE_ROWS, TRIAGE_LANE_ROWS, MODEL_LANE_ROWS), the alert group in k8s/monitoring/prometheus-values.yaml, tests/prometheus/test_k8s_monitoring_alerting.py and the fixture. I read pybreaker 1.4.1 in the virtualenv. I did not run the Service or promtool.

A cheaper option exists. Put the hour into the digest of the triage lane too, as #2757 did for the other lanes. It retries every hour with no class and no probe. It costs about 10k tokens. I chose the class time because the stage and refine waits use the same table.

Existing tool considered

FailureLedger with a time field. pybreaker 1.4.1 is already a dependency (ai/rag/investigator.py, valkey/cache.py). I compared it and did not use it, for three reasons:

  1. The state must survive a restart in the ledger file. A custom storage copies that persistence (about 10 methods).
  2. The digest rule (a new input ends the suspension) is not a pybreaker idea. The breaker and the ledger would keep two states that must agree.
  3. pybreaker wraps the call and raises its own CircuitBreakerError. This changes the control flow of _execute_due_rows.

Cost

Build with the ledger: about 50k tokens and 2.5 h (about 40 lines, 6 tests, one alert). Build with pybreaker and a custom file storage: about 80k tokens and 4 h. Keep: about 3k tokens per quarter. Fix: about 15k tokens and 1 h.

Related

Part of #3027. #3666 (a round that fails before its first row), #3655 (dashboard and alerts). Order: after the issues #4060 and #4061. All change run.py.

Proposed design

Problem statement

The FailureLedger in src/devops_cli/roadmap/run.py suspends a row after 3 failed rounds on one input digest. Only a new digest ends the suspension. Only the triage row intake has a lane that reads changes. An outage that ends on its own leaves that row suspended. The change adds an optional retry_after time to the ledger record. The time comes from RETRY_AFTER of the failure class, so a suspended row runs one probe round after its time. The change also stores the failure class, names it on the log line and the gauge, and adds the alert RoadmapServiceRowSuspended.

Acceptance criteria

Requirement: Retry time in the ledger record

The FailureLedger SHALL store an optional retry_after time for a suspended row, set from RETRY_AFTER of the failure class.

Scenario: A suspended row runs after its time

  • WHEN a row is suspended with a retry_after time in the past, and its input digest does not change
  • THEN FailureLedger.suspended answers False for that row, and the round runs the row.

Requirement: Half-open probe round

A probe round of a suspended row MUST set a new retry_after time on failure, and MUST clear the record on success.

Scenario: A failed probe sets a new time, and a success clears the record

  • WHEN a suspended row runs a probe round that fails, and its next probe round succeeds
  • THEN the ledger holds a new retry_after time after the failure, and no entry for the row after the success.

Requirement: Digest rule kept

The ledger MUST clear the suspension of a row at once when its input digest changes, with no wait for retry_after.

Scenario: A new digest runs the row at once

  • WHEN a suspended row gets a new input digest before its retry_after time
  • THEN FailureLedger.suspended answers False for that row, and the round runs the row.

Requirement: Old record loads

The ledger SHALL load an entry of 5 fields with no retry_after, MUST keep the digest rule for it, and MUST still raise on an unreadable file.

Scenario: A record of 5 fields loads with the digest rule

  • WHEN the ledger file holds a suspended entry of 5 fields
  • THEN the ledger loads it with no retry_after, answers that the row is suspended, and raises no error.

Requirement: Failure class as the cause

The ledger SHALL store the failure class of CLASS_BY_EXCEPTION as the cause of each round, and the suspension log line and the gauge devops_cli_service_job_suspended SHALL name that class.

Scenario: The ledger file and the gauge name the class

  • WHEN a round fails with an error that CLASS_BY_EXCEPTION maps to provider
  • THEN the ledger file holds provider as the cause, and the gauge devops_cli_service_job_suspended has the label class="provider".

Requirement: Gauge of the seconds left

The Service SHALL export the gauge devops_cli_service_job_retry_after_seconds with the seconds left before a suspended row runs again.

Scenario: The gauge counts the seconds to the retry time

  • WHEN a row is suspended with a retry_after time 600 seconds ahead of the round
  • THEN the gauge holds 600 for the labels of that repo, lane, row and class.

Requirement: Alert on a long suspension

The alert RoadmapServiceRowSuspended MUST sit in the group roadmap-service with severity warning, the label class and a wait of 3 hours, and MUST have a promtool case and a row in the alert table of k8s/README.md.

Scenario: A row suspended for 3 hours fires the alert

  • WHEN devops_cli_service_job_suspended stays at 1 for one row for 3 hours
  • THEN promtool test rules reports RoadmapServiceRowSuspended with severity warning and the labels of that row.

Existing Tool Considered

No alternatives check has run on this item. The open, maintained tool is pybreaker 1.4.1, already a dependency (src/devops_cli/ai/rag/investigator.py, src/devops_cli/valkey/cache.py). It lacks a state that survives a restart in the ledger file, so a custom storage copies about 10 methods of persistence. It lacks the digest rule, so the breaker and the ledger keep two states that must agree. It also wraps the call and raises CircuitBreakerError, which changes the control flow of _execute_due_rows. Build with the ledger: about 50k tokens and 2.5 h, for about 40 lines, 6 tests and one alert. Keep: about 3k tokens per quarter. Fix: about 15k tokens and 1 h. Build with pybreaker and a custom file storage: about 80k tokens and 4 h.

Key questions

  • How does a suspended row get a retry time?: Set an optional retry_after time on the ledger record from RETRY_AFTER of the failure class. A row whose time is past runs one probe round. (best practice) [sources: src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/run.py:1044, docs/roadmap/stage.md:75]
    • Chosen: RETRY_AFTER of the failure class. One table, RETRY_AFTER in roadmap/failure.py, already sets the wait of the stage row. The ledger reads the same table, so the class decides the wait and no second value drifts from it.
    • Rejected: The hour in the triage digest. The triage lane then runs intake every hour on the same candidate, with no class and no probe round. The digest of intake is an item digest, and an hour in it hides the real input.
    • Rejected: pybreaker with a custom file storage. The state must survive a restart in the ledger file, so a custom storage copies the persistence. The digest rule stays a second state, and CircuitBreakerError changes the control flow of _execute_due_rows.
  • Which form does the ledger record take, and does an old record still load?: Append an optional 6th field to each entry of _FailedRounds. An entry of 4 or 5 fields loads with no retry_after and keeps the digest rule. An unreadable file still raises RoadmapRunError. (best practice) [sources: src/devops_cli/roadmap/run.py:1044, openspec/changes/3075-fault-injection-tests-prove-the-pipeline/tasks.md]
    • Chosen: An optional 6th field. The new field is optional, so an old file loads with no migration. _FailedRounds already accepts entries of 4 and 5 fields.
    • Rejected: A required 6th field. An old file then fails to load, or needs a rewrite on the volume of the running Service.
    • Rejected: A second record file for the retry times. Two records must stay in step, and a restart between two writes loses one of them.
  • Which value does the ledger store as the cause of a round?: Store the failure class from CLASS_BY_EXCEPTION, not the exception class name. Name the class in the log line MESSAGES.serve.job_suspended. (best practice) [sources: src/devops_cli/roadmap/failure.py, docs/roadmap/stage.md:75, src/devops_cli/roadmap/run.py:1044]
    • Chosen: The failure class. The class is what RETRY_AFTER and the stage record use, and the docs name it. One value gives the wait, the log line and the gauge label.
    • Rejected: The exception class name. No table maps an exception class name to a wait, so the ledger cannot set a retry time from it.
    • Rejected: Both values in one entry. The entry grows by one field, and two values must agree on every write.
  • What does a class with no RETRY_AFTER entry do?: A class with no entry, such as head_moved, gives no retry_after, and the row keeps the digest rule. (best practice) [sources: docs/roadmap/stage.md:75, src/devops_cli/roadmap/failure.py]
    • Chosen: No retry time. The table gives no time for head_moved, because a new head is the only cure. A probe round on the same digest cannot succeed.
    • Rejected: A default time, as ci_infra. The docs give ci_infra as the class of an unknown error, not as a time for a class that has none.
  • What time does a failed probe round set?: A failed probe round sets retry_after to the round time plus RETRY_AFTER of its class. A success clears the record. (best practice) [sources: src/devops_cli/roadmap/failure.py, docs/roadmap/stage.md:75]
    • Chosen: The same wait again. One table decides the wait, and the docs state that no setting changes it. The next probe costs one round of the class's wait.
    • Rejected: A doubling wait. A second wait table must agree with RETRY_AFTER, and an outage that ends late waits far longer than its class says.
    • Rejected: No new time. The row then runs a probe round on every poll of the Service, and a lasting outage costs a round each 5 minutes.
  • Which gauge holds the seconds left before a suspended row runs again?: Add the gauge devops_cli_service_job_retry_after_seconds with the labels repo, lane, row and class. It holds the seconds left before the row runs again. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, src/devops_cli/telemetry/instruments.py]
    • Chosen: devops_cli_service_job_retry_after_seconds. The repository puts the unit last, as devops_cli_service_job_start_timestamp_seconds does. The name states the value that the gauge holds.
    • Rejected: devops_cli_service_job_suspended_seconds. An operator reads it as the time already suspended, which is the other direction of the same value.
    • Rejected: No gauge. The suspension gauge then gives no time left, and an operator cannot tell a long wait from a short one.
  • How does the alert fire, and which checks must change with it?: Add RoadmapServiceRowSuspended to the group roadmap-service with the expression max by (repo, lane, row, class) (devops_cli_service_job_suspended{job="roadmap-service"}) > 0, for: 3h and severity warning. Add the alert to ROADMAP_SERVICE_RULES and to the baseline rule set, add both gauges to SERVED_SERIES, add a promtool case to the fixture, and add a row to the alert table of k8s/README.md. (best practice) [sources: tests/prometheus/test_k8s_monitoring_alerting.py, tests/fixtures/prometheus_rules/roadmap_service_tests.yaml, k8s/monitoring/prometheus-values.yaml, k8s/README.md]
    • Chosen: One rule in roadmap-service, by row and class. The group already holds the Service's rules, and each of its selectors names job="roadmap-service". The rule states which row stays suspended and why.
    • Rejected: A new group roadmap-service-suspensions. One rule needs no group of its own, and each group costs a fixture file and a tuple in ROADMAP_SERVICE_GROUP_TESTS.
    • Rejected: A rule over the seconds gauge only. The seconds gauge holds a time left, not a state, so a rule over it fires on every suspension, also a short one.
  • Which lanes does this change affect?: Only the triage lane has a row with a due_rule, so _lane_reads_changes is true only there and only the row intake stays suspended until its input changes. The status lane and the model lane put the hour into the digest, so their rows already run each hour. [sources: src/devops_cli/roadmap/run.py, CONTEXT.md]
  • Is RETRY_AFTER present at the base commit, and which issue still comes first?: Yes. RETRY_AFTER is in src/devops_cli/roadmap/failure.py, with callers in run.py and stage.py, and change 4060 is archived. Only feat(roadmap): refine and intake keep a failure class and wait #4061 stays a dependency. [sources: src/devops_cli/roadmap/failure.py, src/devops_cli/roadmap/run.py, src/devops_cli/roadmap/stage/stage.py, openspec/changes/archive/2026-11-08-4060-stage-retry-time-follows-the-failure-class/design.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4061

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It improves recovery from outages but a cheaper alternative exists and the current behaviour is a design choice, not a break.
    • Value: Medium. It lets the intake row self-recover after an outage without a digest change, reducing manual intervention.
    • Effort: Medium. It changes the ledger record format, adds half-open probe logic, updates the gauge and alert, and must load old 5-field records.
    • Related: fix(roadmap): one failed item does not suspend the stage row #3493, which asks for a different change. Both modify the FailureLedger suspension logic in run.py, but #3493 prevents one item from suspending the whole row while this candidate adds a time-based retry to the suspension itself.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

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

  6. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 8, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 8, 2026
  8. added a commit that references this issue on Nov 8, 2026
  9. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-08 20:02 UTC

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