Skip to content

fix(roadmap): the cost check refuses a time in days #4293

Closed

Description

@dan-petty

Problem

The cost check of the stage job refuses a plan that gives its cost. It accepts a time only as a number of hours or minutes in digits. A plan that states the time in days or weeks, or with a number word, gets the problem "builds_own is true, and existing_tool gives no cost".

Rule 3 of AGENTS.md asks for "tokens to build, keep and fix it, and elapsed time". _TIME_COST in src/devops_cli/roadmap/stage/stage_change.py reads \d+ (hours|minutes) only. Work of a day or more is natural to state in days.

Evidence: a live stage run on item #3599 with the live stage model (deepseek-v4.1-flash-1017), 2026-11-09. The first reply was refused with: "builds_own is true, and existing_tool gives no cost. Write the tokens to build the code (for example 80k tokens) and the time (for example 4 hours)." Its existing_tool held: "Written cost: about 45k tokens to build, about 8k tokens each month to keep and fix, and about two days of elapsed time." The cost is there. The second reply used "16 hours" and passed this check. The Service logs of the stage job show the same problem for 8 failures in 7 days (#3451, #3398, #4004, #4028, #3742, #4043).

Expected

  • existing_tool states the time as a number of minutes, hours, days or weeks, with a digit or with a number word from one to twelve (a, an).
  • A text with no count of tokens, or with no count of time, is still refused.

Acceptance criteria

  • uv run devops ci test tests/roadmap/stage/test_roadmap_stage_cost_units.py passes. It fails on the base.
  • uv run devops roadmap eval stage --replay keeps its result: every gate refuses what it must refuse, and 5 of 5 good plans pass.

Existing tool considered

No library reads an amount of work. The change adds units and a short list of number words to one pattern. Cost: about 10 000 tokens to build, 2 000 to keep, and 30 minutes.

Proposed design

Problem statement

The cost check of the stage job refuses a plan that states its time in days or weeks, or with a number word. _TIME_COST in src/devops_cli/roadmap/stage/stage_change.py reads only digits with hours or minutes. A plan that says "about two days of elapsed time" gets the problem "builds_own is true, and existing_tool gives no cost", and the stage job wastes a model call on a retry. The job logged 8 such failures in 7 days.

Acceptance criteria

Requirement: Time in days or weeks

The cost check of content_problems SHALL accept a time given as a number of minutes, hours, days or weeks.

Scenario: A time in days

  • WHEN A plan has builds_own true and an existing_tool text with "45k tokens" and "3 days".
  • THEN content_problems returns no cost problem for the plan.

Requirement: Time with a number word

The cost check of content_problems SHALL accept a time given with a number word from one to twelve, or with the article a or an.

Scenario: A time with a number word

  • WHEN A plan has builds_own true and an existing_tool text with "about 45k tokens" and "about two days of elapsed time".
  • THEN content_problems returns no cost problem for the plan.

Requirement: Article as the count

The cost check of content_problems SHALL accept a or an as the count of a time unit.

Scenario: A time with an article

  • WHEN A plan has builds_own true and an existing_tool text with "10k tokens" and "an hour".
  • THEN content_problems returns no cost problem for the plan.

Requirement: A missing time is refused

The cost check of content_problems MUST refuse an existing_tool text that has no count of time.

Scenario: Tokens with no time

  • WHEN A plan has builds_own true and an existing_tool text with "45k tokens" and no time.
  • THEN content_problems returns the problem that stage_problem_no_cost states.

Requirement: A missing token count is refused

The cost check of content_problems MUST refuse an existing_tool text that has no count of tokens.

Scenario: Time with no tokens

  • WHEN A plan has builds_own true and an existing_tool text with "two days" and no count of tokens.
  • THEN content_problems returns the problem that stage_problem_no_cost states.

Requirement: A unit word alone is refused

The cost check of content_problems MUST refuse a time unit that has no count before it.

Scenario: Unit with no count

  • WHEN A plan has builds_own true and an existing_tool text with "45k tokens" and "days of work".
  • THEN content_problems returns the problem that stage_problem_no_cost states.

Existing Tool Considered

No open library reads an amount of work in a free text, and the check is one regular expression. The change adds the units days and weeks and a short list of number words to _TIME_COST. Written cost: about 10 000 tokens to build, 2 000 tokens to keep and fix, and 30 minutes of elapsed time.

Key questions

  • Which units and number words does the time pattern accept?: It accepts minutes, hours, days and weeks, singular or plural. The count is a digit string as before, or one of the words one to twelve, or the article a or an. A bare unit word with no count stays refused. (best practice) [sources: src/devops_cli/roadmap/stage/stage_change.py:124]
    • Chosen: Extend _TIME_COST with units and number words. It is a small change in one pattern, and it matches the Expected section of the issue.
    • Rejected: Parse the time with a natural-language library. It adds a dependency and risks wrong matches, for a check that needs only a short list of words.
    • Rejected: Drop the time check. Rule 3 of AGENTS.md asks for the elapsed time, and the issue asks to keep the refusal.
  • Which code uses _TIME_COST?: Only content_problems in src/devops_cli/roadmap/stage/stage_change.py reads it, so the change touches one module. The stage eval replay judges plans through the same function. [sources: src/devops_cli/roadmap/stage/stage_change.py:1616]
  • Does the change need a measure of the stage job with the replay?: Yes. stage_change.py is a trigger path of the replay. A task of the plan runs uv run devops roadmap eval stage --replay and states the score before and after the change. [sources: src/devops_cli/roadmap/stage/stage_change.py, AGENTS.md]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 9, 2026
  2. dan-petty commented on Nov 9, 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. The defect causes 8 stage-job failures in 7 days and blocks valid plans that state time in days.
    • Value: Medium. It removes a repeated refusal of valid plans, but the work can be done in hours instead of days.
    • Effort: Low. The change adds units and a short word list to one regex pattern, estimated at 30 minutes.
    • Related: feat(roadmap): cost and token budgets per item and per day #3066, which asks for a different change. Both touch roadmap cost tracking, but #3066 adds daily and per-repo token budgets while the candidate fixes a time-unit regex in the stage cost check.
  3. added
    priority/p1-high
    on Nov 9, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 6c1a629 (see proposed design in issue body).

  6. added
    status/in-progress
    and removed
    status/ready
    on Nov 10, 2026
  7. removed
    status/in-progress
    on Nov 10, 2026
  8. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-10 01:54 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/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