Skip to content

feat(roadmap): stage limits changed files per task group #3995

Closed

Description

@dan-petty

Problem or Motivation

devops roadmap stage measures task group token consumption from the files that a group reads (Reads:) and estimated created lines. It sets no limit on the number of files that a group changes (Changes:). When one task group changes many files across different subsystems, an implementation step can exhaust its token budget. For example, issue #3654 group 3 changed 7 files across CLI commands, configuration constants, language catalogs, Kubernetes controller modules, tests, and user documentation. The implement runner hit its 8,000,000 token budget limit and stopped as blocked.

Proposed Solution & Architectural Design

Add a check in src/devops_cli/roadmap/stage/stage_change.py that bounds the number of changed files in one task group:

  • A task group allows at most 4 files in Changes:.
  • When a task group has more than 4 files in Changes:, stage asks the model to split the group into smaller task groups.
  • Alternatively, documentation files (such as k8s/README.md or docs/) that follow a new command must live in a separate follow-up group.

Target Subsystem

AI & Agentic Review Pipeline

Existing Tool Considered

No open tool manages OpenSpec task group file sizing. This change adds a small bound check in stage_change.py: 1,000 tokens to build, 100 each quarter to keep, and 15 minutes.

Alternatives check of 2026-11-09: none.
Tool: none found.

Proposed design

Problem statement

The stage job bounds the tokens that a task group reads and the lines that it creates. It sets no bound on the number of files that the group changes. A group with 7 files exhausted the implement token budget. The change adds a group-files gate that refuses a group over 5 changed files, except a prefix move, and it states the rule in the staging prompt and the roadmap workflow document.

Acceptance criteria

Requirement: Group file limit

The plan check SHALL refuse a task group that lists more than 5 paths in its changes, unless the group is a prefix move.

Scenario: A group over the limit

  • WHEN check_gates judges a plan whose second group lists 6 paths in changes and is no prefix move.
  • THEN The group-files gate holds one sentence for that group.

Requirement: Group at the limit

The plan check SHALL accept a task group that lists 5 paths in its changes.

Scenario: A group at the limit

  • WHEN check_gates judges a plan whose every group lists 5 paths in changes.
  • THEN The group-files gate holds no sentence.

Requirement: Prefix move exemption

The plan check SHALL accept a task group whose changes holds only the old modules of one prefix move and the modules that the group creates.

Scenario: A prefix move over the limit

  • WHEN check_gates judges a plan whose group moves 5 modules and lists those 5 old paths and 5 new paths in changes.
  • THEN The group-files gate holds no sentence.

Requirement: Prefix move with an extra file

The plan check SHALL refuse a group that moves a prefix and also changes a path outside the move when the group lists more than 5 paths.

Scenario: A prefix move with an extra document

  • WHEN check_gates judges a plan whose group moves 5 modules and also changes docs/ROADMAP_WORKFLOW.md.
  • THEN The group-files gate holds one sentence for that group.

Requirement: Refusal text

The refusal SHALL name the number of the group, its title and the number of paths that it changes.

Scenario: The refusal names the group

  • WHEN A group titled Wire the check lists 6 paths in changes and is no prefix move.
  • THEN The sentence holds 2, Wire the check and 6.

Requirement: Split reply

A split reply SHALL obey the same file limit as the first reply.

Scenario: A split that keeps a large group

  • WHEN The model's split reply holds a group that lists 6 paths in changes and is no prefix move.
  • THEN The check returns one group-files sentence for that group.

Requirement: Staging prompt

The staging prompt SHALL state the limit of 5 files in Changes:, the prefix-move exemption and the instruction to split a larger group.

Scenario: The prompt states the limit

  • WHEN The prompt-rule test reads src/devops_cli/ai/tasks/roadmap_stage_change.md.
  • THEN The prompt holds the limit of 5 files, the prefix-move exemption and the split instruction.

Requirement: Workflow document

The roadmap workflow document SHALL state the limit of 5 files in Changes:, the prefix-move exemption and the split of a larger group.

Scenario: The stage section states the limit

  • WHEN git grep reads the stage section of docs/ROADMAP_WORKFLOW.md.
  • THEN It finds the limit of 5 files, the prefix-move exemption and the split instruction.

Existing Tool Considered

The alternatives check found no open, maintained tool or library that bounds the files in a task group of an OpenSpec plan. The change builds its own code: about 1,000 tokens to build, 100 tokens each quarter to keep and fix, and 15 minutes.

