Skip to content

fix(roadmap): default the step ceiling to twice the budget #4505

Closed

Description

@dan-petty

Problem Description

PR #4464 (issue #4394) added the setting roadmap.implement.step_token_ceiling. Its default is a fixed value, 16000000 (DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING = 2 * DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_BUDGET in src/devops_cli/config/defaults.py). It is not 2 times the configured step budget. The after-validator _token_settings_agree in src/devops_cli/config/settings.py refuses a ceiling below step_token_budget.

This causes two problems:

  1. A valid configuration from before the merge does not load now. Before feat(roadmap): extend a step budget when the run makes progress #4464, step_token_budget had only ge=1. Now a person who sets only step_token_budget above 16000000 gets a ValidationError. The settings do not load, so the roadmap Service and the runner do not start.
  2. The extension is smaller than the rule gives. The live ConfigMap sets step_token_budget: 12000000. The rule gives one extension of 50% (to 18000000), but the default ceiling cuts it to 16000000. This is +33%, not +50%.

Issue #4394, requirement "Ceiling default", asks for this behavior: "WHEN the operator sets no ceiling THEN the ceiling is 2 times the step budget". The code and the main spec (openspec/specs/roadmap-implement-step/spec.md, requirement "The ceiling of a step budget is a setting") give a fixed 16000000.

Reproduction Steps

On main at c8ed108 or later:

from devops_cli.config.settings import RoadmapImplementConfig

RoadmapImplementConfig(step_token_budget=12_000_000).step_token_ceiling  # 16000000
RoadmapImplementConfig(step_token_budget=17_000_000)  # ValidationError

The second call fails: Value error, step_token_ceiling must not be below step_token_budget. The same occurs with DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TOKEN_BUDGET=17000000 and no ceiling.

Expected vs Actual Behavior

  • Expected: when no config file and no variable sets step_token_ceiling, the ceiling is 2 times the loaded step_token_budget. A budget of 17000000 loads with a ceiling of 34000000. A budget of 12000000 gets the full extension to 18000000.
  • Expected: an explicit ceiling below the budget is still refused, and the message names step_token_ceiling.
  • Actual: the ceiling is 16000000 for every budget, and a budget above 16000000 with no ceiling stops the settings load.

Proposed fix

  • Make step_token_ceiling int | None with the default None. Resolve None to 2 times step_token_budget in the after-validator (or in StepBudget). Keep the refusal of an explicit ceiling below the budget.
  • Delete DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING, or replace it with a factor constant (2), and update tests/roadmap/test_roadmap_limit_classes.py.
  • Test first: a budget of 17000000 with no ceiling loads with the ceiling 34000000; a budget of 12000000 with no ceiling gives an extension to 18000000.
  • Change the main spec requirement "The ceiling of a step budget is a setting", the field description, docs/ROADMAP_WORKFLOW.md ("default 16000000, twice the default budget") and the generated docs/ENV_VARS.md and docs/CONFIGURATION.md.

Environment Diagnostics

