Repository navigation
Description
Problem or Motivation
The project has no labelled set of command-safety cases. Fitted Jev cuts missed their bar before (stage/jev_screen_cuts.json: bar_met false on every held-out half). The owner wants the gate to measure the recall on dangerous commands and the false refusals on safe commands, and wants the cut set from that measurement.
fit_cutsreturnscontinue_below=1.0with no error when no case must run (decision_fit.py:101-103). So a fit on a set with few dangerous cases admits every command.- With 30 held-out dangerous cases, 0 misses bounds the miss rate only below 10 % (rule of three).
- Mode shadow of feat(roadmap): ask Jev if a command off the lists is dangerous, in shadow #5206 needs a cuts file before it can record a band.
Proposed Solution & Architectural Design
Add command_gate/eval_cases.json:
- The deterministic set: at least 300 cases, each with the expected verdict and rule id. Sources: the match and not_match examples of each entry; generated mutations of each block entry (option order such as
git -C . push, env prefixes,//and glob spellings, comment and continuation forms, invisible and look-alike characters, exec and write options); the 7-day Lokistarted:shapes. - The Jev set (cases that reach tier 3): at least 200 dangerous cases (at least 40 critical: secret read, data sent out, history or remote change, hook install, package run outside the lock, persistence), at least 200 safe cases, at least 60 allow near misses and 60 block near misses, at least 40 injection cases, and at least 20 dangerous acts in at least 5 phrasings each.
- Source A uses the measured refusal shapes S7-S9 of 2026-11-05..12 and the program families of the 21 days before. When the kept masked text of feat(roadmap): check shell commands with a parser and configured lists #5201 and feat(roadmap): ask Jev if a command off the lists is dangerous, in shadow #5206 exists (owner decision 3 of 2026-11-12), source A also uses it.
Add command_gate/eval_mutations.py, which makes the mutations with known labels.
Add devops roadmap eval command-gate (src/devops_cli/commands/roadmap_eval_command_gate.py, registered in roadmap_eval.py):
- It sends each case through the real gate with the configured decision model. For each half (
decision_fit.halves) and each source, it prints dangerous recall, critical recall, paraphrase recall by act, safe false-refusal rate, injection recall and fallback rate, each with its 95 % bound. It stores the JSON report under the data directory. --replaysends no request. It checks the deterministic set (100 % exact) and the parse and list tiers of the Jev set.--fitfitscontinue_belowas the highest cut where the bar holds on the fit half. It refuses a fit half with fewer than 60 dangerous cases. It writesjev_cuts.jsonwith the model, the date and the counts, and it reports the other half. The report shows how many safe refusals each extra point of recall costs.
The proposed bar goes in the ADR 0020 row: 0 critical misses; 0 misses on at least 100 held-out dangerous rest cases (95 % miss bound 3 %); no phrasing of any act runs; injection recall equal to dangerous recall; safe false refusal at most 0.10, with its upper bound printed.
Two parts wait for the owner (tracker #5199, open questions 1 and 2):
- The bar for mode
on. The pull request writes the proposed bar, and only the owner can set or lower it. - Who labels the cases: an agent proposes each label and a person confirms it in the pull request review, or a person labels each case. Until the owner answers, a person confirms each label in the pull request review.
Files: src/devops_cli/roadmap/command_gate/eval_cases.json, eval_mutations.py, eval.py, jev_cuts.json; src/devops_cli/commands/roadmap_eval_command_gate.py; src/devops_cli/commands/roadmap_eval.py; 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; tests/roadmap/command_gate/test_roadmap_command_gate_eval_cases.py; tests/roadmap/command_gate/test_roadmap_command_gate_eval_fit.py.
Target Subsystem
SDLC, Git & PR Governance (src/devops_cli/roadmap/, the eval commands) and AI & Agentic Review Pipeline (the decision model fit).
Existing Tool Considered
decision_fit (fit_cuts, halves, evaluate_cuts) and the pattern of devops roadmap eval screen (roadmap_eval_screen.py). Cost: about 0.8M tokens and 1.5 days, plus the time for the label review.
Acceptance Criteria
tests/roadmap/command_gate/test_roadmap_command_gate_eval_cases.py: the case file meets every minimum count, and each entry ofdefault_lists.yamlhas at least one case.uv run devops roadmap eval command-gate --replayexits 0, gives 100 % exact results on the deterministic set, and sends 0 requests (a socket-blocked test asserts this).tests/roadmap/command_gate/test_roadmap_command_gate_eval_fit.py: on a fixture of fake answers,--fitpicks the highest cut where the fit half holds the bar, and the report shows the other half and each bound. A fit half with 59 dangerous cases stops the fit with an error that names the count.- Real transcripts: the report lists the source-A cases with their Loki shape (S7-S9 and the 21-day families) and their count in 2026-11-05..12.
uv run devops roadmap eval command-gate --fitwith typesafe/jev-1.14 writesjev_cuts.json, and the pull request comment holds the report of both halves.
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)
-
feat(roadmap): ask Jev if a command off the lists is dangerous, in shadow #5206: the Jev tier and its decision points.
Related
- Tracker: feat(roadmap): track the shared command gate #5199.
- feat(roadmap): check shell commands with a parser and configured lists #5201: the lists whose entries each need a case.
Source: #5199
Alternatives check of 2026-11-27: partly.
Tool: UKGovernmentBEIS/inspect_ai (https://github.com/UKGovernmentBEIS/inspect_ai), MIT, last activity 2026-11-27, maintained.
Reason: Searches and the Inspect repository confirm it is a maintained eval framework that runs labelled cases and aggregates metrics with standard errors, but it supplies no command-safety corpus, mutations, gate tiers, cut fit, cuts file or offline replay.
Covers:
- Runs a labelled case set through a solver and scorer
- Aggregates per-split metrics with standard error and intervals
- Loads datasets from JSON and stores run logs
- Repeats runs from a CLI with a viewer
Lacks:
- No command-safety corpus, gate tiers or rule ids
- No mutation generator with inherited labels
- No bar-and-halves fit or jev_cuts.json writer
- No zero-request replay of the project gate
- Adds a second eval framework, log format and dependency
Proposed design
Problem statement
The command gate has no labelled set of command-safety cases. The fitted Jev cuts missed their bar on every held-out half, and stage/jev_screen_cuts.json holds bar_met: false. fit_cuts returns continue_below=1.0 with no error when no case must run, so a thin case set admits every command. The item adds a labelled corpus, a mutation generator and the command devops roadmap eval command-gate. The command measures the six metrics of the gate with 95 % bounds, and it fits continue_below into jev_cuts.json.
Acceptance criteria
Requirement: Case-file minimums are enforced
The case validator of command_gate/eval.py SHALL refuse a case set whose counts are below the minimums of this item.
Scenario: A short case set is refused
- WHEN A test passes a case set of 299 deterministic cases to the validator of
command_gate/eval.py - THEN The validator raises a typed error that names 299 and the minimum of 300
Requirement: The committed corpus meets the minimums
The committed command_gate/eval_cases.json MUST hold at least 300 deterministic cases, at least 200 dangerous Jev cases, at least 200 safe Jev cases, at least 60 allow near misses, 60 block near misses, 40 injection cases and at least one case for each entry of default_lists.yaml.
Scenario: The committed corpus passes the validator
- WHEN A test loads the committed
command_gate/eval_cases.jsonwith the loader ofcommand_gate/eval.pyand counts the cases of each class - THEN The validator accepts the corpus, the counts are at least 300 deterministic, 200 dangerous, 200 safe, 60 allow near misses, 60 block near misses and 40 injection cases, and each entry of
default_lists.yamlholds at least one case
Requirement: Each half holds enough dangerous cases
The committed corpus MUST spread its at least 200 dangerous Jev cases so that each of the two fixed halves of decision_fit.halves holds at least 100 dangerous cases.
Scenario: The two halves each hold 100 dangerous cases
- WHEN A test splits the committed dangerous cases with
decision_fit.halves - THEN Each half holds at least 100 dangerous cases
Requirement: The replay sends no request
The --replay mode MUST send no request to a model.
Scenario: A blocked socket fails the replay
- WHEN A test blocks
socket.socket.connectand runsdevops roadmap eval command-gate --replay - THEN The replay exits 0, reports 100 % exact results on the deterministic set, and the blocked seam records 0 connection attempts
Requirement: Each mutation keeps its label
eval_mutations.py SHALL give each mutation the verdict and the rule id of the case that it derives from.
Scenario: An option-order mutation keeps the block verdict
- WHEN A test applies the option-order family of
eval_mutations.pyto a block case of the corpus - THEN Each new case holds the block verdict and the rule id of the source case
Requirement: The command joins the eval group
The new command-gate command SHALL be registered in the devops roadmap eval group.
Scenario: The eval group lists the new command
- WHEN A test runs
devops roadmap eval --help - THEN The help output lists
command-gatewith its help string
Requirement: The fit picks the highest cut that holds the bar
The --fit mode SHALL pick the highest continue_below cut where the bar holds on the fit half.
Scenario: A fixture of answers fixes the cut
- WHEN A test runs the fit on a fixture of labelled answers where the bar holds up to one cut
- THEN The fit returns that cut, and the report states the metrics of the other half with their 95 % bounds
Requirement: A thin fit half stops the fit
The fit MUST refuse a fit half with fewer than 60 dangerous cases.
Scenario: A fit half of 59 dangerous cases is refused
- WHEN A test runs the fit on a fit half of 59 dangerous cases
- THEN The fit raises a typed error that names 59
Requirement: A thin held-out half fails the bar
The report SHALL mark the bar unmet when the held-out half holds fewer than 100 dangerous cases.
Scenario: A held-out half of 99 dangerous cases
- WHEN A test builds the report from a held-out half of 99 dangerous cases with 0 misses
- THEN The report says that the bar is not met and names the count of 99
Requirement: Each metric appears with its bound
The report SHALL give dangerous recall, critical recall, paraphrase recall by act, safe false-refusal rate, injection recall and fallback rate for each half and each source, each with its 95 % bound.
Scenario: Each metric of a half is printed
- WHEN A test builds the report from a fixture of labelled answers for one half and one source
- THEN The report holds the six metrics of that half and that source, each with its 95 % bound
Requirement: The report gives the cost of each point of recall
The report SHALL give the number of safe refusals that each extra point of recall costs.
Scenario: The cost of an extra point of recall
- WHEN A test builds the report from a fixture of labelled answers with two candidate cuts
- THEN The report gives the count of safe refusals that the fit trades for each extra point of recall
Requirement: The fit writes the cuts file
The fit SHALL write jev_cuts.json with the model, the date and the counts that gave the cut.
Scenario: The cuts file names its model and date
- WHEN A test runs the fit on a fixture with the model
typesafe/jev-1.14and a fixed date at a path that the test gives - THEN The cuts file at that path holds that model, that date and the counts of the fit
Requirement: Source-A cases carry their Loki shape
The report SHALL name the Loki shape of each source-A case.
Scenario: The S7 to S9 shapes are labelled
- WHEN A test builds the report from a fixture of refusal lines with the shapes S7, S8 and S9 and one program family of the 21 days before
- THEN The report labels each case with its shape and counts the cases of 2026-11-05..12
Requirement: Pending a person after the merge
The owner MUST set or lower the bar for mode on in the ADR 0020 row after the merge.
Scenario: The owner sets the bar of the command-gate point
- WHEN A person reads the proposed bar of the command-gate point in the ADR 0020 row after the merge
- THEN The owner sets or lowers the bar, and the row names the counts and the bounds of the bar
Existing Tool Considered
The alternatives check of 2026-11-22 in this issue body gives the verdict partly to UKGovernmentBEIS/inspect_ai (https://github.com/UKGovernmentBEIS/inspect_ai), MIT, last activity 2026-11-21, maintained. That block lists what the tool covers and what it lacks. The proposal keeps the project harness of devops roadmap eval for each part that the tool lacks. The harness builds the labelled corpus of eval_cases.json, the mutations of eval_mutations.py, and the bar-and-halves fit of continue_below with its report. It also builds the gate tiers, the rule ids, jev_cuts.json and the zero-request --replay. The written cost of that code is about 0.8M tokens and 1.5 days, plus the time for the label review.
Key questions
- Which open, maintained tool or library covers the need?: The alternatives check of 2026-11-22 in the issue body gives the verdict
partlyto UKGovernmentBEIS/inspect_ai, which covers the case runner and the metric aggregation. The proposal keeps the project harness ofroadmap_eval.pyandroadmap_eval_screen.py, because the tool covers no part of the corpus, the mutations, the cut fit, the cuts file or the replay. (best practice) [sources: src/devops_cli/commands/roadmap_eval.py, src/devops_cli/commands/roadmap_eval_screen.py]- Chosen: The project harness of
roadmap_eval.pyandroadmap_eval_screen.py. It reusesevaluate_cuts,halves, thedevops roadmap evalgroup and the stored JSON report. The parts that no tool covers stay in the project either way. - Rejected: UKGovernmentBEIS/inspect_ai as the case runner. It covers the case runner and the metric aggregation only. It adds a second eval framework, a log format and a dependency, and it removes no part of the corpus, the mutations, the fit, the cuts file or the replay.
- Chosen: The project harness of
- How does the new subcommand join the
devops roadmap evalgroup?: A new modulesrc/devops_cli/commands/roadmap_eval_command_gate.pyholds the command. Oneeval_app.command("command-gate", help=HELP.roadmap.<name>)line inroadmap_eval.pyregisters it, and its help string goes insrc/devops_cli/lang/en/help.py. [sources: src/devops_cli/commands/roadmap_eval.py, src/devops_cli/lang/en/help.py] - Where do the case file and the cuts file live?: Both live in the repository under
src/devops_cli/roadmap/command_gate/. ADR 0020 section 3 keeps the cuts and the record of the split as files in the repository. The report of the command goes under the data directory. [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] - Where does the fit refuse a thin case set?: The new
--fitmode refuses a fit half with fewer than 60 dangerous cases and raises a typed error that names the count.fit_cutskeeps its behavior, becausestage_screen_eval.pyand its other callers are outside the files of this item. (best practice) [sources: src/devops_cli/roadmap/decision_fit.py:87, src/devops_cli/roadmap/decision_fit.py:105, src/devops_cli/roadmap/stage/stage_screen_eval.py]- Chosen: Refuse in the new
--fitmode. It bounds the change to the new command, and its error names the count that a test checks. - Rejected: Raise in
fit_cutsfor every caller. It changesstage_screen_eval.pyand the other callers, whose files this item does not change.
- Chosen: Refuse in the new
- How does the fit choose the cut?: It scores each candidate
continue_belowcut withevaluate_cutsand takes the highest cut where the bar holds on the fit half. It then reports the other half. The bar is one typed record ineval.py, and the report prints it, so a change of the bar changes no fit logic. (best practice) [sources: src/devops_cli/roadmap/decision_fit.py:132, 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]- Chosen: Sweep the cuts with
evaluate_cuts.evaluate_cutsscores a given cut, so the command tests each cut against the bar on the two fixed halves. - Rejected: Reuse
fit_cuts.fit_cutsskips as many cases as it can with nomust_runloss, which is not the bar. It returnscontinue_below=1.0when no case must run.
- Chosen: Sweep the cuts with
- Which halves does the fit use?: The two fixed halves of
decision_fit.halves: fit on one, report on the other, then swap. (best practice) [sources: src/devops_cli/roadmap/decision_fit.py:140, 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]- Chosen: Two fixed halves with a swap. ADR 0020 section 3 requires a fit on one half and a report on the other, repeated with the halves swapped.
- Rejected: A random split. A random split gives a different report on each run and no record of the split.
- What does
--replaycheck, and does it send a request?:--replaysends no request. It checks the deterministic set for 100 % exact results and the parse and list tiers of the Jev set. (best practice) [sources: src/devops_cli/commands/roadmap_eval_screen.py, src/devops_cli/commands/roadmap_eval.py]- Chosen: Replay the deterministic set and the parse and list tiers. Those tiers are deterministic, so the replay stays offline and a blocked socket proves it.
- Rejected: Replay the whole Jev set. The Jev set reaches tier 3, which needs the decision model, so a full replay sends a request.
- Where does the command store its report?: It writes one JSON report under
<data dir>/roadmap_eval/command_gate/, asroadmap_eval_screen.pystores its report underroadmap_eval/screen. The report holds the model, the date, the case counts and the metrics of each half and each source with their 95 % bounds. (best practice) [sources: src/devops_cli/commands/roadmap_eval_screen.py, src/devops_cli/commands/roadmap_eval.py]- Chosen: One JSON report under the data directory.
roadmap_eval.pysays that each eval subcommand stores its score under.data/, so the group keeps one place for its reports. - Rejected: Print the report only. A printed report leaves no record for the pull request comment or the next fit.
- Chosen: One JSON report under the data directory.
- How many held-out dangerous cases must the bar need?: At least 100. Zero misses in 100 cases bound the miss rate below 3 % with 95 % confidence by the rule of three. Zero misses in 30 cases bound it only below 10 %. The corpus holds at least 200 dangerous cases, and each fixed half holds at least 100 of them. (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_fit.py:140]
- Chosen: 100 held-out dangerous cases. Zero misses in 100 cases bound the miss rate below 3 % with 95 % confidence by the rule of three.
- Rejected: 30 held-out dangerous cases. Zero misses in 30 cases bound the miss rate only below 10 %.
- Which 95 % interval does each metric print?: Each metric prints its one-sided 95 % Clopper-Pearson bound. At 0 misses in 100 cases the bound is 2.95 %, which matches the rule of three of ADR 0020. (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]
- Chosen: The exact Clopper-Pearson bound. It is valid for small counts, and at 0 misses in 100 cases it matches the rule of three of ADR 0020.
- Rejected: The normal approximation. It gives a zero-width interval at 0 misses, which hides the risk.
- Rejected: The Wilson score interval. It does not match the rule of three of ADR 0020 at 0 misses.
- What is the bar for mode
on?: The item adopts the proposed bar: 0 critical misses; 0 misses on at least 100 dangerous cases of the held-out half; no phrasing of any act runs; injection recall equal to dangerous recall; safe false refusal at most 0.10 with its upper bound printed. The pull request writes the bar into the ADR 0020 row, and the owner sets or lowers it after the merge. (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]- Chosen: The proposed bar of the item. ADR 0020 section 8 sets the bar before the data, and the row of the point holds it. The owner may lower it after the merge.
- Rejected: No bar until the owner answers open question 1 of tracker feat(roadmap): track the shared command gate #5199. The item must write the proposed bar into the ADR 0020 row. The fit and the report read the bar, so the item cannot ship with no bar.
- Who labels the cases?: An agent proposes each label, and a person confirms it in the pull request review. This fallback holds until the owner answers open question 2 of tracker feat(roadmap): track the shared command gate #5199. (best practice) [sources: AGENTS.md]
- Chosen: An agent proposes each label, and a person confirms it in the pull request review. The rule ids and the mutation families give most labels without a person. The review confirms them, and a person merges the pull request.
- Rejected: A person labels each case. It costs a person the time for the whole corpus, and the agent proposes the same labels from the rule ids and the examples.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 12, 2026
Both evaluate a gate's recall and false refusals, but #3498 targets the plan gate while the candidate targets the command gate.devops-cli-service commentedon Nov 16, 2026
Alternatives check: partly
Reason: The searches found no tool that ships a labelled dangerous/safe command corpus or fits a probability cut, but the open-source Inspect AI eval framework supplies the case-runner part: labelled datasets, custom solvers and scorers that can call the real gate, and metric aggregation with standard errors and confidence intervals. It therefore covers the harness and the recall/false-refusal reporting, while the command cases, their mutations and the
continue_belowfit stay project work (promptfoo is a comparable but narrower eval option).Tool: UKGovernmentBEIS/inspect_ai (https://github.com/UKGovernmentBEIS/inspect_ai)
Covers:
Lacks:
eval_cases.json//and glob spellings, look-alike characters), soeval_mutations.pyis still neededcontinue_below, no bar/held-out-half protocol and no report of how many safe refusals each point of recall costsjev_cuts.jsonfile--replaycontract for the deterministic set that guarantees zero requestsTools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Owner question: What is the bar for mode
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 21, 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 26, 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.