Repository navigation
Description
Problem or Motivation
Before the halt of #4659, refused commands were in 25 of 51 implement stops (92 refused commands: uv 33, git 16, grep 8, ls 4 and others). #4659 now halts a step at 3 refusals in a row with 0 repair turns. Implement reaches a ready PR in about 15% of Jobs (12 of 81). The halt has only hours of data, so a wait for 5 events would leave implement with no lever. The shell policy is a sandbox rule and does not change.
Proposed Solution & Architectural Design
At the halt of CONST_ROADMAP_IMPLEMENT_MAX_CONSECUTIVE_REFUSALS refusals in a row (implement_tool_log.py), run the fixable check (point implement.halt_fixable, #4847): map each refused command to its allowed form (implement_shell_refusal.py); fixable when each refused program has an allowed form that the model did not get in this step. Fixable -> one turn with the list as a reminder, then halt on the next 3 refusals in a row. Not fixable -> halt as today with the reason. 1 turn per step, 2 per item. The total of 30 refusals and the shell policy stay.
Target Subsystem
SDLC, Git & PR Governance (roadmap implement).
Existing Tool Considered
The allowed command forms of implement_shell_refusal.py and the #4847 chain. Cost to build: about 0.6M tokens, half a day.
Acceptance Criteria
- A test: 3 refused 'cd x && uv run pytest' calls get one turn with the allowed form and no halt; 3 more refusals in a row halt the step.
- A test: a refused program with no allowed form halts at once as not fixable.
- A test: no third turn in one item.
- The feat(roadmap): log one result line for each roadmap job attempt #4845 line holds
halt_turns. - 7 days after deploy:
refused_toolstops fall, and each turn has an outcome line.
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)
Related: #4659 (the halt of today) and #4115 (stop the step early on stalls and refusals). This item adds a repair turn before the halt; it does not remove the halt.
Source: #4843
Alternatives check of 2026-11-27: none.
Tool: none found.
Reason: Searches found only policy engines and generic command/shell references, none of which implement a repair turn with allowed-form mapping at a consecutive-refusal halt inside the project's own implement loop.
Lacks:
- Repair turn before the consecutive-refusal halt
- Per-step record of allowed forms already given
- Fixability rule and decision point with shadow mode
- Repair-turn outcome lines and halt_turns count
Proposed design
Problem statement
The implement step halts an item at three refused commands in a row. Refused commands were in 25 of 51 implement stops, and implement reaches a ready pull request in about 15% of jobs. This change adds one repair turn before the halt when every refused program has an allowed form that the model did not get in this step. It keeps the shell policy and the total of 30 refusals. The work waits on #6521.
Acceptance criteria
Requirement: Registered point
The implement.halt_fixable decision point SHALL be registered in decision_registry.REGISTRY and decision_table.POINT_CUTS with a cuts file in the repository.
Scenario: Registered point
- WHEN The test reads
REGISTRY.namesandPOINT_CUTS. - THEN Both name
implement.halt_fixable, and the cuts file thatPOINT_CUTSgives is a file of the repository.
Requirement: Rule reads cuts file
The implement.halt_fixable rule MUST read the programs with an allowed form from its cuts file, not from a constant.
Scenario: Cuts file changes the band
- WHEN The test calls the rule with a program that only a temporary cuts file names as allowed.
- THEN The rule returns the band that starts the repair turn for that program.
Requirement: Halt calls point
The implement step SHALL call the implement.halt_fixable point at the consecutive-refusal halt.
Scenario: Halt calls the point
- WHEN The test sets
roadmap.decisionstoimplement.halt_fixable: onand reaches three consecutive refusals. - THEN The step calls
implement.halt_fixableonce before it starts a repair turn or halts.
Requirement: One repair turn
At the third consecutive refusal, the implement step SHALL start one repair turn when the halt is fixable and SHALL NOT halt the step.
Scenario: Fixable halt gets one turn
- WHEN The test sets
implement.halt_fixabletoon, drives three refusedcd x && uv run pytestcalls in a row throughimplement_tool_log.py, and each refused program has an allowed form that the model did not get in this step. - THEN The step starts one repair turn with the allowed form as a reminder and does not raise
UnexpectedModelBehavior.
Requirement: Halt after repair turn
The implement step SHALL reset the consecutive refusal count after a repair turn and SHALL halt at the next three consecutive refusals.
Scenario: Three more refusals halt
- WHEN The test gives the model one repair turn and then three refused calls in a row.
- THEN The step raises
UnexpectedModelBehaviorand stops.
Requirement: Not fixable halt
The implement step SHALL halt at the third consecutive refusal when any refused program has no allowed form.
Scenario: No allowed form
- WHEN The test sets
implement.halt_fixabletoonand drives three refused calls in a row for a program thatimplement_shell_refusal.pyhas no allowed form for. - THEN The step raises
UnexpectedModelBehaviorat the third refusal with the reason and starts no repair turn.
Requirement: Allowed form already given
The implement step SHALL treat a refused program as not fixable when the model already got its allowed form in the same step.
Scenario: Allowed form already given
- WHEN The test gives the allowed form of the refused program in the step before the three refusals.
- THEN The step halts at the third refusal and starts no repair turn.
Requirement: Two turns per item
The implement step SHALL start at most one repair turn in a step and at most two in one item.
Scenario: Third turn refused
- WHEN The test uses the two repair turns of one item and reaches another fixable halt.
- THEN The step halts at the third refusal and starts no third repair turn.
Requirement: Halt turns recorded
The #4845 result line SHALL hold halt_turns with the count of repair turns of the item.
Scenario: Halt turns in the result line
- WHEN The test ends an item after one repair turn.
- THEN The feat(roadmap): log one result line for each roadmap job attempt #4845 result line holds
halt_turnsequal to 1.
Requirement: Continued repair turn outcome
The implement step SHALL write one outcome line for each repair turn that ends with a continued step.
Scenario: Continued repair turn
- WHEN The test ends a repair turn with a continued step.
- THEN The log holds one outcome line with the turn number and the result
continued.
Requirement: Halted repair turn outcome
The implement step SHALL write one outcome line for each repair turn that ends with a halt.
Scenario: Halted repair turn
- WHEN The test ends a repair turn with a halt.
- THEN The log holds one outcome line with the turn number and the result
halted.
Requirement: Total refusal limit
The repair turn SHALL NOT reset the total refusal count or the shell policy.
Scenario: Total limit
- WHEN The test reaches more than 30 total refused calls, including one repair turn.
- THEN The step halts at the total limit and the shell policy still refuses the same commands.
Requirement: Off mode
The implement step SHALL halt at the third consecutive refusal with no repair turn when the mode of implement.halt_fixable is off.
Scenario: Off keeps today's halt
- WHEN The test sets
roadmap.decisionstoimplement.halt_fixable: offand drives three refused calls in a row. - THEN The step raises
UnexpectedModelBehaviorat the third refusal and writes no repair-turn outcome line.
Requirement: Shadow changes nothing
The implement step SHALL record the implement.halt_fixable band in shadow mode and SHALL halt at the third consecutive refusal with no repair turn.
Scenario: Shadow mode
- WHEN The test sets
roadmap.decisionstoimplement.halt_fixable: shadowand drives three refused calls in a row. - THEN The step records the band, raises
UnexpectedModelBehaviorat the third refusal, and starts no repair turn.
Requirement: Pending a person after the merge
The owner SHALL run the live check 7 days after the owner sets implement.halt_fixable to on and confirm that refused_tool stops fall and each repair turn has an outcome line.
Scenario: Seven-day live check
- WHEN The owner runs the live check of the
refused_toolstop count in Loki 7 days after the owner setsimplement.halt_fixabletoon. - THEN The
refused_toolstop count falls, and each repair turn has one outcome line.
Existing Tool Considered
The alternatives check of 2026-11-21 in the issue body gives the verdict none and names no tool. The check lists what a tool would lack. The change builds its own rule inside the roadmap implement loop. Written cost: about 0.6M tokens and half a day to build. The issue gives no separate keep-and-fix cost.
Key questions
- What does the implement step do today at three refusals in a row?:
implement_tool_log.pycounts shell refusals in a row. A call that is not refused resets the count. Atroadmap.implement.max_consecutive_refusals(3), the step raisesUnexpectedModelBehaviorwithToo many consecutive commands refused by policy: the limit is 3.The step stops with the classrefused_tool, which has the actionwait. The item stays Blocked until a person commentsimplement: retry. The halt writes no line of its own. [sources: src/devops_cli/roadmap/implement/implement_tool_log.py, src/devops_cli/lang/en/messages.py, openspec/specs/roadmap-implement-step/budgets/spec.md:29, docs/CLUSTER.md:49] - Which allowed form does the repair turn give the model?: The repair turn repeats the text that
refusal_hintgives for each refused command. A program ofIMPLEMENT_SHELL_REPLACEMENTSgets its replacement. An allowed program that the step refused for an operator gets the two-call chain. Any other program gets the allowed programs and theuv runform. Rule AW-U3 requires a refusal to name its rule and the next allowed action. (best practice) [sources: docs/guidelines/agentic-jobs.md]- Chosen: Allowed-form text of
refusal_hint. The map exists, it is the text that the refusal already gives, and AW-U3 says a refusal names the next allowed action. - Rejected: Nearest allow entries of the shared command gate. The shared command gate is feat(roadmap): track the shared command gate #5199 and not built, so it holds no allow entries to read.
- Rejected: The allowed programs alone. It drops the replacement of a known program and the two-call chain of an operator, so the reminder is not the allowed form of that command.
- Chosen: Allowed-form text of
- When is a halt fixable?: The halt is fixable when every refused program in the run has an allowed form in
IMPLEMENT_SHELL_REPLACEMENTS, or is an allowed program refused for an operator, and the model did not get that form in this step. Otherwise, the halt is not fixable, and the step halts at the third refusal as today. (best practice) [sources: src/devops_cli/roadmap/implement/implement_tool_log.py]- Chosen: Every refused program has a new allowed form. The reminder must repair every refusal in the run, not one of them.
- Rejected: Any refused program has an allowed form. One program with no allowed form leaves the reminder incomplete, and the next turn can repeat it.
- Rejected: The model already got the allowed form. A reminder of a form that the model already got cannot repair the refusal.
- What does the
implement.halt_fixablecuts file hold?: The cuts file holds the programs that have an allowed form. Each entry names a program. The allowed form itself comes fromimplement_shell_refusal.py. The rule reads the file as data and does not hard-code the list. The file lives with the other decision-point cuts files. (best practice) [sources: src/devops_cli/roadmap/decision_table.py:29]- Chosen: Cuts file of allowed programs. The rule reads the allowed programs as data, and the cuts file records their provenance.
- Rejected: Constant in the rule. A constant hides the data from the cuts file and from its provenance.
- Rejected: Read the shared command gate. The shared command gate is feat(roadmap): track the shared command gate #5199 and not built, so it holds no allow entries to read.
- How does the step know that the model already got an allowed form in this step?: The step records each allowed form that a refusal hint gives in the current step. At the halt, a refused program is not fixable when its allowed form is in that record. The record is cleared at the start of each step. (best practice) [sources: src/devops_cli/roadmap/implement/implement_tool_log.py]
- Chosen: Record the allowed forms that the step gives. The step can compare the allowed form of each refused program with the forms that it already sent.
- Rejected: Compare the command text only. The same command can get a different allowed form, and the text alone does not show that the model got the form.
- Rejected: Ask the model. The model can be wrong, and the step needs a deterministic check.
- How many repair turns does one step and one item get?: One repair turn per step and two per item. A second fixable halt in the same step halts the step, and a third fixable halt in the item halts the item. The item cap of 2 matches
roadmap.implement.continuations_per_item(default 2), which already bounds a second run of an item. (best practice) [sources: src/devops_cli/config/settings.py:1673, docs/CONFIGURATION.md, docs/ROADMAP_WORKFLOW.md]- Chosen: 1 per step, 2 per item. A step gets the one extra turn it needs, and the item cap of 2 matches
continuations_per_itemand stops a loop. - Rejected: 1 per item. A later step can meet a new refused shape, and the item cap would end the item with no repair in that step.
- Rejected: No cap. A loop of refused commands can spend the step and item token budgets.
- Chosen: 1 per step, 2 per item. A step gets the one extra turn it needs, and the item cap of 2 matches
- Does the shared command gate exist, so that a
Command gate halt:line can be counted?: No. Rule AW-G1 names the shared command gate as feat(roadmap): track the shared command gate #5199, and until it exists the runner pod is the sandbox. The halt is inimplement_tool_log.pyand writes no line of its own. The 7-day measurement counts therefused_toolstop lines and the repair-turn outcome lines, not a gate line. [sources: docs/guidelines/agentic-jobs.md, docs/ROADMAP_WORKFLOW.md, src/devops_cli/roadmap/implement/implement_tool_log.py, docs/CLUSTER.md:49] - Does the change alter the shell policy or the total refusal limit?: No. The shell policy stays a sandbox rule and the total of 30 refused calls stays. The repair turn adds one model turn before the consecutive-refusal halt. It resets the consecutive refusal count after the turn, and it resets neither the total refusal count nor the shell policy. (best practice) [sources: docs/ROADMAP_WORKFLOW.md, docs/guidelines/agentic-jobs.md, openspec/specs/roadmap-implement-step/budgets/spec.md:33, src/devops_cli/roadmap/implement/implement_tool_log.py]
- Chosen: Keep the shell policy and the total. The item keeps the sandbox rule and the loop guard, and AW-T6 forbids a tuning pass on a security control.
- Rejected: Raise the consecutive-refusal limit. That is a tuning pass on the command gate, which AW-T6 forbids, and it does not repair the command.
- Rejected: Remove the total limit. It removes a guard against a loop and spends the item budget.
- How does the step record a repair turn?: The step writes one outcome line for each repair turn with the turn number and the result
continuedorhalted. The feat(roadmap): log one result line for each roadmap job attempt #4845 result line holdshalt_turnswith the count of the repair turns of the item. (best practice) [sources: src/devops_cli/roadmap/job_result.py, src/devops_cli/roadmap/implement/implement_tool_log.py, openspec/specs/roadmap-implement-step/trace/spec.md:93]- Chosen: Outcome line and
halt_turns. The line shows each turn, and the result line shows the count of the item. - Rejected: Only the
refusedtrace line of each call. It shows each refusal and cannot show the result of the turn. - Rejected: Only the stop comment of the item. It shows the end of the item and cannot show each turn.
- Chosen: Outcome line and
- Which mode does
implement.halt_fixablerun in, and who turns it on?: The point starts inshadowinroadmap.decisions, as ADR 0020 section 5 requires of a new point. A person sets it toonin the ConfigMapdevops-cli-configafter reading the shadow record and the outcome lines. The tests drive theon,shadowandoffmodes. (best practice) [sources: docs/adr/0020-a-decision-point-is-a-unit-of-a-workflow-with-a-resolver-chain-and-a-rule-goes-before-a-decision-model.md, src/devops_cli/roadmap/decision_table.py:29]- Chosen: Start in shadow, then a person sets on. ADR 0020 section 5 requires a new point to start in shadow, and a person reads the record before the point changes behavior.
- Rejected: Start in on. It changes the halt behavior with no shadow record, which ADR 0020 forbids.
- Rejected: Start in off. It adds a registered point with no evidence, and the shadow mode exists for that evidence.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It raises implement success from about 15 percent but does not block a release or fix a security gap.It gives the model one chance to correct a refused command, which should raise the ready-PR rate for implement jobs.The body estimates about 0.6M tokens and half a day of work.Both work on the implement step refusal path, but #4115 stops the step early on stalls and refusals while this item inserts one repair turn with allowed command forms before the halt triggers.devops-cli-service commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.The change gives implement a lever against frequent refusal stops, but the halt has only hours of data.One repair turn can recover fixable refusals and raise the low ready-PR rate.The body estimates about 0.6M tokens and half a day of work.Both items act on consecutive command refusals in implement, but 4043 adds the halt and the candidate adds one repair turn before that halt.dan-petty commentedon Nov 12, 2026
The command gate plan (tracker #5199) can make this item unnecessary.
All 13 measured halts on 3 refusals in a row came from the shapes S1 and S2: a quoted
;in inline Python and a quoted heredoc. #5201 puts both on the allowlist (owner decision of 2026-11-12), and it adds the log lineCommand gate halt: limit <name>, last rule <id>.. Today no Loki line records a halt.New scope:
Command gate halt:lines in Loki. Use the run-length count of refusal lines of the 7 days before as the baseline.Acceptance: a comment on this item holds the LogQL queries and the counts of the 7 days before and after the deploy.
Dependencies: #5201.
devops-cli-service commentedon Nov 14, 2026
Alternatives check: none
Reason: The searches surfaced only general shell-parsing and command-policy building blocks (the closest being bashlex, a Python bash parser), none of which carries an allowed-form map, a fixable check, a one-turn repair before a halt, or the consecutive-refusal accounting. The need is a change inside the roadmap implement loop and its own
implement_shell_refusal.py/implement_tool_log.pymodules, so no open tool covers it.Tool: none found
Tools considered:
Searches run:
Sources:
Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 15, 2026
Refine cannot set this item to Ready at ca62d6a while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/roadmap/implement/implement_tool_log.py,src/devops_cli/roadmap/implement/implement_shell_policy.py.devops-cli-service commentedon Nov 16, 2026
Refine cannot set this item to Ready at 69bf1aa while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/roadmap/implement/implement_shell_policy.py,src/devops_cli/roadmap/implement/implement_tool_log.py.devops-cli-service commentedon Nov 17, 2026
Owner question: Which mode does
implement.halt_fixablerun in, and who turns it on? (a person decides)Options
Recommendation: Decide the question: only a person can answer it.
Evidence
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 20, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 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.