main at c8ed108 (merge of #4464). Live ConfigMap value: roadmap.implement.step_token_budget: 12000000. The live value loads today, so this is not an outage. The risk is the next change of the budget above 16000000.

Logs, Traces, or Terminal Output

12000000 ok ceiling 16000000
17000000 FAIL ValidationError ['1 validation error for RoadmapImplementConfig', '  Value error, step_token_ceiling must not be below step_token_budget [type=value_error]']

Source: review finding on PR #4464 (major), checked against main.

Source: #4464

Proposed design

Problem statement

The step token ceiling has a fixed default of 16,000,000. A configured step budget above that value stops the settings load. The ceiling also cuts the one extension below the 50 percent that the rule gives. The change resolves an unset ceiling to twice the loaded step budget. It keeps the refusal of an explicit ceiling below the budget. It updates the spec, the documents and the tests.

Acceptance criteria

Requirement: Unset ceiling follows the step budget

WHEN no source sets roadmap.implement.step_token_ceiling, the settings SHALL set it to 2 times the loaded roadmap.implement.step_token_budget.

Scenario: A budget above the old fixed default

  • WHEN RoadmapImplementConfig(step_token_budget=17_000_000) is built with no ceiling
  • THEN step_token_ceiling is 34_000_000 and the model validates without a ValidationError.

Requirement: The default ceiling does not cut the full extension

WHEN the step budget is 12,000,000 and no source sets the ceiling, the resolved ceiling SHALL be 24,000,000, so the one extension reaches 18,000,000.

Scenario: The live budget keeps the full extension

  • WHEN RoadmapImplementConfig(step_token_budget=12_000_000) is built with no ceiling
  • THEN step_token_ceiling is 24,000,000, and the extension of 50 percent ends at 18,000,000 with no cut by the ceiling.

Requirement: A budget variable alone loads

WHEN only DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TOKEN_BUDGET is set to 17000000, the settings SHALL load with a ceiling of 34000000.

Scenario: The budget variable alone

  • WHEN DEVOPS_CLI_ROADMAP_IMPLEMENT_STEP_TOKEN_BUDGET=17000000 is set and no ceiling is set
  • THEN load_settings() returns a ceiling of 34000000 and raises no ConfigurationError.

Requirement: An explicit ceiling below the budget is refused

The settings SHALL refuse an explicit step_token_ceiling below step_token_budget, and the error message SHALL name step_token_ceiling.

Scenario: A ceiling of 4999 with a budget of 5000

  • WHEN the config sets step_token_budget to 5000 and step_token_ceiling to 4999
  • THEN loading the settings raises ValidationError and the message names step_token_ceiling.

Requirement: An explicit ceiling at or above the budget is kept

The settings SHALL keep an explicit step_token_ceiling that is at or above step_token_budget.

Scenario: A ceiling of 9000 with a budget of 5000

  • WHEN the config sets step_token_budget to 5000 and step_token_ceiling to 9000
  • THEN step_token_ceiling is 9000.

Requirement: The factor constant replaces the fixed ceiling

The code SHALL replace DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING with a factor constant of 2, and the limit-class test SHALL classify the factor and list the old name as removed.

Scenario: The limit-class test reads the roadmap limits

  • WHEN tests/roadmap/test_roadmap_limit_classes.py runs
  • THEN the test passes, the factor constant has a LIMITS entry, and DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING is in REMOVED.

Requirement: The spec and documents state the dynamic default

The spec and the documents SHALL state that an unset ceiling is 2 times the loaded step budget.

Scenario: The documents no longer state 16,000,000 as the default

  • WHEN a documentation check reads the ceiling text of the spec and the documents
  • THEN each file states twice the loaded step budget and none states a fixed default of 16,000,000 for the ceiling.

Existing Tool Considered

No alternatives check has run. No open, maintained tool or library covers a setting default that depends on another setting. The repository already uses pydantic-settings and pydantic validators. The change builds a small resolver and tests: about 30,000 input tokens and 8,000 output tokens to build, about 2,000 tokens each quarter to keep and fix, and about 1 hour of elapsed time.

Key questions

  • Where should an unset step_token_ceiling be resolved?: Resolve it in RoadmapImplementConfig._token_settings_agree to 2 * step_token_budget before the below-budget check. (best practice) [sources: src/devops_cli/config/settings.py:1048, src/devops_cli/config/settings.py:1198, src/devops_cli/config/defaults.py:860]
    • Chosen: Resolve in the model after-validator. The validator already sees both settings and can keep the explicit-ceiling check in one place.
    • Rejected: Resolve in StepBudget. It leaves RoadmapImplementConfig(...).step_token_ceiling as None, so the settings do not show the effective ceiling.
    • Rejected: Keep the fixed 16,000,000 default. It fails a budget above 16,000,000 and cuts the extension for a 12,000,000 budget.
  • What type and default should the setting use?: Use Annotated[int | None, Variable()] with default None and ge=1. After validation the value is an integer. (best practice) [sources: src/devops_cli/config/settings.py:1048, src/devops_cli/config/settings.py:1198]
    • Chosen: int | None with default None. It distinguishes an unset ceiling from an explicit value, so the validator can apply the factor.
    • Rejected: int with default 16,000,000. It keeps the fixed value that the issue reports as the defect.
    • Rejected: A computed property with no field. It breaks devops config set, the environment variable and the generated configuration table.
  • Should the code remove the fixed ceiling constant or replace it with a factor?: Replace DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING with DEFAULT_ROADMAP_IMPLEMENT_STEP_TOKEN_CEILING_FACTOR = 2. Add the factor to LIMITS in the limit-class test with the class other. (best practice) [sources: src/devops_cli/config/defaults.py:860, tests/roadmap/test_roadmap_limit_classes.py:476]
    • Chosen: Replace with a factor constant. It removes the fixed ceiling and keeps the factor in one named place for the validator and the test.
    • Rejected: Delete the constant and use the literal 2. It hides the factor and gives the limit-class test no name to classify.
    • Rejected: Keep the fixed ceiling constant. It keeps the defect and the settings still stop above 16,000,000.
  • Should an explicit ceiling below the step budget stay refused?: Yes. Resolve None first. Then refuse an explicit ceiling below step_token_budget with a message that names step_token_ceiling. (best practice) [sources: src/devops_cli/config/settings.py:1198, openspec/specs/roadmap-implement-step/spec.md]
    • Chosen: Keep the refusal. The one extension must never lower the budget, and the existing spec requires this guard.
    • Rejected: Allow a ceiling below the budget. The extension would stop before the budget and the step would stop earlier than its configured budget.
  • Which files must change for the spec and generated documents?: Change openspec/specs/roadmap-implement-step/spec.md, the field description in src/devops_cli/config/settings.py, and docs/ROADMAP_WORKFLOW.md. Regenerate docs/ENV_VARS.md and docs/CONFIGURATION.md. [sources: openspec/specs/roadmap-implement-step/spec.md, src/devops_cli/config/settings.py:1048, docs/ROADMAP_WORKFLOW.md, docs/ENV_VARS.md, docs/CONFIGURATION.md]
  • Which tests must change?: Update tests/roadmap/test_roadmap_limit_classes.py for the factor constant. Add settings tests for an unset ceiling, an explicit ceiling and a budget variable alone. [sources: tests/roadmap/test_roadmap_limit_classes.py:476, src/devops_cli/config/settings.py:1198]

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 11, 2026
  2. dan-petty commented on Nov 11, 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. A valid configuration with a budget above 16000000 fails to load, but the live value loads today so this is not a current outage. The regression commit c8ed108 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.
    • Value: Medium. It blocks a future budget increase and gives a wrong ceiling extension, but it does not break the current live configuration.
    • Effort: Low. The fix is scoped: change one default, update the validator, adjust tests and docs.
    • Related: feat(roadmap): extend a step budget when the run makes progress #4394, which asks for a different change. Both concern the step token ceiling, but #4394 adds the ceiling feature while the candidate fixes its default to be 2 times the budget instead of a fixed value.
  3. added
    priority/p2-medium
    owner/agent
    on Nov 11, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 11, 2026
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9087b39 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Live since 2026-11-11 14:13 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/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions