Skip to content

feat(roadmap): run a fixable check before a decision point refuses #5840

Open

Description

@devops-cli-service

Split from #4847.

The decision points of the roadmap record a refusal and stop. The owner asks that a refusal first runs a fixable check, and #4847 names the counters devops_cli_roadmap_fix_checks_total{site,path,resolver} and devops_cli_roadmap_fix_rounds_total{site,result} and an outcome line per repaired run. The body gives no rule for when the check runs, what it repairs or how a round ends, and no bound for the two label sets, so a test cannot check it and the soft-cap chain of #4847 lands without it. The fix-checks step of ADR 0021 section 8 is the pattern to start from: one failed check of a head, a round while rounds are left, else the stop, with a token bound and a marker that holds the key, the rounds and the result. Acceptance criteria: a decision point that would refuse SHALL run the fixable check of its site before it records the flag band. When the check repairs the cause, the chain SHALL return the continue band and record one repaired outcome line. When the check does not repair the cause, the chain SHALL return the flag band and record the result. The two counters SHALL each declare a series bound, and a test SHALL hold every label set under it. The chain SHALL NOT run a fix round while the Service drains.

Proposed design

Problem statement

The decision points of the roadmap record a refusal and stop. A cause that a check can repair still stops the chain. The owner asks that a refusal first runs a fixable check. The body gives no rule for the check, the repair, the round end or the counter bound, so a test cannot check the behavior.

Acceptance criteria

Requirement: Fix check before the flag band

A decision point that would return the flag band SHALL run its fixable check, count it and then record the flag band.

Scenario: The flag band runs the site check first

  • WHEN The fake evidence builder returns the flag band and its site registers a fixable check.
  • THEN The test asserts one run of the fake site check before the flag band. It also asserts one increment of devops_cli_roadmap_fix_checks_total with the site, the path and the resolver.

Requirement: Repaired round returns the continue band

The chain SHALL return the continue band, write one repaired result line and increment the round counter when the fixable check repairs the cause.

Scenario: A repaired cause returns the continue band

  • WHEN The fake site check exits 0 and the fake evidence builder returns the continue band on its next evaluation.
  • THEN The test asserts the continue band and one result line with result="repaired". It also asserts one increment of devops_cli_roadmap_fix_rounds_total with result="repaired".

Requirement: Unrepaired round returns the flag band

The chain SHALL return the flag band, write one unrepaired result line and increment the round counter when the fixable check does not repair the cause.

Scenario: An unrepaired cause returns the flag band

  • WHEN The fake site check exits non-zero.
  • THEN The test asserts the flag band and one result line with result="unrepaired". It also asserts one increment of devops_cli_roadmap_fix_rounds_total with result="unrepaired".

Requirement: Round limit stops the rounds

The chain SHALL stop the fix rounds at the round limit of the decision point.

Scenario: The rounds stop at the limit

  • WHEN Each round leaves the fake evidence builder at the flag band and the point sets a round limit of 2.
  • THEN The test asserts two rounds and one result line with result="exhausted". It also asserts one increment of devops_cli_roadmap_fix_rounds_total with result="exhausted".

Requirement: Token budget stops a round

The chain MUST stop a fix round when its token budget is spent.

Scenario: The token budget stops the round

  • WHEN A fix round spends the token budget of the decision point before the check returns.
  • THEN The test asserts that the chain stops the round and writes result="exhausted". It also asserts one increment of devops_cli_roadmap_fix_rounds_total with result="exhausted".

Requirement: Series bound for the two counters

Each of the two counters SHALL declare a series bound, and a test MUST hold every label set under it.

Scenario: Every label set fits the declared bound

  • WHEN A test reads the metric definitions in src/devops_cli/telemetry/instruments.py and the closed label values of the two counters.
  • THEN The test asserts that each label product is at most the declared bound and that no label value is free text.

Requirement: No round while the Service drains

The chain SHALL NOT start a fix round while the Service drains.

Scenario: A drain stops the round

  • WHEN The Service drain flag is set and the fake evidence builder returns the flag band.
  • THEN The test asserts no run of the fake site check and one result line with result="drained". It also asserts one increment of devops_cli_roadmap_fix_rounds_total with result="drained".

Requirement: Marker holds the round state

The chain SHALL write the marker with the key, the rounds and the result before it returns.

Scenario: A second run resumes from the marker

  • WHEN A round ran and wrote a terminal result, and the chain runs again for the same key.
  • THEN The test asserts that the chain reads the marker, returns the recorded result and starts no round.

Existing Tool Considered

No alternatives check has run for this item. The open, maintained library tenacity covers the bounded retry loop with rounds and a stop condition. It does not cover the site check, the marker or the series bound of a metric. The project builds those parts itself. Written cost: about 25k output tokens to build, about 8k tokens each month to keep and fix, and about one engineer-day.

