Skip to content

fix(roadmap): loosen the caps that turn a stage refusal into a loss #4802

Closed

Description

@dan-petty

Problem Description

Three strict caps turn each refusal of the stage job into a loss:

  1. A reply that the stage gates refuse goes back to the planner one time (CONST_ROADMAP_STAGE_GATE_RETURNS = 1). A second refusal fails the item with the class plan_defect.
  2. A failed item with the class plan_defect waits 6 hours before the job takes it again (RETRY_AFTER in src/devops_cli/roadmap/failure.py). The ledger of failed rounds uses the same wait for the retry time of a suspended row.
  3. A row that fails 3 rounds in a row is suspended (DEFAULT_SERVICE_MAX_FAILED_ROUNDS = 3). One failed item fails the whole stage round, also when the other items of the round staged.

The holds stack. Only a code change can change these values, so the owner cannot tune them live while the jobs move to 80% success.

Measured over the 7 days to 2026-11-11 (repository dan-petty/devops-cli):

Reproduction Steps

  1. Give the stage job an item whose first reply the gates refuse, and whose returned reply the gates also refuse.
  2. Read the result: the item fails with plan_defect, and the planner gets no third reply.
  3. Run the stage round again 1 hour later: the job leaves the item out until 6 hours after the failure.
  4. Fail 3 stage rounds in a row: the Service suspends the row until the retry time, 6 hours after the last failure.

Expected vs Actual Behavior

Expected: a refused reply that makes progress gets more returns, a refused item waits a short time, and a row runs more rounds before a suspension. The owner can tune the return count and the row limit live in the ConfigMap.

Actual: one return, a 6 hour wait and a stop after 3 rounds, all in code.

Proposed Solution

This is the first step toward 80% stage success. The progress-aware caps plan later makes these soft caps with a decision-model check.

  1. Add the setting roadmap.stage.gate_returns, default 3, in place of CONST_ROADMAP_STAGE_GATE_RETURNS. A reply then gets up to 4 tries for each ask. Evidence: 8 of 10 sampled items made progress at the second reply, and a plan with problems in two modules needs one more reply.
  2. Set the wait of plan_defect in RETRY_AFTER to 1 hour, the same as provider and ci_infra. The stage row runs every 37 minutes, so a failed item still skips one round. The return to New after 3 plan_defect failures on one body (CONST_ROADMAP_STAGE_PLAN_DEFECT_LIMIT) still limits the attempts of an item. The wait stays in the one table of failure.py, because the stage spec says that no setting changes the wait, and four jobs read the table.
  3. Add the setting service.max_failed_rounds, default 6, from DEFAULT_SERVICE_MAX_FAILED_ROUNDS. At 37 minutes a round, the stage row then runs about 3.7 hours of failed rounds before a suspension, not about 1.9 hours.

Nested limits: a return is one more planner call in the same item. Each call keeps its own tool call limit (200) and request limit (250). The stage row has no wall-clock deadline in the Service. The 600 second stop drain still ends a round at its next GitHub request. The item wait of 1 hour is longer than the stage interval of 37 minutes. The row retry time of 1 hour is shorter than the 3 hour for of the alert RoadmapServiceRowSuspended.

Cost: a return sends the refused reply and its problem, so it costs less than a new attempt from the first ask. The worst case of one item goes from 3 to 5 planner calls without a verifier, and from 7 to 13 with one.

Existing Tool Considered

No open tool holds the caps of this project's roadmap jobs. The change uses the existing settings model (pydantic-settings) and the ConfigMap. Cost to build: about 60,000 tokens and 1.5 hours.

Acceptance Criteria

  • roadmap.stage.gate_returns sets the returns of a refused reply, default 3, and devops config show lists it.
  • service.max_failed_rounds sets the failed rounds before a suspension, default 6.
  • RETRY_AFTER holds 1 hour for plan_defect.
  • The docs and the specs name the new values and settings.

Dependencies

None. The progress-aware caps plan builds on this change.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 11, 2026
  2. dan-petty commented on Nov 11, 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/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. Stage success is 20% and the fix targets 80%, but the pipeline still runs and no data is lost.
    • Value: High. Raising stage success from 20% to 80% directly improves throughput for all roadmap users.
    • Effort: Medium. Three constants become settings and one table value changes, but the edits span failure.py, stage.py, and settings with coordination needed.
    • Related: fix(roadmap): stage retries a refused plan with no cap #4491, which asks for a different change. Both touch the stage gate return cap in roadmap, but #4491 added the cap of one return while this candidate loosens it to three and makes it a live setting.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 11, 2026
  4. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Scope from the progress-aware caps plan (2026-11-11)

    The tracker #4843 orders this item as child 1 (start now). Where this comment and the body differ, this comment is the scope.

    Problem

    Code caps turn a stage refusal into a loss. (1) CONST_ROADMAP_STAGE_GATE_RETURNS = 1: 66 of about 110 classified failed stage rounds in 7 days end at this cap; one return clears 211 of 254 problems (83%); in 8 of 10 sampled items the second reply had less problem text. (2) The row suspends after 3 failed rounds: 25 suspensions in 7 days, 16 with only plan_defect failures; each holds the row 6 hours while 149 Ready items are selectable. (3) A loosened cap has no time bound: a stage item has no wall-clock limit, a planner ask takes up to about 728 s (p90), and the 600 s Service drain cut about 8 stage rounds on 2026-11-11.

    Corrections to the first body: raise_for_failed_round (#3493) already fails a round only when no item staged or stopped, so the rule to change is the class rule. A 1 hour plan_defect wait adds no plan PRs (2 of 149 selectable items waited) and spends the 3 plan defects of an unchanged body in about 3 hours. A default of 6 failed rounds also loosens the suspension for provider outages.

    Solution

    1. Add roadmap.stage.gate_returns (default 2, allowed 1 to 3) in place of CONST_ROADMAP_STAGE_GATE_RETURNS.
    2. Add service.max_failed_rounds (default 3) from DEFAULT_SERVICE_MAX_FAILED_ROUNDS.
    3. In raise_for_failed_round, a round whose failed items all have the class plan_defect does not count as a failed round; each item keeps its 6 hour wait; other classes count as today.
    4. Keep the plan_defect wait at 6 hours.
    5. A return starts only when elapsed item seconds + the p90 ask seconds (728 s until 30 asks are logged) + 120 s <= 2700 s, and only when the Service does not drain; else the item stops as today, keeps its refused file, and the log line names the guard.
    6. Add the seconds of each ask to the 'stage gate returns:' line.
    7. Update the stage docs, specs and the README settings table. Do not touch the kept-plan rule: the stage drought work owns it.

    Cost to build: about 0.8M tokens, half a day.

    Acceptance criteria

    • A test: a reply that the gates refuse two times gets a third ask with the default 2; with gate_returns 1 it does not.
    • A test: gate_returns 4 fails the settings load.
    • A test: a round with 3 plan_defect failures and no staged item adds nothing to the failed-round ledger; a round with 3 provider failures adds 1.
    • A test: a return with 2,000 s elapsed does not start; a return during a drain does not start.
    • devops config show lists both settings.
    • 7 days after deploy: 0 stage row suspensions with only plan_defect failures, and the feat(roadmap): log one result line for each roadmap job attempt #4845 stage ratio is higher than in the 7 days before.

    Dependencies

    None.

  5. added
    status/in-review
    and removed
    status/in-progress
    on Nov 12, 2026
  6. removed
    status/in-review
    owner/agent
    on Nov 12, 2026
  7. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Scope gap after the merge of #4869

    The owner merged #4869 on 2026-11-12 at 00:44 UTC. It delivers the first body of this issue. The scope comment above asked for different values and three more parts. This table compares the scope comment with main after the merge:

    Part Scope comment Merged in #4869
    roadmap.stage.gate_returns default 2, allowed 1 to 3 default 3, ge=0, no upper limit
    service.max_failed_rounds default 3 default 6
    plan_defect wait in RETRY_AFTER 6 hours (no change) 1 hour
    A round that has only plan_defect failures is not a failed round yes no
    Time guard before a return: elapsed item seconds + p90 ask (728 s) + 120 s <= 2700 s, and no return during a drain yes no
    Seconds of each ask on the stage gate returns: line yes no

    Effects on the other items of #4843:

    There is no second pull request for this issue. The parts above go to #4847 and #4851.

  8. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-12 04:08 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/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions