Repository navigation
Description
Update 2026-11-26 (infra move): implement_shell_policy.py and LOCAL_COMMANDS no longer exist.
Implement runs a stock harness shell since #7031, so it can run a command with --help. The parts of this item that read the shell policy are out of date. Refine it again for the need that stays, such as the stage planner lookups.
Problem or Motivation
The stage planner and the implement agent look up the argument forms of the check commands in most runs:
- Stage: in the comment sample of 54 items, 17 of the 21 items outside the scopes
ciandroadmaplooked up a check command form: 81 calls ofread_fileonsrc/devops_cli/commands/ci.py(about 23.7k tokens for a whole read),tests/commands/test_ci.pyor.github/workflows/ci.yml, orsearch_codeforci testorci docs. The prompt names the commands but not their argument forms. - Implement: since the
run_commandprompt of 2026-11-12, 8 of 10 runner runs made 34 calls ofdevops ci --help,ci docs,ci --only,ci --check,ci constructsorci run(n = 10, from 2026-11-12 04:00Z to 2026-11-13 16:00Z). The fix(roadmap): a claim release leaves the item In Progress #5118 run tried 4 forms to run one check. LOCAL_COMMANDS(src/devops_cli/roadmap/implement/implement_shell_policy.py) names onlyuv run devops ci test <file>. The job runs the rows ofCONST_ROADMAP_IMPLEMENT_SCOPED_ROWS(constructs,docs,openspec) in check mode, and these are the forms that the agents tried.- The help of
devops ciis long and wraps, and it does not list the row names.
Proposed Solution & Architectural Design
- Implement rows: feat(ci): each check row is a devops ci command #5451 (step 4) adds the
uv run devops ci <row>rows toLOCAL_COMMANDS. This item adds no implement row. It adds the test of step 3 for the rows of feat(ci): each check row is a devops ci command #5451. - Stage card: the program makes one short block from the Typer command tree and the check registry of
src/devops_cli/commands/ci.py. It holds only the forms thatresolve_devops_argvaccepts and that run in the runner image (NOT_IN_RUNNERfilters the rest). The block is program text, so it goes in the stable system part, at most about 400 tokens. A target repository with nodevops cigets nodevops cilines. - A test resolves each line of the stage card and each
devops cirow ofLOCAL_COMMANDSwithresolve_devops_argv. The test fails when a line and the tree differ.
Target Subsystem
SDLC, Git & PR Governance: src/devops_cli/roadmap/implement/implement_shell_policy.py, src/devops_cli/roadmap/stage/, src/devops_cli/core/command_resolver.py, src/devops_cli/roadmap/runner_tools.py.
Existing Tool Considered
The Typer command tree is the source, and resolve_devops_argv already checks command forms against it. The Typer help text exists, but it does not list the row names and it is too long for a start context. No new tool. Cost to build: about 0.6M tokens and 2 hours (estimate), about 50 lines and 4 tests.
Acceptance Criteria
- Test first: each line of the stage card and each
devops cirow ofLOCAL_COMMANDSresolves withresolve_devops_argv. A command ofNOT_IN_RUNNERis not in the stage card. - A test: the stage card has at most 400 o200k tokens.
- Measure: from the stage comments, the lookups above in items outside the scopes
ciandroadmap(baseline 17 of 21 items, 81 calls), and thestage_problem_command_referencegate returns. From the runner logs, the non-testdevops ciforms for each run (baseline 34 calls in 8 of 10 runs). Usedevops roadmap eval stageanddevops roadmap eval implementas a screen only, with paired call counts as the primary measure. - Live proof after release: the same counts on real Service stage runs and runner runs for 7 days.
Dependencies
-
chore(roadmap): hold incremental stage and implement work #6521 (hold: incremental work on the stage, implement and fix-checks jobs waits for the re-architecture)
-
Issue feat(ci): each check row is a devops ci command #5451 sets the
devops ciforms. Start this item after feat(ci): each check row is a devops ci command #5451 merges, so the card holds the new forms. -
The stage system part changes, so land this item before the A/A pass of the pipeline split experiment E1. After it lands, keep the planner input fixed until E1 decides.
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).
Alternatives check of 2026-11-29: partly.
Tool: sphinx-click (https://pypi.org/project/sphinx-click), MIT License, last activity 2025-12-04, maintained.
Reason: Searches found only sphinx-click, a maintained Sphinx extension that renders a Click/Typer command tree as documentation; it covers deriving command forms from the tree, but yields doc pages, not a bounded stage prompt card, so it covers a part.
Covers:
- Renders usage and option forms from a Click/Typer command tree
- Walks nested commands and their options with no hand-written list
- Follows the tree, so documented forms track command changes
Lacks:
- Produces Sphinx doctree and HTML, not a prompt block
- No token bound and no check-registry row names
- No NOT_IN_RUNNER filter and no plan-key versioning
- No per-line validation with resolve_devops_argv
Proposed design
Problem statement
The stage planner spends many tool calls to learn the argument forms of devops ci check commands: in a sample of stage comments, 17 of the 21 items outside the ci and roadmap scopes read src/devops_cli/commands/ci.py, its tests or .github/workflows/ci.yml (81 calls). The implement agent no longer needs a card: since #7031 it runs a stock harness shell and can run a command with --help. This change generates a short card of the accepted check forms from the check registry of src/devops_cli/commands/ci.py, checked against the Typer command tree, filters the rows whose programs the runner image lacks, holds no devops ci line for a repository whose project profile is neutral, appends the card to the stable system text of the plan request, bounds it to 400 tokens and puts it in the plan key. The item waits on the hold issue #6521, and the after-release measurement is #6241.
Acceptance criteria
Requirement: Stage command card
The stage plan system prompt SHALL hold a generated command card built from the check registry of src/devops_cli/commands/ci.py and checked against the Typer command tree.
Scenario: Card lists the accepted check forms
- WHEN The test builds the card for a target repository whose project profile is the
devops-clipreset - THEN The card holds
uv run devops ci <row>for each name ofCHECK_ROW_NAMESthat starts no program ofNOT_IN_RUNNER, theuv run devops ci --check --only <rows>form and theuv run devops ci test <file>form.
Requirement: Runner image filter
The command card MUST omit every check row whose commands name a program that NOT_IN_RUNNER lists.
Scenario: A row with a missing program is absent
- WHEN The test builds the card from a registry that holds a row whose command starts
docker, a program ofNOT_IN_RUNNER - THEN The card holds no line for that row.
Requirement: Repository without devops ci
The command card MUST hold no devops ci line when the project profile of the target repository has no devops-cli preset.
Scenario: A neutral repository gets no devops ci lines
- WHEN The test builds the card for a target repository whose profile is the
neutralpreset, and for one whose staged commit holds no.devops/roadmap.toml - THEN The card holds no line that starts with
uv run devops ci.
Requirement: Stable system part
The generated command card MUST be part of the system text that the stage planner sends with every plan request.
Scenario: Card is in the system text
- WHEN The test plans one item with a fake stage client that records the system text and the JSON prompt
- THEN The card appears in the recorded system text and not in the recorded JSON prompt.
Requirement: Card token bound
The generated command card MUST hold at most 400 tokens counted by count_tokens with its gpt-4o encoding.
Scenario: Card stays under the bound
- WHEN The test generates the card from the current check registry and command tree
- THEN
count_tokens(card)is at most 400.
Requirement: Stage card lines resolve
Each line of the stage command card MUST resolve with resolve_devops_argv.
Scenario: Every card line resolves
- WHEN The test strips
uv run devopsfrom each card line, converts each<...>word with_argv_tokenand callsresolve_devops_argv - THEN
resolve_devops_argvreturns None for every line.
Requirement: Card through the prompt file
The card MUST be rendered from the Markdown task file src/devops_cli/ai/tasks/roadmap_stage_commands.md through load_task_prompt, and its prompt text MUST sit in that file and not in Python.
Scenario: The prompt file holds the card placeholder
- WHEN The test renders
load_task_prompt("roadmap_stage_commands.md", command_card="MARK") - THEN The rendered text holds
MARKand the raw file holds{{ command_card }}.
Requirement: Card in the plan key
A change of the command card MUST give a new plan key for the same item and model.
Scenario: A changed card gives a new key
- WHEN The test computes
PlanFiles.keyof the same item with two different card blocks - THEN The two plan keys differ.
Requirement: Pending a person after the merge
The pull request of this change MUST state the stage eval score before and after, as the rule for a change to the stage prompt asks.
Scenario: The eval scores reach the pull request body
- WHEN After the plan lands, a person runs
uv run devops roadmap eval stage --limit <n>on the base and on the branch with the same model - THEN The body holds a
Base eval score:line and aHead eval score:line, each with a number, and the draft pull request is marked ready.
Existing Tool Considered
sphinx-click (https://pypi.org/project/sphinx-click, MIT, last activity 2025-12-04) is the open, maintained tool that renders a Click/Typer command tree, and the Lacks: list of its block in the issue body holds what it lacks here. The change builds project code instead: the issue gives the written build cost of about 0.6M tokens and 2 hours (estimate), about 50 lines and 4 tests. The cost to keep and fix it is the repair of the card and its resolution test when a row, an option or a program of the registry changes, because that test fails then.
Key questions
- What does the freeze reply of 2026-11-20 decide for this item?: The hold issue chore(roadmap): hold incremental stage and implement work #6521 holds the item back: stage and implement leave it while chore(roadmap): hold incremental stage and implement work #6521 is open, and a person closes chore(roadmap): hold incremental stage and implement work #6521 after the experiments of refactor(roadmap): re-architect stage and implement on Coder #6519 or closes this item as not planned. The note
of #6519in the hold line names the tracker and adds no blocker. [sources: docs/roadmap/refine.md:24, docs/roadmap/refine.md:32, openspec/specs/roadmap-refine/waits/spec.md:229] - How does the stage card get the check command forms?: Generate the rows from
CHECK_ROW_NAMESandget_check_specs()ofsrc/devops_cli/commands/ci.py, and check each generated line withresolve_devops_argv. Keep no hand-written list and copy no Typer help text. Importget_check_specsinside the builder, becauseci.pyis a heavy module and thestartup-importsrow budgets the import graph. (best practice) [sources: src/devops_cli/commands/ci.py:130, src/devops_cli/commands/ci.py:871, src/devops_cli/core/command_resolver.py:85, openspec/changes/archive/2026-11-25-4596-replay-a-changed-gate-module-that/design.md:13]- Chosen: Generated from the check registry. The registry holds the row names and their commands, and the resolver checks a form against the Typer tree.
- Rejected: Hand-written list. It goes stale when a row or an option changes.
- Rejected: Typer help text. The help now names every row, but it is long, wraps, and is not a bounded block of the accepted forms.
- Which forms does the card leave out?: Leave out every form that
resolve_devops_argvrejects, and every check row whose commands name a program inNOT_IN_RUNNER. The generator builds each line from the registry and the test resolves it, so a rejected form never enters the card. (best practice) [sources: src/devops_cli/core/command_resolver.py:85, src/devops_cli/roadmap/runner_tools.py:234]- Chosen: Resolution and the NOT_IN_RUNNER filter. The resolver rejects a form the tree does not accept, and the runner table rejects a row the image cannot run.
- Rejected: Copy the help text. The help is long and wraps, and it is not a bounded block of the accepted forms.
- Rejected: A hand-written list of skipped forms. It goes stale when a row, an option or a program changes.
- Does any check row today name a program that
NOT_IN_RUNNERholds?: No. The 28 rows startuv,ruff,mypy,actionlint,devops,deptry,ast-grep,pre-commit,pytestandpython, and all of them are inRUNNER_TOOLS. Theauditrow runsuv audit, andnpmis in the runner image. The filter is a guard for a future row, and its test builds a row withdocker. [sources: src/devops_cli/commands/ci.py:871, src/devops_cli/commands/ci.py:919, src/devops_cli/roadmap/runner_tools.py:234, tests/roadmap/test_roadmap_runner_tools.py:140, docs/CLUSTER.md:78] - How does the generator decide that a check row runs in the runner image?: Compute each row's programs as the runner-parity test does: the first word of each command, and the tool after
uv run, skippingnice. A row with a program inNOT_IN_RUNNERis out. (best practice) [sources: tests/roadmap/test_roadmap_runner_tools.py:59, tests/roadmap/test_roadmap_runner_tools.py:73, src/devops_cli/roadmap/runner_tools.py:234]- Chosen: Row programs against NOT_IN_RUNNER. The runner-parity test already applies this rule to every devops ci row, so the card and the image test agree.
- Rejected: Parse the prose of the NOT_IN_RUNNER reasons. The reasons are prose for a person, not data.
- Rejected: A hand-written list of skipped rows. It goes stale when a row is added, renamed or removed.
- How does the card omit
devops cilines for a target repository that has nodevops ci?: Read the profile at the staged commit withresolve_profile(self._source, self._sha), and emitdevops cilines only for thedevops-clipreset. A commit with no.devops/roadmap.tomlgets theneutralpreset. A file that is not valid leaves the card with nodevops cilines and logs the reason, so the card never stops a plan. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:425, src/devops_cli/roadmap/project_profile.py:90, src/devops_cli/roadmap/project_profile.py:98, src/devops_cli/roadmap/toolchains.py:60]- Chosen: Project profile. The project records the toolchain of a target repository in
.devops/roadmap.toml, and a file that is absent gives the neutral preset. - Rejected: Test command resolution.
resolve_devops_argvresolves the installed CLI, which the runner image gives every repository, so it never rejectsdevops cifor a target repository. - Rejected: Detect a file. A second rule for the same fact duplicates the profile that the project already reads.
- Chosen: Project profile. The project records the toolchain of a target repository in
- How does the test check the stage card?: One test strips
uv run devopsfrom each card line, converts each<...>word with_argv_token, and callsresolve_devops_argv. It fails on a finding. (best practice) [sources: src/devops_cli/core/command_resolver.py:85, src/devops_cli/roadmap/stage/stage_commands.py:78, src/devops_cli/roadmap/stage/stage_commands.py:142]- Chosen: Resolution test. The resolver is the existing validator for a command form, and it runs offline.
- Rejected: Snapshot test. A snapshot records the current text and does not check that the command tree accepts it.
- Rejected: Manual check. A manual check does not fail CI when a form changes.
- Where does the stage card go?: Append the rendered block to the system text that
_askpasses tochat_structured, for the plan task only. The block isload_task_prompt("roadmap_stage_commands.md", command_card=card): the card's prompt text sits in that Markdown task file, as the Zero Inline Prompts Policy asks, and the generated rows are its context. The block never goes in the JSON prompt or a tool result. (best practice) [sources: docs/SDLC.md:132, src/devops_cli/roadmap/stage/stage_toolbox.py:162, src/devops_cli/roadmap/implement/implement_step.py:194, src/devops_cli/roadmap/stage/stage.py:2547]- Chosen: Markdown task file appended to the system text. The stage job already composes its system text from Markdown task files, and the card is a separate bounded block.
- Rejected: Placeholder in
roadmap_stage_change.md. It edits the long plan prompt and renders it with StrictUndefined, and the card is a block of its own. - Rejected: An inline Python string. The Zero Inline Prompts Policy forbids prompt text in Python.
- Rejected: User turn or tool result. The user turn changes with the item, and a tool result is not stable and costs a call.
- What token bound does the card use?: Use at most 400 tokens counted with
count_tokens, which counts with thegpt-4oencoding (o200k_base). The first stage request counts about 34,000 tokens against the 192,000 limit and leaves at least 8,192 tokens for the tool answers, so 400 tokens is about 1.2% of the request and about 5% of that reserve. (best practice) [sources: src/devops_cli/ai/context_budget.py:90, src/devops_cli/config/defaults.py:454, docs/roadmap/stage.md:98, docs/roadmap/stage.md:107]- Chosen: 400 tokens of count_tokens. It keeps the stable system text small against the documented first request and its tool reserve, and the test counts it offline.
- Rejected: No bound. The card grows with each row and crowds the stage prompt.
- Rejected: Character bound. A character count does not match the model token budget that the stage window uses.
- How does a change of the card reach the plan key?: Carry the rendered block on
PlanFilesand pass it asprompt_version(self.toolset, context={"command_card": block})inPlanFiles.key.prompt_versionhashes the prompt texts and the context values, so a changed card gives a new plan key and a kept plan of an older card is not reused. (best practice) [sources: src/devops_cli/roadmap/stage/stage.py:1375, src/devops_cli/roadmap/stage/stage.py:1387, src/devops_cli/roadmap/stage/stage_plan_record.py:186, src/devops_cli/roadmap/stage/stage_plan_record.py:197]- Chosen: Card as a context value.
prompt_versionalready takes a context mapping and hashes it, so no new key format is needed. - Rejected: Leave the card out of the version. A plan kept under the old card would be reused after a row or an option changes.
- Rejected: Hash the card in a new file. The existing context parameter does the same with no new state.
- Chosen: Card as a context value.
- Does the help of
devops cilist the row names?: Yes. Since feat(ci): each check row is a devops ci command #5451 the--onlyand--skiphelp interpolatesCHECK_ROW_NAMES, sodevops ci --helpnames every row. The help still wraps and is not a bounded block of the accepted forms, so it is not the source of the card. [sources: src/devops_cli/commands/ci.py:1729, src/devops_cli/commands/ci.py:1737, tests/commands/test_ci_row_commands.py:199] - Does the card change the stage prompt, and what does the stage eval rule ask?: The card changes what the planner reads, so the pull request states the stage eval score before and after:
uv run devops roadmap eval stage --limit <n>runs on the base and on the branch with the same model. The step shell holds no model key, so a person runs it and writes theBase eval score:andHead eval score:lines in the body. [sources: docs/ROADMAP_WORKFLOW.md:350, docs/ROADMAP_WORKFLOW.md:427]
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 13, 2026
Both reduce agent confusion over devops ci forms, but #5451 changes the CLI structure while the candidate generates a prompt card and adds rows to LOCAL_COMMANDS.devops-cli-service commentedon Nov 17, 2026
Alternatives check: none
Reason: The searches for a tool that turns a Typer/Click command tree into a short, prompt-ready command reference surfaced only documentation and completion generators: sphinx-click renders full Click command docs and shtab emits shell completion scripts, and neither applies the
resolve_devops_argv/NOT_IN_RUNNERfilters, the ~400-token cap or the line-by-line resolution test. The issue's own conclusion holds: the Typer command tree plusresolve_devops_argvis the source and the validator, so the card is project code rather than an existing tool; ADR 0025 already rejected cogapp for generated blocks, and its build-time file substitution does not fit a card assembled per run from the tree.Tool: none found
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 18, 2026
Status set to Ready at 9be129e (see proposed design in issue body).
Moved to new items: #6241.
dan-petty commentedon Nov 20, 2026
Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.
devops-cli-service commentedon Nov 23, 2026
The result in the alternatives block of the issue body changed. Before this check:
none, no tool. A person decides what the new result means for the item.Searches (8)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
dan-petty commentedon Nov 30, 2026
Triage under #6519 (owner instruction of 2026-11-30), before the hold #6521 closes. This item adds or extends a gate, refusal, screen, cap, limit, retry, result line, shell allowlist, tool catalog or plan-shape rule of the stage, implement or fix-checks job. #6519 found that 263 of about 900 issues in four weeks added such rules and none replaced the engine. Stage now runs on stock Coder (grade 60 on 30 graded attempts), where the agent reads the repository, runs the checks in its loop and has a real shell; implement follows (#6527). The code paths that this item names have also moved. If the failure class still shows in graded attempts, file a new item from that evidence. Closed as not planned; a person may reopen it.