Repository navigation
Closed
Labels
effort/lowEffort Low: little workpriority/p2-mediumPriority P2: standard workscope/roadmapThe roadmap jobs: intake, refine, stage, implement and the Service that runs themsource/agentFiled by an agenttype/bugType bug: the code does not do what it mustvalue/mediumValue Medium
Description
Problem or Motivation
The refine proposal call caps its context with the window of the analysis task, not with a bound of the job:
src/devops_cli/roadmap/refine/refine.py:2906setsmax_tokens = ai_config.for_task("analysis").context_window or 8192.- The deployed
analysiswindow is 256,000 (k8s/devops/configmap.example.yamlshows the same value). So the cap has no effect in practice. - For the 54 item bodies of the stage comment sample,
collect_contextbefore any cap is p50 81k, p90 141k and max 540k o200k tokens. - The refine row is the second largest row: about $3.16 and 124.5M prompt tokens in 3 days to 2026-11-13. It has the most uncached input of all rows, about 19.1M tokens (15%), against about 15.3M for stage.
- A change of the
analysismodel or window changes the refine input with no review of the refine job.
The stage job caps the same context at CONST_ROADMAP_STAGE_CONTEXT_MAX_TOKENS (20,480).
Proposed Solution & Architectural Design
- Add
CONST_ROADMAP_REFINE_CONTEXT_MAX_TOKENS= 20,480 tosrc/devops_cli/config/constants.py. - The proposal call uses
min(CONST_ROADMAP_REFINE_CONTEXT_MAX_TOKENS, window // share), as the stage job does (stage.py_request). - The refine result line (feat(roadmap): result lines state first-pass, model calls and cost #5168) gives the context tokens before and after the cap, as counts only.
Not in scope: an item manifest for the refine investigation agent. It is an experiment, and it waits for the refine tool records of #5460:
- Case set: a fixed set of 15 recent refine items at one commit.
- Arms: today (the investigation gets no context) against a manifest of at most 3k tokens (cited paths with line ranges, symbol locations, requirement names, no file text).
- Primary measure: model requests for each run.
- Decision rule: the manifest passes only with at least 2 fewer requests for each run and no change of more than 2 of 15 judge verdicts (ready, person, retry).
Target Subsystem
SDLC, Git & PR Governance: src/devops_cli/roadmap/refine/refine.py, src/devops_cli/config/constants.py.
Existing Tool Considered
truncate_to_token_limit already cuts the context. The change sets the bound only. No tool is necessary. Cost to build: about 0.3M tokens and 1 hour, about 10 lines and 2 tests.
Acceptance Criteria
- Test first: with an
analysiswindow of 256,000, the proposal request for a body that cites a file of 60k tokens holds at mostCONST_ROADMAP_REFINE_CONTEXT_MAX_TOKENStokens of context. - Quality screen: no refine golden set exists. Run both caps in shadow on the same 15 recent refine items at one commit. Give the judge verdicts and the input tokens of both arms in the pull request comment. A change of more than 2 of 15 verdicts stops the change.
- Measure: uncached prompt tokens of the row
refinefor each run, fromdevops_cli_ai_tokens_totaland the result lines of feat(roadmap): result lines state first-pass, model calls and cost #5168. - Live proof after release: on real Service refine runs for 7 days, the context tokens after the cap are at most the constant, and the uncached prompt tokens for each proposal fall (expected about -49k at p50). Give the judge verdict mix of 14 days, with the note that the items of each week differ.
Dependencies
None. #4878 changes the same function for a slow git grep. Do not stack the pull requests.
Standards Compliance
- I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 4 blocks, zero bare exceptions, tests that cover the changed lines).
Metadata
Metadata
Assignees
Labels
effort/lowEffort Low: little workpriority/p2-mediumPriority P2: standard workscope/roadmapThe roadmap jobs: intake, refine, stage, implement and the Service that runs themsource/agentFiled by an agenttype/bugType bug: the code does not do what it mustvalue/mediumValue Medium
Activity
dan-petty commentedon Nov 13, 2026
Both set roadmap job caps in config/constants.py, but #3206 raises existing soft caps while the candidate adds a new refine context cap that was effectively unbounded.fix(roadmap): the refine proposal caps its context with a job constant (
fix(roadmap): the refine proposal caps its context with a job constant (
devops-cli-service commentedon Nov 15, 2026
Released in v0.159.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.159.0
devops-cli-service commentedon Nov 16, 2026
Live since 2026-11-15 23:51 UTC