Key questions

  • How many files may one task group change?: At most 5 files in Changes:, unless the group is a prefix move. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/roadmap/stage/stage_eval_gates.py]
    • Rejected: 4 files. It refuses two accepted plans with a 5-path other group and one accepted prefix move with 10 paths.
    • Chosen: 5 files. It accepts the 5-path accepted plans and refuses the reported 7-file behavior group.
    • Rejected: 10 files. It accepts the reported 7-file group, so the token failure stays possible.
  • How does the gate treat a prefix move?: It exempts a group whose changes holds only the old modules of one prefix move and the modules that the group creates. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Rejected: Count every path. It refuses the accepted 10-path prefix move.
    • Rejected: Exempt any group that moves a module. A move with extra files escapes the limit.
    • Chosen: Exempt only a group that holds the old and new modules of one move. It keeps the accepted move and bounds extra work.
  • Which gate reports the limit?: A new ProposalGate.GROUP_FILES gate, with the name group-files. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/roadmap/stage/stage_eval_gates.py]
    • Rejected: Extend the paths gate. The paths gate judges the files of the commit, not the size of a group.
    • Chosen: A new group-files gate. The name tells a person which rule refused a plan, and the replay reports it.
  • Is the limit a setting or a module constant?: A module constant, MAX_GROUP_CHANGES = 5, in stage_change.py. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Module constant. The plan-check rules are constants today.
    • Rejected: Setting roadmap.stage.group_files. A setting needs a live ConfigMap change and a restart.
  • Must the staging prompt and the roadmap workflow document state the limit?: Yes. The prompt and the stage section of docs/ROADMAP_WORKFLOW.md state the limit of 5, the prefix-move exemption and the split instruction. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, tests/roadmap/stage/test_roadmap_stage_prompt_rules.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: State the limit in both. The model avoids the refusal, and a person reads the rule.
    • Rejected: Let the refusal teach the rule. The refusal costs a model call and a second reply for each item.
  • Does a split reply obey the same file limit?: Yes. The check applies the same group-files rule to each group of a split reply. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py, src/devops_cli/ai/tasks/roadmap_stage_change.md]
    • Chosen: Apply the limit to split replies. A split cannot keep a group over the limit.
    • Rejected: Apply the limit only to the first reply. The split can return the same large group.
  • Does a separate follow-up group for documentation replace the file limit?: No. The count bound covers every kind of file, and the prefix-move exemption covers a move. A separate rule would forbid a group that documents its own change. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Count bound. One rule bounds every kind of file.
    • Rejected: Move documents to a follow-up group. It forbids a group that documents its own change in one file, and it bounds no code file.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    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 prevents a known token-budget failure but does not block a release or fix a crash.
    • Value: Medium. It stops a class of blocked implement runs caused by oversized task groups.
    • Effort: Low. The body states a 15-minute bound check in one file.
    • Related: fix(roadmap): stage gates task groups against empty packed files #3965, which asks for a different change. Both add a stage gate on task-group file properties, but #3965 rejects zero-file groups while this candidate caps groups at four changed files.
  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 1f03ee3 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Two searches found no open tool that bounds the number of files a task group changes in an OpenSpec plan; the results were unrelated web-API pages. The need is a project-specific gate in stage_change.py that fits the repo's own plan format and its refusal-and-split loop, so no external tool covers it.

    Tool: none found

    Lacks:

    • No tool limits the files in a task group's Changes: list
    • No tool plugs into the repo's stage gates and split-reply loop

    Searches run:

    • OpenSpec validate task group limit number of files per task, results: 5
    • Fission-AI OpenSpec task plan lint tasks.md size limit, results: 5

    Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.

  7. dan-petty commented on Nov 14, 2026

    @dan-petty
    OwnerAuthor

    The item cannot be built as specified. A hard limit of 4 paths in Changes: refuses a plan that the stage job must accept.

    • The prefix-move rule requires every module of a moved prefix in the Changes: of one group: src/devops_cli/ai/tasks/roadmap_stage_change.md:31 and docs/ROADMAP_WORKFLOW.md:99.
    • The accepted move plan tests/fixtures/roadmap_eval/stage/3372-the-stage-plan-of-a-module/plan.json has one group with 10 changed paths. With MAX_GROUP_CHANGES = 4, the gate group-files refuses it, so tests/roadmap/stage/test_roadmap_stage_negative_search.py::test_a_negative_search_whose_recorded_hit_survives_is_accepted and 12 other stage tests fail.
    • Two golden plans also exceeded the limit: good-3264-the-stage-marks-a-plan-ready and good-3410-the-stage-gate-proves-a-negative each hold a 5-path other group.

    Local result with the gate added: uv run pytest tests/roadmap/stage -q gave 13 failed, 2816 passed.

    Amendment for refinement: exempt a group whose paths are the modules of one prefix move, or bound only the source files that are not moved, or raise the limit to 10. The count of changed paths alone cannot separate the reported 7-file behavior group from a legitimate prefix move.

  8. added
    status/new
    and removed
    status/ready
    on Nov 14, 2026
  9. added
    status/ready
    and removed
    status/new
    on Nov 14, 2026
  10. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

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

  11. added
    owner/agent
    on Nov 16, 2026
  12. added
    status/in-review
    and removed
    status/ready
    on Nov 16, 2026
  13. removed
    status/in-review
    owner/agent
    on Nov 16, 2026
  14. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-16 11:49 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/lowpriority/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