Repository navigation
Description
Problem
The stage job of the Service fails every item since 2026-11-06 20:34Z. The model deepseek-v4.1-flash-1017 answers with the placeholder x in every text field of the plan (why, existing_tool, feasibility, the implementation of group 1, and a changes path), or with a reply that breaks the schema. The deployed ConfigMap sets ai.tasks.analysis.context_window to 65536, and the task stage inherits it (k8s/devops/configmap.example.yaml).
Evidence (2026-11-07, devops roadmap stage --item 3224 --plan, live item, model deepseek-v4.1-flash-1017, ai.max_retries 1, toolset extended, one run for each row):
Window of analysis |
Result | Plan requests | Tool calls | Input tokens | Output tokens |
|---|---|---|---|---|---|
| 65536 | Failed, x in every text |
5 and 3 (two tries) | 6 and 4 | 213,898 and 120,930 | 952 and 732 |
| 262144 | Staged, 5 task groups | 23 | 40 | 1,494,303 | 15,170 |
Only the window changed between the two rows. The first request of a plan counts about 38,000 tokens. At 65536 the hook of the run stops the tools at 49,152 tokens, after 2 or 3 requests. The model then has read almost nothing, and it answers with x. The check refuses the reply, the job sends it back once, the second reply is x again, and the item fails. The run needs about 1.5 million input tokens in 23 requests, and it stops its tools at three quarters of the window.
ai.max_retries is not the cause: the run at 262144 used 1, and it staged. The reply returns of the plan run are fixed (_REPLY_RETURNS in src/devops_cli/roadmap/stage.py). The live item, the prompt and the gateway group were the same in both rows.
docs/roadmap/stage.md says that the model "writes a plan about code that it did not read" when the window ends the tools. In fact it writes no plan.
Expected
- The window of the ConfigMap fits the model. The model has
max_input_tokens1,048,576, and the smallest fp8 provider of the group offers 256,000 tokens, the window thatai.tasks.implementalready uses. The analysis window in the example is 256000. The verification window moved to fix(k8s): set the verification window in the example ConfigMap #3911. A person applies the value to the deployed ConfigMap. - The stage job fails at once, and names the setting, when the window ends the tools of a plan run before the model has made a minimum number of tool calls. The error is not a list of placeholder faults.
- A test fails if the example ConfigMap sets a planner window that is smaller than the run needs.
Acceptance criteria
- The example ConfigMap sets
ai.tasks.analysis.context_windowto 256000, with a comment that gives the reason. The window of the taskverificationmoved to fix(k8s): set the verification window in the example ConfigMap #3911, because the pull request of feat(k8s): the Service uses one model for every chat slot #3874 edits the lines of that task in the same file. - A plan run whose tools end at the window before a minimum number of tool calls raises
RoadmapStageErrorthat namesai.tasks.stage.context_window(or the parentanalysis), and the job records that error and not the placeholder faults. - A test fails when the planner window of the example ConfigMap is below the minimum that the first request and the minimum tool turns need.
-
docs/roadmap/stage.mdstates what the model does when the window ends the tools.
Existing tool considered
The change uses the settings and the hook that exist (PrepareTools of pydantic-ai in src/devops_cli/roadmap/refine_investigation.py). No new library is needed.
Related
#3241 (tune the stage planner caps from run data), #3874 (the Service uses deepseek-v4.1-flash-1017 for every chat slot; it edits the same example ConfigMap), #3523 (the plan request leaves room for the planner tools).
Proposed design
Problem statement
The stage job fails every item when the context window of the analysis task is 65536. The window ends the planner tools after 2 or 3 requests, the model returns x in every text field, and the job reports placeholder faults. The change sets the example analysis and verification windows to 256000, fails a starved plan run at once with a RoadmapStageError that names the setting, guards the example window with a test, and corrects docs/roadmap/stage.md.
Acceptance criteria
Requirement: Example ConfigMap planner windows
The example ConfigMap SHALL set ai.tasks.analysis.context_window and ai.tasks.verification.context_window to 256000 with a comment that gives the reason.
Scenario: Example ConfigMap sets both windows
- WHEN A test reads
k8s/devops/configmap.example.yaml. - THEN The test finds both context windows set to 256000 and a comment above them that names the smallest fp8 provider window of the gateway group.
Requirement: Window starvation error
A starved plan run SHALL raise RoadmapStageError that names ai.tasks.stage.context_window and its parent ai.tasks.analysis.context_window.
Scenario: Window stops tools before the minimum
- WHEN A test plans an item with a toolbox client whose run trace records
RunLimit.WINDOWand fewer thanCONST_ROADMAP_STAGE_MIN_TOOL_CALLStool calls. - THEN The planner raises
RoadmapStageErrorwhose message names both settings, and_plan_eachrecords that message as the item's failure reason instead of a placeholder problem.
Requirement: Planner window minimum test
A test SHALL fail when the example planner window is below CONST_ROADMAP_STAGE_MIN_CONTEXT_WINDOW.
Scenario: Planner window below the minimum
- WHEN A test calls the example-window guard with the text of
k8s/devops/configmap.example.yamland with a copy whoseai.tasks.analysis.context_windowis 65536. - THEN The guard passes on the example and fails on the copy with a message that names
ai.tasks.analysis.context_windowand the minimum 256000.
Requirement: Stage documentation of a starved window
The stage documentation SHALL state that a starved window makes no plan and SHALL name the minimum and the setting error.
Scenario: Documentation states the starved-window behavior
- WHEN A test reads the section 'The window of the plan run' of
docs/roadmap/stage.md. - THEN The section states that the model writes no plan, that the job raises
RoadmapStageErrornaming the setting when fewer thanCONST_ROADMAP_STAGE_MIN_TOOL_CALLStool calls run, and that the example window is 256000.
Existing Tool Considered
pydantic-ai, the open and maintained model library that the project pins in uv.lock, covers the tool-stopping hook with PrepareTools in src/devops_cli/roadmap/refine_investigation.py:439; it records RunLimit.WINDOW in RunTrace (src/devops_cli/roadmap/agent_run.py:174) but has no check that the window ended the tools before enough calls. The stage planner adds that check in src/devops_cli/roadmap/stage.py, so no new library and no build cost are needed. No alternatives check has run.
Key questions
- Which setting names the planner window, and which name must the error use?:
task_window("stage")reads the window of thestagetask fromai.for_task(src/devops_cli/roadmap/stage.py:1532)._TASK_PARENTSmapsstagetoanalysis(src/devops_cli/config/settings.py:619), so astagefield that is unset takes theanalysisvalue; the deployed setting isai.tasks.analysis.context_window(k8s/devops/configmap.example.yaml:29). The error namesai.tasks.stage.context_windowand its parentai.tasks.analysis.context_window, so it is right for either source. [sources: src/devops_cli/roadmap/stage.py:1532, src/devops_cli/config/settings.py:619, k8s/devops/configmap.example.yaml:27, docs/roadmap/stage.md:49] - What minimum number of tool calls must a plan run make before the window may end its tools?: Eight tool calls (
CONST_ROADMAP_STAGE_MIN_TOOL_CALLS). That is two turns of the four-call reserve that the hook keeps for a last turn (CONST_ROADMAP_REFINE_INVESTIGATION_TURN_CALLS), so the model can make a turn of calls, read the answers, and make another turn before the window may end the tools. It is above both failed counts (6 and 4) and far below the 40 calls of the successful run. (best practice) [sources: src/devops_cli/config/constants.py:3086, src/devops_cli/roadmap/refine_investigation.py:329, docs/roadmap/stage.md:59]- Rejected: 4 tool calls. One failed row made 6 calls, so a threshold of 4 does not catch it.
- Rejected: 6 tool calls. One failed row made exactly 6 calls, so a threshold of 6 does not catch it.
- Chosen: 8 tool calls. It is two turns of the 4-call reserve, it catches both failed rows (6 and 4 calls), and it is far below the 40 calls of the successful run.
- Rejected: 12 tool calls. It would fail a small plan that uses 10 calls and still has room, and the evidence gives no need above 8.
- Where should the minimum-tool-call check run?: In
_Planner._ask, immediately afterchat_structuredreturns and before the reply reaches_settle._askis the one place where every plan run returns (the first reply, its retry, and a repair round), it can take the target to raise_stage_error, and it runs before_settlecomputes the placeholder problems. The check readsself._traces[-1]when the planner holds the toolbox traces, as the job anddevops roadmap stage --plando; the golden-set eval passes a client that keeps its own trace, so its runs are unchanged. (best practice) [sources: src/devops_cli/roadmap/stage.py:1081, src/devops_cli/roadmap/stage.py:919, src/devops_cli/roadmap/stage.py:1103]- Rejected: In
ToolboxClientafter the run. The toolbox client serves the verifier too, has no item number, and cannot raise the item'sRoadmapStageError. - Rejected: In
_Planner.planafter the plan run. The plan run returns inside_gated, soplanruns only after_settlehas already raised the placeholder faults. - Chosen: In
_Planner._askright afterchat_structured. It is where every plan run returns, it has the target for_stage_error, and it runs before_settle.
- Rejected: In
- How should the error name the setting when
stageinherits fromanalysis?: The message namesai.tasks.stage.context_windowand the parentai.tasks.analysis.context_window. This covers a set stage window and an inherited analysis window. (best practice) [sources: docs/roadmap/stage.md:49, k8s/devops/configmap.example.yaml:27, src/devops_cli/config/settings.py:619]- Rejected: Name only
ai.tasks.stage.context_window. The deployed ConfigMap sets the parent, so a person may look for a missing stage key. - Rejected: Name only
ai.tasks.analysis.context_window. A person may set the stage task directly. - Chosen: Name both settings. It is correct for either source.
- Rejected: Name only
- What should the example ConfigMap test assert for the planner window?: The guard asserts that
ai.tasks.analysis.context_windowink8s/devops/configmap.example.yamlis at leastCONST_ROADMAP_STAGE_MIN_CONTEXT_WINDOW, 256000: the smallest window that an fp8 provider of the gateway group offers and the window thatai.tasks.implementalready uses. The example itself sets 256000; a larger window is valid, because the group allows 1,048,576. (best practice) [sources: k8s/devops/configmap.example.yaml:34, k8s/README.md:655, k8s/llm/gateway/config.yaml:193]- Rejected: Assert equality to 256000. A larger window is valid and the model allows 1,048,576.
- Rejected: Assert at least 131072. It is below the 256000 window that the smallest fp8 provider of the group offers.
- Chosen: Assert at least 256000. It matches the provider and the working setting; the example itself sets 256000.
- Should the example set the verification window explicitly?: Yes.
verificationis not a child ofanalysisin_TASK_PARENTS, so an unset window falls back to the top-level default of 32,768 tokens; the verifier's request is then fitted totool_stop(32768) - CONST_ROADMAP_STAGE_TOOL_RESERVE_TOKENS, and it reads only a few of the cited files. The modelclaude-sonnet-5-5allows 1,000,000 tokens, so the example setsai.tasks.verification.context_windowto 256000. (best practice) [sources: src/devops_cli/config/settings.py:619, src/devops_cli/config/defaults.py:84, k8s/llm/gateway/config.yaml:154, k8s/devops/configmap.example.yaml:37]- Rejected: Let verification inherit the analysis window.
verificationdoes not inherit fromanalysis, so it would keep the 32,768-token default and the pass would read few cited files. - Chosen: Set the verification window explicitly. The issue requires it, the model allows 1,000,000 tokens, and the value stays visible.
- Rejected: Let verification inherit the analysis window.
- Should the live deployed ConfigMap apply be part of this issue?: No. Argo CD does not apply ConfigMap
devops-cli-config; a person runsdevops k8s deploy-stack --stack devopsand restarts the pod (k8s/README.md:754). The repository change, its test and its documentation can merge without that action, and only a person with cluster access can apply the value, so the apply is deferred to a separate chore issue. (best practice) [sources: k8s/README.md:754, docs/ROADMAP_WORKFLOW.md:325]- Rejected: Keep the live apply in this issue. The issue would wait on a person and a cluster action that a pull request cannot do.
- Chosen: Defer the live apply to a separate issue. The code change is workable and testable now, and the apply is a person's step.
- Does
ai.max_retriesneed a change?: No. The successful run usedai.max_retries1, and the issue evidence says the setting is not the cause. The example keeps 1. [sources: k8s/devops/configmap.example.yaml:22]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.The stage job fails every item since 2026-11-06, blocking the entire pipeline.Every staged item fails, so no roadmap planning can complete.Requires a ConfigMap value change, an error-raising code path, a test, and a docs edit.Both address the window ending the planner's tools, but #3477 fixed the first-request size while the candidate fixes the overall window, adds a named error, and a test.devops-cli-service commentedon Nov 7, 2026
Status set to Ready at 163a5c2 (see proposed design in issue body).
Moved to new items: #3903.
devops-cli-service commentedon Nov 7, 2026
Released in v0.77.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.77.1
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 05:06 UTC