Key questions

  • When does the fixable check run at a decision point?: Only when the chain would return the flag band and the site of the point registers a fixable check. The chain runs no check on the continue or the review band. (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: Run the check only before the flag band. It is the band that stops the chain, and the body names it as the place of the fixable check.
    • Rejected: Run the check on every band. The continue band already holds, and the extra run spends tokens for no repair.
    • Rejected: Run the check after the flag band is recorded. The chain has already stopped at that point, so no round can return the continue band.
  • What does one round repair?: The round runs the one check command that the site registers and lets its fix step repair the cause. It then runs the evidence builder of the point again. The new band decides the round. (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: Run the site check, then the evidence builder. It repeats the fix-checks pattern of ADR 0021 section 8, so one module and one command serve every caller.
    • Rejected: Run the decision model again. The model gives a different answer on the same evidence, and it adds calls with no repair.
    • Rejected: Let a model edit the code with no bound. The body asks for a token bound, and an open edit has no bound.
  • How does a round end?: A round ends with one of four results. repaired means the check exits 0 and the evidence builder returns the continue band. unrepaired means the check exits non-zero. exhausted means the rounds or the token budget are spent. drained means the Service drains. (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: One closed result set of four values. A closed set bounds the label and lets a test check each end of a round.
    • Rejected: A free-text result line. The text gives no bound on the series and no test can check it.
  • What bounds the two label sets?: Each label takes a value from a closed set that the emitting code declares. site and path name the decision point in the registry. resolver is one of rule, model and current. result is one of repaired, unrepaired, exhausted and drained. Each counter declares a constant bound. A test asserts that the product of its label sets stays under the bound. (best practice) [sources: CONTEXT.md, src/devops_cli/telemetry/instruments.py]
    • Chosen: Closed label values with a declared bound and a test. The body asks for a bound and a test that holds every label set under it.
    • Rejected: Free-text label values. A free value makes an unbounded series on the counter.
    • Rejected: No label at all. The body names site, path, resolver and result, and a split count would hide the failing site.
  • Where does the chain hold the round state?: The chain holds the round state in the marker of the fix-checks pattern. The marker is keyed by site, path and issue. It holds the rounds and the result. The chain reads the marker before a round and writes it after the round. A second run starts no round that the marker already counts. (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 marker of the fix-checks pattern. It is the pattern the body names, and a marker holds a durable copy of the rounds and the result.
    • Rejected: Valkey only. CONTEXT.md says a due mark is never the only copy of a decision.
    • Rejected: An issue comment. It adds a write to GitHub for each round and no reader needs it.
  • Does a round run while the Service drains?: No. The chain reads the drain flag of the Service first. It runs no check and returns the flag band with result="drained". (best practice) [sources: CONTEXT.md, tests/server/test_server_service.py:1544]
    • Chosen: Stop the round during a drain. The body forbids a round while the Service drains, and a check on a draining host gives no stable result.
    • Rejected: Run the round during a drain. It breaks the rule of the body and spends tokens on a host that is going out of service.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#4847

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 15, 2026
  2. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    ContributorAuthor
  3. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 86358b6 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  4. dan-petty commented on Nov 19, 2026

    @dan-petty
    Owner

    New evidence from the Service config review of 2026-11-19: stage gate returns fix findings, but they also add new ones, and the share of new findings rises with each return.

    Findings fixed and new by gate return, 7 d to 2026-11-19 (Loki {container="stage"} |= "stage gate findings:"):

    Return Fixed New New / fixed
    1 789 137 17%
    2 179 95 53%
    3 81 49 60%
    4 50 25 50%
    5 24 16 67%
    6 17 13 76%
    7 8 10 125%

    The #6319 attempt shows the pattern. Its findings in, gone and new by return were 9/9/1, 1/1/11, 11/7/1, 5/0/1, 6/6/3, 3/3/6, 6/6/10 and 10/9/1. It got extensions at 3 to 6 findings and at 6 to 10 findings. It ended at return 8 with stage_problem_no_quote and stage_problem_module_quote, after 9 plan calls, 16,780,284 tokens and 4746 s. No budget stop ended it.

    The cause is not measured. A return sends the full earlier reply and its problem (_Refused.returned, src/devops_cli/roadmap/stage/stage.py:1293-1296), and the planner writes a whole new StageProposal. No data shows yet that the new findings come from sections that passed before. A mechanical fix-before-refuse exists already (#4853, _rewrite_mechanical, stage.py:1921).

    Proposed order: first measure whether the new findings of a return are in sections that passed the checks before. If they are, send a return as an edit of the refused sections only, or give the planner the deterministic stage checks as a tool, so it can check a section before it replies.

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

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 29e3a03 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

  6. devops-cli-service commented on Nov 25, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions