Skip to content

fix(roadmap): stage stops a plan just over the step budget #6447

Not planned

Description

@dan-petty

Problem Description

The stage job holds a Ready item for an owner decision when one task group is a little over the step budget after one split. The step budget is a hard cap: no fixable check runs and no bounded extension exists.

Example: #3655 (Ready, all dependencies closed). Stage comment of 2026-11-17T00:02Z: "The inputs of the step of the task group "Create the roadmap pipeline dashboard file" hold 65069 tokens, over the budget of 64000 tokens, also after the model split the groups once. Split the group or raise the budget of the step?" The group is 1.7% over. owner_question.answer is null, so the item has not moved since.

Ready items that the same stop holds on 2026-11-19 (job records, stage.needs_split, stage.file_cap 8000):

Item Stop Group Tokens Over 64,000
#1858 2026-11-12T15:45Z Add the changes job and the image caller to ci.yml 65,323 2.1%
#3742 2026-11-16T07:03Z Read the source files and refuse an invalid labels file 64,154 0.2%
#3907 2026-11-17T16:08Z Request budget, the setting and the ETag cache 66,549 4.0%
#3655 2026-11-17T00:02Z Create the roadmap pipeline dashboard file 65,069 1.7%
#4059 2026-11-18T12:13Z Correct the pre-move paths of the good-3264 plan 65,128 1.8%

The code path:

  1. Planner._fit (src/devops_cli/roadmap/stage/stage.py:2716-2740) asks the model for one split. After that split, "a group over the budget stays over it".
  2. stage.py:2573-2574 returns OverBudget when a measured group is over self._budget (the setting roadmap.stage.step_tokens, default 64,000, src/devops_cli/config/settings.py:1452-1456).
  3. _stop_on_budget (stage.py:4071-4096) posts the owner question and records stage.needs_split. _recorded_split (stage.py:865-870) then leaves the item out of each round until a person answers.

No soft cap applies here:

  • The decision point table registers only alternatives.reply_fixable and stage.verify_screen (src/devops_cli/roadmap/decision_table.py:25-30). No point covers the step budget.
  • step_tokens has no hard ceiling (ge=1000 only). Other caps of the jobs use CONST_ROADMAP_LIMIT_CEILING_FACTOR (src/devops_cli/config/constants.py:3491) for their ceiling.
  • A split moves files between groups. It cannot make one file smaller (fix(roadmap): the stage job stops an item whose task group is a few percent over the budget after one split #2838, evidence comment of 2026-10-31). The stage measure adds 32 tokens for each estimated line of a created file (CREATED_LINE_TOKENS, src/devops_cli/roadmap/stage/stage_change.py:139). So the recommendation of the question, "Split the group" (src/devops_cli/lang/en/messages.py:4575-4577), cannot help a group that creates one large file, such as the dashboard file of feat(roadmap): a dashboard and alerts for the pipeline #3655.

The owner direction of 2026-11-11, quoted word for word in tracker #4843: "keep loosening restrictions and caps, adding dynamic cap extensions using a decision model to judge if progress is being made, and make sure there is a step to identify if something is fixable before being refused or rejected". #4843 covers "the caps, budgets, gates, screens, holds and return rules" of stage. Its child list has no child for this stop, and it keeps the value roadmap.stage.step_tokens 64000.

One constraint: the CI Plan Check measures the plan with the same setting (src/devops_cli/roadmap/plan_check.py:647). An extension that only the stage job knows makes the CI check refuse the plan that stage pushed (the stage and CI disagreement of #4725).

Reproduction Steps

  1. Read the job record of feat(roadmap): a dashboard and alerts for the pipeline #3655: stage.needs_split "Create the roadmap pipeline dashboard file (65069 tokens)", stage.file_cap 8000, owner_question.answer null.
  2. Read the job records of ci(image): move the image checks to one path-filtered workflow #1858, feat(roadmap): onboard writes labels.yml and clear-status.yml from --from #3742, feat(research): watch upstream releases of the pins #3907 and test(invariants): validate stage eval fixtures against schema and tree #4059: each holds stage.needs_split with a group of 64,154 to 66,549 tokens, stage.file_cap 8000 and no answer. _recorded_split (stage.py:865-870) leaves each item out of every stage round while the record stays.
  3. Read src/devops_cli/roadmap/decision_table.py:25-30: no point for the step budget.

Expected vs Actual Behavior

Expected:

  • At the step budget, the stage job first runs a fixable check. Then a rule, or the soft-cap chain of feat(roadmap): add the soft-cap and fix-check chain to decision points #4847, grants a bounded extension for a group a little over the budget, up to a hard ceiling. The job records the extension and counts each decision.
  • The plan records the extension, so the CI Plan Check measures the group with the same limit.
  • Only a group over the hard ceiling makes an owner question.

Actual: a group 0.2% to 4.0% over the budget stops the item and waits for a person. 5 Ready items wait for this reason, the oldest since 2026-11-12.

Environment Diagnostics

  • DevOps CLI Version: 0.180.0 (origin/main 0d90de5)
  • Python Version: 3.14.10
  • Execution Environment: the stage job of the roadmap Service in the cluster; the records were read from the issue bodies.

Logs, Traces, or Terminal Output

# Stage comment on #3655, 2026-11-17T00:02:46Z
**Owner question:** The inputs of the step of the task group "Create the roadmap pipeline
dashboard file" hold 65069 tokens, over the budget of 64000 tokens, also after the model split
the groups once. Split the group or raise the budget of the step?
**Recommendation:** Split the group: the plan check keeps the budget of the step.

# Job records, 2026-11-19 (stage.needs_split | stage.file_cap | owner_question.answer)
#4059 Correct the pre-move paths of the good-3264 plan (65128 tokens) | 8000 | None
#3907 Request budget, the setting and the ETag cache (66549 tokens) | 8000 | None
#3742 Read the source files and refuse an invalid labels file (64154 tokens) | 8000 | None
#3655 Create the roadmap pipeline dashboard file (65069 tokens) | 8000 | None
#1858 Add the changes job and the image caller to ci.yml (65323 tokens) | 8000 | None

Pre-Submission Checklist

Acceptance Criteria

Dependencies

Alternatives check of 2026-11-29: none.
Tool: none found.
Reason: Searches returned no tool that measures or extends a stage step budget; OpenSpec is already the project's change-proposal layer and only holds the metadata file. The budget extension, hard ceiling, fixable check and plan-check limit are project code.

Covers:

  • Holds the change proposal and metadata file that travel with the plan
  • Accepts tool-specific x- keys in its metadata file
  • Validates proposal structure and strict change schemas

Lacks:

  • No token measure of a task group or step
  • No budget, extension or hard ceiling setting
  • No fixable check before a stop, no decision counter

Proposed design

Problem statement

Add a bounded extension with a hard ceiling to the stage step budget. The stage job runs a fixable check first. It grants the extension for a group a little over the budget and records it in .openspec.yaml. The CI Plan Check uses the same limit, and a counter records each decision. #6521 must merge first. A person must run the live proof on the five items after the release.

Acceptance criteria

Requirement: Group within the extension

The stage job SHALL grant a bounded extension to a group over the step budget and within the hard ceiling, and record it in .openspec.yaml.

Scenario: Replay #3655

  • WHEN A test runs the stage job on one group that creates one file and holds 65,069 tokens, with a step budget of 64,000 and an extension of 16,000.
  • THEN The test asserts that the item is staged, .openspec.yaml holds an x-step-budget-extension entry of 16,000 tokens for that group, and no owner question is posted.

Requirement: Group over the hard ceiling

The stage job MUST post the owner question for a group over the hard ceiling and MUST name the ceiling in the question.

Scenario: Group over the hard ceiling

  • WHEN A test runs the stage job on a group of 80,001 tokens with a step budget of 64,000 and an extension of 16,000.
  • THEN The test asserts that the item is stopped, the owner question names the hard ceiling of 80,000, and .openspec.yaml records no extension for that group.

Requirement: Plan check reads the extension

The plan check MUST apply each recorded extension to the group that the entry names and MUST refuse the group without the entry.

Scenario: Group with and without the extension record

  • WHEN A test runs the plan check on a group of 65,069 tokens with an x-step-budget-extension entry of 16,000, once with and once without the entry.
  • THEN The test asserts that the check passes with the entry and reports the group over the budget without it.

Requirement: Extension covers only its group

The plan check MUST refuse a group over the step budget that no extension entry names.

Scenario: Second group over the budget

  • WHEN A test runs the plan check on a change folder whose extension entry names group 1, while group 2 is over the step budget.
  • THEN The test asserts that the check reports group 2 over the budget.

Requirement: Fixable check and counter

The stage job MUST run the fixable check first and MUST add one count to the step-budget counter for each decision.

Scenario: Fixable, extended and flagged groups

  • WHEN A test runs the stage job on a fixable group, a non-fixable group within the extension and a group over the hard ceiling.
  • THEN The test asserts that the fixable check ran first and devops_cli_roadmap_stage_step_budget_total shows one fixed, one extended and one flagged.

Requirement: Extension ceiling

The settings load MUST refuse a roadmap.stage.step_tokens_extension above CONST_ROADMAP_LIMIT_CEILING_FACTOR times its default with an error that names the setting.

Scenario: Extension above the ceiling

  • WHEN A test loads the settings with DEVOPS_CLI_ROADMAP_STAGE_STEP_TOKENS_EXTENSION set to one token above CONST_ROADMAP_LIMIT_CEILING_FACTOR times the default.
  • THEN The test asserts that the load fails with an error that names roadmap.stage.step_tokens_extension.

Requirement: Plan check bounds the extension

The plan check MUST refuse an x-step-budget-extension entry above roadmap.stage.step_tokens_extension.

Scenario: Extension entry above the setting

  • WHEN A test runs the plan check on a group of 65,069 tokens with an x-step-budget-extension entry of 16,001 tokens while roadmap.stage.step_tokens_extension is 16,000.
  • THEN The test asserts that the check reports the entry over the extension limit.

Requirement: Pending a person after the merge

After #6521 merges and a release ships, a person MUST run the stage job on #3655, #1858, #3742, #3907 and #4059 and MUST comment the result of each item.

Scenario: Live proof on the five items

  • WHEN After chore(roadmap): hold incremental stage and implement work #6521 merges and a release ships, a person runs devops roadmap stage on the five items.
  • THEN Each item stages with no owner question, or gets one owner question that names the hard ceiling of 80,000 tokens, and the comment gives the result of each item.

Existing Tool Considered

The alternatives check of 2026-11-23 records the verdict none and names no tool. See the alternatives block in the issue body for what it lacks. The change builds its own code: about 40,000 tokens to build, about 8,000 tokens for each of 2 fixes, and about 2 days elapsed.

Key questions

  • What is the hard ceiling for a task group over the step budget, and how much may the extension add?: Add roadmap.stage.step_tokens_extension, default 16,000 tokens. The hard ceiling is roadmap.stage.step_tokens plus the extension, 80,000 at the defaults. The settings load refuses an extension above CONST_ROADMAP_LIMIT_CEILING_FACTOR times its default with an error that names the setting. (best practice) [sources: src/devops_cli/config/settings.py:1452, src/devops_cli/config/constants.py:3756, src/devops_cli/roadmap/stage/stage.py:2573]
    • Chosen: A fixed extension setting. The project caps each limit with CONST_ROADMAP_LIMIT_CEILING_FACTOR times its default. 16,000 covers the five items.
    • Rejected: Four times the step budget. 256,000 tokens hides a bad plan and is not a little over the budget.
    • Rejected: A percentage with no setting. The project holds each cap as a setting with a ceiling.
  • How does the plan record the extension so the CI Plan Check measures the task group with the same limit?: The stage job writes a tool-specific x-step-budget-extension list into the change folder's .openspec.yaml. Each entry gives the group title and the token allowance. The plan check reads the list from the checkout at the pull request head and adds the allowance to the step budget of the named group only. (best practice) [sources: src/devops_cli/roadmap/plan_check.py:647, src/devops_cli/roadmap/stage/stage_change.py, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
    • Chosen: A tool-specific key in .openspec.yaml. The metadata file travels with the plan, the plan check reads it at the head, and ADR 0010 accepts a tool-specific x- key.
    • Rejected: A hidden line in tasks.md. tasks.md is the rendered task file, not the metadata file, and a later edit can drop the record.
    • Rejected: Raise the global setting for the item. It changes the limit for every item and breaks the plan check of other items.
    • Rejected: Read the item job record in the plan check. The plan check runs in CI and does not read the item's marks.
  • Where does the fixable check come from?: A rule makes a group fixable when it names more than one file and no single file alone is over the step budget. The stage asks the model for one more split for a fixable group. A group with one file, or with one file alone over the budget, is not fixable and gets the extension. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:2716, src/devops_cli/roadmap/stage/stage_change.py:143]
  • What counter records each budget decision?: A Prometheus counter devops_cli_roadmap_stage_step_budget_total with a closed result label: fixed, extended and flagged. Each decision adds one. The counter sits beside the existing stage counters and is described in docs/TELEMETRY.md. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:4071, docs/TELEMETRY.md]
    • Chosen: A counter with a closed result label. The label set is bounded and each decision adds one.
    • Rejected: A log line only. The project counts each decision for the dashboard.
    • Rejected: A gauge. A gauge shows a level, not a count of decisions.
  • Does the rule-based extension need feat(roadmap): add the soft-cap and fix-check chain to decision points #4847 done first?: No. The rule ships as the stage job's behavior now: it grants the bounded extension and needs no model call. Registering the decision point stage.step_budget waits for the soft-cap chain of feat(roadmap): add the soft-cap and fix-check chain to decision points #4847 and for a row in the catalogue of ADR 0020. feat(roadmap): add the soft-cap and fix-check chain to decision points #4847 later adds the point and turns it on. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, src/devops_cli/roadmap/decision_table.py:22, src/devops_cli/roadmap/stage/stage.py:2716]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Activity

  1. added
    type/bug
    source/agent
    scope/roadmap
    on Nov 19, 2026
  2. dan-petty commented on Nov 19, 2026

    @dan-petty
    OwnerAuthor
  3. added
    status/new
    value/medium
    effort/medium
    priority/p1-high
    on Nov 19, 2026
  4. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  5. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

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

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  7. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  8. devops-cli-service commented on Nov 23, 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 (8)

    Tools considered:

    Searches run:

    • workflow task token budget soft cap extension hard ceiling library, results: 5
    • open source library enforce per-step token budget with bounded extension and metrics, results: 5
    • LLM agent token budget guardrail open source library per-step limit, results: 5
    • github project token budget hard cap soft limit extension for task splitting, results: 5
    • OpenSpec spec-driven development change proposal validation tool, results: 5
    • pydantic-ai usage limits total_tokens_limit request_limit, results: 5
    • openspec github change proposal yaml metadata, results: 5
    • github pydantic pydantic-ai usage limits, results: 5

    Sources:

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

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  10. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.

  11. removed
    status/new
    on Nov 30, 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/p1-highscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions