Skip to content

fix(roadmap): plan-check measures each group of the current plan #3499

Closed

Description

@dan-petty

Problem

The stage comment gives a token figure for each group. That figure goes stale when the plan or its named files change, and no gate measures it again. plan_check.py has no token measure. The step refuses only above window minus reserve: 128000 - 40000 = 88000 (implement_step.py:321-322). So a plan over the stage budget of 40000 can start a run. This hurts the implement job, which spends the input tokens, and the person who reads the figure.

Group 1, stage comment against the current plan. Each current figure is approximate and leaves out the prompt (1810 tokens) and the tool schemas:

Plan pull request #3339 for #3331 holds a commit of a person that changes the plan. Nobody checked the commits of the other 3 plans, so the cause of those rises is not proved.

named_files gives 0 files for #3320 groups 2 to 4 and for #3368 group 1 in the tree of 2026-11-04T15:06Z. The docstring of _read_tokens (stage_change.py:927) says that the step ignores a file that only Reads: lists. This is a stated design.

No figure shows the size of a first request. implement_trace.py encode drops the oldest events first, with a limit of 8192 characters. The #2636 record holds 77 events and drops 154, and its run made 116 requests. So the gap between a stage figure and a first request is not measured.

Expected

plan-check measures each group of the current plan with measure_groups, the function of the stage job. It reports a group over the budget and a group that packs no file. It reads the budget from the setting roadmap.stage.step_tokens of the stage job. src/devops_cli/config/defaults.py:785 and k8s/devops/configmap.example.yaml:66 give 64000, but all 18 stage comments of the window 2026-11-03T15:05Z to 2026-11-04T15:05Z state 40000. So the deployed value is 40000 (inferred). With 64000, neither figure above is over the budget.

The run record holds the size of the first request of a step, so a person can compare the stage figure with the model. The same gate can then refuse an over-budget plan at implement, through #3393.

Open question for the plan: must the step read the files of the Reads: line? This reverses a stated design, and no evidence shows that it lowers the cost. This issue does not require it.

Acceptance criteria

  • plan-check calls measure_groups. A test holds that the figure of plan-check equals the figure of the stage job for the same plan.
  • A test: plan-check prints each group over the budget.
  • A test: plan-check prints each group with 0 packed files.
  • A test: the run record of a fixture step holds the size of its first request.
  • A test: a fixture step with more events than the trace limit keeps the size of its first request, and its trace has a dropped count above 0.

Existing tool considered

Project code covers the need: measure_groups and _read_tokens (stage_change.py:924-956), count_tokens, rules_sections, named_files and packed_file. No outside tool knows the step inputs of this project.

Dependencies

Related

Related: #3393, #3446, #2147

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 4, 2026
  2. dan-petty commented on Nov 4, 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. Stale token figures can let over-budget plans start a run, but a stage gate already exists at a higher threshold, so this is a meaningful but non-blocking gap.
    • Value: Medium. It gives a person a current token figure per group before a run starts, reducing wasted implement runs and stale stage comments.
    • Effort: Medium. It wires measure_groups into plan-check, adds two report branches, and records first-request size in the run record, with five acceptance tests.
    • Related: fix(roadmap): the plan group size measure differs between the stage and the Job #3265, which asks for a different change. Both concern token budget measurement per plan group; #3265 fixed the measure function so stage and Job agree, while the candidate adds a new reporting step in plan-check that calls that measure and flags over-budget or empty groups.
  3. added
    priority/p2-medium
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 4, 2026
  4. removed
    status/in-review
    on Nov 5, 2026
  5. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor
  6. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-05 19:48 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/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions