Skip to content

feat(roadmap): give the stage runs a call budget and a notice #4346

Closed

Description

@dan-petty

Problem

A stage plan run or a review run has no call budget that the model can read. The prompt says "a limited number of tool calls" and the hard limit is 200 calls (CONST_ROADMAP_STAGE_TOOL_MAX_CALLS) and the window (75% of 256,000 tokens). A model that explores without end reaches the window, loses its tools, and its forced reply is refused. Each request sends the whole context again, so a long exploration costs the sum of the contexts: 6.5 million input tokens for one plan run.

Evidence, 2026-11-10, model deepseek-v4.1-flash-1017, item #3387:

  • Service log: stage reply refused: item=#3387 request=76 input_tokens=206443 tools_offered=False tool_calls=113 limit=window.
  • Prometheus devops_cli_roadmap_tool_calls_per_run, row stage: over 7 days p50 33, p90 43 calls; over the last 12 hours p50 37, p90 86, p99 113. Row stage_verify: 7 days p50 53, p90 107; 12 hours p50 59, p90 89.
  • A live run of devops roadmap stage --plan --item 3387 with a trace of each agent run (scratch, not committed): plan run 79 calls, 58 requests, 6.48 million input tokens, 13 minutes (the final reply alone took 192 seconds); gate return 4 calls, 3 minutes; review run 92 calls, 52 requests, 5.62 million input tokens, 19 minutes; repair plan run 49 calls, 34 requests, 3.05 million input tokens, 10 minutes. The item took more than 47 minutes and was still in its second review.
  • The calls repeat little: 3% of the read lines of the plan run were read before. The run is long because it keeps reading new places, not because it repeats.

Expected

  • The prompts of the plan run and the review run give a budget: about 30 calls for a plan and about 40 for a review.
  • From a set call (40 for a plan run, 60 for a review run), each tool answer ends with a notice to give the reply now. The tools stay on; the window limit stays.

Acceptance criteria

  • A test of StageTools shows that the answer of the call at the limit ends with the notice, the answer before it has none, and a new run starts at zero. It fails today.
  • A test shows that the prompts name the same numbers as the constants.
  • devops roadmap eval stage --replay keeps its result (81 of 317 defects caught, 0 missed, 5 of 5 good plans accepted).
  • The pull request reports live runs of an item before and after: minutes, tool calls, requests, input tokens, outcome.

Existing tool considered

pydantic-ai has UsageLimits (the hard stop that the job uses already) and no soft budget. The change adds a counter and a notice. Cost: about 40,000 tokens to build, 3,000 to keep, 3 hours.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 10, 2026
  2. dan-petty commented on Nov 10, 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. The runs are very expensive and slow but still complete; this is a cost and speed improvement, not a failure.
    • Value: High. One plan run costs 6.5 million input tokens and 13 minutes; a soft budget and notice cut that cost significantly.
    • Effort: Medium. The change adds a counter, a notice in tool answers, prompt updates, and tests; the candidate estimates 3 hours.
    • Related: feat(roadmap): Tune stage planner caps from run data #3241, which asks for a different change. Both deal with stage planner call limits, but #3241 tunes existing hard caps from telemetry data while the candidate adds a new soft budget number in prompts and a notice at a set call count.
  3. added
    priority/p2-medium
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/new
    status/in-progress
    on Nov 10, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

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

    @devops-cli-service
    Contributor

    Live since 2026-11-10 07:20 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/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions