Skip to content

fix(roadmap): the stage job stops an item whose task group is a few percent over the budget after one split #2838

Description

@dan-petty

What happened

On 2026-10-31 devops roadmap stage --plan leaves out four P1 bugs because one task group of each is over the budget of 40000 tokens:

Each message says "A person decides, or runs the job with --item N". The three groups at 41 to 42 thousand tokens are over by 3% to 5%. Planner._fit in src/devops_cli/roadmap/stage.py asks the model for one split of the groups (self._split_asked). A group that is still over the budget after that split stops the item, and the job does not try again. The measure of a group is measure_groups in stage_change.py: the item and the change folder files (shared), the group text, and the packed files that the group reads and changes.

The four items wait for a person, so the stage job does not reach the default filter's goal: staging every Ready P0 and P1 bug.

What should happen

  • The split is tried more than once. The second ask gets the measured tokens of the groups of the first split and the list of the files that make the most of them, so the model can move a file to another group or drop a read that the group does not need. The number of asks is a constant with a small value, and the job stops the item after the last one, as it does today.
  • Before a new ask, check whether a group can shrink with no model call: a group that reads many files counts each file packed to at most CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS. State in the proposal how many tokens the shared part (item body and change files) costs per group, and whether the shared part, which every group pays, is what keeps the groups over (for fix(security): the subprocess environment guard accepts LESS, which makes less run a program #2735 the item body carries a long refine block).
  • The four items stage without a person.

Evidence

  • uv run devops roadmap stage --plan on 2026-10-31 (the Left out section).
  • Planner._fit and measure_groups.
  • The owner decision of 2026-10-29: a step budget of 40000 tokens of inputs per group.

Acceptance criteria

Proposed design

Problem statement

The stage job stops an item when a task group is over the 40000-token budget after one split ask. Groups that are 3% to 5% over the budget require a person to intervene. This blocks the default filter goal of staging every Ready P0 and P1 bug. Four items (#2735, #2739, #2147, #2747) wait for a person on 2026-10-31.

Acceptance criteria

Requirement: Second split ask

The job SHALL make a second split ask when a group is over the budget after the first split, providing the measured tokens and the top files by token count.

Scenario: Group over budget after first split

  • WHEN A group measures over the budget after the first split ask
  • THEN The job makes a second split ask with the measured tokens and the list of files that contribute the most tokens

Requirement: Stop after last ask

The job SHALL stop the item and name the group when a group is still over the budget after the last split ask.

Scenario: Group over budget after last ask

  • WHEN A group measures over the budget after the last split ask
  • THEN The job stops the item and the comment names the group and its token count

Requirement: Deterministic shrink check

The job SHALL check whether capping each file to CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS brings a group under the budget before making a new split ask.

Scenario: Group shrinks under cap

  • WHEN A group is over the budget but capping its files to 3000 tokens each brings it under the budget
  • THEN The job uses the capped measurement without a model call

Requirement: Shared part cost in proposal

The proposal SHALL state the token cost of the shared part (item body and change files) for each group.

Scenario: Proposal includes shared cost

  • WHEN The job measures a group
  • THEN The proposal output includes the shared part token count for that group

Requirement: Items stage without person

The job SHALL stage at least three of the four items (#2735, #2739, #2147, #2747) without a person deciding.

Scenario: Default filter stages items

  • WHEN The job runs with the default filter on 2026-10-31 data
  • THEN At least three of the four items appear in the ready list

Requirement: CI passes

The change SHALL pass uv run devops ci.

Scenario: CI check

  • WHEN uv run devops ci runs on the change
  • THEN All checks pass

Existing Tool Considered

No check has run. No open, maintained tool or library covers this need. The change modifies the existing split logic in src/devops_cli/roadmap/stage.py and the measurement in src/devops_cli/roadmap/stage_change.py. The cost is the tokens to build, keep and fix the multi-ask split loop and the deterministic shrink check in these two files.

Key questions

  • How many split asks should the job make for one item?: Two. The constant CONST_ROADMAP_STAGE_SPLIT_ASKS is 2. The first ask is the current behavior. The second ask gets the measured tokens and the top files. After the second ask, the job stops the item as it does today. (best practice) [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/config/constants.py]
    • Rejected: One split ask (current). Rejected. It stops items that are 3% to 5% over the budget and requires a person.
    • Rejected: Two split asks. Chosen. The second ask gets measured data and the top files, so the model can move a file or drop a read. The cost is one extra model call per item that needs it.
    • Rejected: Three split asks. Rejected. The body says a small value. Two asks cover the 3% to 5% overage. A third ask adds cost with little gain.
  • Should the job check for a deterministic shrink before each new split ask?: Yes. Before a new ask, the job caps each file in the group to CONST_ROADMAP_IMPLEMENT_FILE_MAX_TOKENS (3000 tokens) and re-measures. If the group is under the budget, the job uses the capped measurement and skips the ask. (best practice) [sources: src/devops_cli/config/constants.py:2985, src/devops_cli/roadmap/implement_step.py:284]
    • Rejected: No shrink check. Rejected. It wastes a model call when a deterministic cap would fix the group.
    • Rejected: Shrink check with file cap. Chosen. It is deterministic, costs no model call, and uses the existing constant that the implement job already applies.
  • What is the shared part token cost for fix(security): the subprocess environment guard accepts LESS, which makes less run a program #2735 and fix(security): the subprocess environment guard accepts GH_TELEMETRY_ENDPOINT_URL, which sends gh telemetry to a caller URL #2739?: The shared part is the item body plus the change folder files. For fix(security): the subprocess environment guard accepts LESS, which makes less run a program #2735 the item body carries a long refine block. The exact token count is measured by the job at run time and stated in the proposal output. Refine must run the job to record the number. [sources: src/devops_cli/roadmap/stage.py, src/devops_cli/roadmap/stage_change.py:451]
  • Should the second split ask include the list of files that contribute the most tokens?: Yes. The body states that the second ask gets the measured tokens of the groups and the list of the files that make the most of them, so the model can move a file to another group or drop a read. (best practice) [sources: src/devops_cli/roadmap/stage.py]
    • Rejected: Tokens only. Rejected. The model cannot decide which file to move without knowing which files cost the most.
    • Rejected: Tokens plus top files. Chosen. The body requests it. It lets the model move a file or drop a read that the group does not need.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Oct 31, 2026
  2. dan-petty commented on Oct 31, 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: P1-High.
    • Value: High.
    • Effort: Medium.
  3. added
    priority/p1-high
    on Oct 31, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 31, 2026
  5. devops-cli-service commented on Oct 31, 2026

    @devops-cli-service
    Contributor

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

  6. devops-cli-service commented on Oct 31, 2026

    @devops-cli-service
    Contributor

    The stage job stopped. The inputs of the step of the task group "Add CONST_ROADMAP_STAGE_SPLIT_ASKS constant" hold 42879 tokens, over the budget of 40000 tokens, also after the model split the groups once. A person decides how to split the item. The job stages the item again when a person runs it with --item 2838.

    The task groups:

    1. Write test for CONST_ROADMAP_STAGE_SPLIT_ASKS: 4723 tokens
    2. Add CONST_ROADMAP_STAGE_SPLIT_ASKS constant: 42879 tokens
    3. Add shared tokens and top files to MeasuredGroup: 6672 tokens
    4. Make the split ask loop up to two times with shrink check: 8341 tokens
    5. State the shared part token cost in the proposal output: 8249 tokens
  7. added
    status/in-progress
    and removed
    status/ready
    on Oct 31, 2026
  8. dan-petty commented on Oct 31, 2026

    @dan-petty
    OwnerAuthor

    Evidence for the fix in pull request #2847. The pull request does not build the second split ask, and it replaces the first two acceptance criteria.

  9. added
    status/in-review
    and removed
    status/in-progress
    on Oct 31, 2026
  10. removed
    status/in-review
    on Oct 31, 2026
  11. added a commit that references this issue on Oct 31, 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/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions