Repository navigation
Description
Problem
The test-strength check of the implement job (#3051, PR #5770, merged 2026-11-15 05:43Z) cannot run. run_mutation (src/devops_cli/roadmap/implement/implement_strength.py:170) starts uv run mutmut run with env={"PYTEST_ADDOPTS": ...}. run_subprocess refuses this key, because PYTEST_ADDOPTS is in the list of dangerous environment keys (src/devops_cli/config/constants.py:1949, #2747: --junitxml=<path> makes pytest write a file at a path that the caller names). The refusal is SecurityError: Prohibited dangerous environment variable override: 'PYTEST_ADDOPTS' (src/devops_cli/core/process.py:226).
So each implement run that passes its groups stops at the scoped checks. Since 05:43Z, 3 of 9 implement attempts stopped this way, all after every group passed:
- feat(roadmap): Stage items whose draft plan fails the check #3387 at 2026-11-15T12:00Z
- feat(roadmap): add toolset comparison to stage planner eval #3239 at 17:18Z
- fix(roadmap): a return request leaves room for the planner tools #3529 at 20:30Z (groups 1 and 2 done, 23.4M input tokens, then the stop)
The job gives this stop the class ci_infra with the action retry, and the Service clears the stop when a new runner image rolls out. The stop is a code defect, so each retry fails in the same way.
The unit tests of #5770 replace run_subprocess, so no test ran the real command with the real env check.
Expected behavior
- The strength check runs mutmut on the scoped tests and keeps the env deny list as it is. Do not remove
PYTEST_ADDOPTSfrom the list; it is a security control. - A
SecurityErrorfrom a check command gets a class that is notci_infra, so the Service does not retry it on each rollout.
Fix options (the plan decides)
- Give mutmut 3.8.1 the test selection through its own setting (for example
pytest_add_cli_args_test_selectionin a mutmut config that the run writes in the work tree), not through the environment. - Map
SecurityErrorin the check runner to a code class (for exampleplan_defector a new class), with the command in the stop. - Test first: one test calls the real
run_subprocessenv check with the env thatrun_mutationbuilds, and fails on the base.
Related
- feat(roadmap): new tests of an implementation are checked for strength #3051, feat(roadmap): Check the strength of the new tests (#3051) #5770 (the strength check), fix(security): the subprocess environment guard accepts the pytest and npm keys that make a child write a file #2747 (the env deny list), fix(ci): the fail-to-pass replay clears the addopts #5599 (addopts in the fail-to-pass replay).
Source: #3529
Proposed design
Problem statement
The strength check of the implement job cannot run. run_mutation sets PYTEST_ADDOPTS in the environment of uv run mutmut run, and run_subprocess refuses that key as a dangerous environment override. Each implement run that passes its groups stops at the scoped checks with the class ci_infra, and the Service retries it on each new runner image. The fix gives mutmut the test selection through its own setting and maps a SecurityError from a check command to a class that a retry cannot clear.
Acceptance criteria
Requirement: The mutation run passes the environment guard
The strength check SHALL give the scoped test selection to mutmut through the mutmut configuration, and SHALL NOT put PYTEST_ADDOPTS in the environment of run_subprocess.
Scenario: The environment of the mutation run is accepted
- WHEN
run_mutationbuilds the environment foruv run mutmut run - THEN the real
run_subprocessenvironment check accepts the environment and raises noSecurityError.
Requirement: The deny list keeps PYTEST_ADDOPTS
CONST_DANGEROUS_ENV_KEYS SHALL keep PYTEST_ADDOPTS.
Scenario: A caller sets PYTEST_ADDOPTS
- WHEN a caller passes
PYTEST_ADDOPTStorun_subprocess - THEN
run_subprocessraisesSecurityError: Prohibited dangerous environment variable override: 'PYTEST_ADDOPTS'.
Requirement: The mutation run selects the scoped tests
The mutation run SHALL select only the scoped test modules through pytest_add_cli_args_test_selection.
Scenario: The written configuration holds the scoped tests
- WHEN the strength check writes the mutmut configuration for two scoped test modules
- THEN the
pytest_add_cli_args_test_selectionvalue names both test modules.
Requirement: A refused check command gets a code class
The check runner SHALL classify a SecurityError from a scoped check command as plan_defect, and SHALL name the command in the stop.
Scenario: A scoped check command raises SecurityError
- WHEN a scoped check command raises
SecurityError - THEN the stop has the class
plan_defectand its text names the command.
Requirement: The docs name the mutmut setting
The implement documentation SHALL name pytest_add_cli_args_test_selection as the source of the scoped test selection of the mutation run.
Scenario: The docs describe the mutation run
- WHEN a reader opens
docs/roadmap/implement.mdanddocs/ROADMAP_WORKFLOW.md - THEN both texts name the mutmut setting and neither text names
PYTEST_ADDOPTSfor the mutation run.
Requirement: The regression test runs the real guard
A test SHALL call the real run_subprocess environment check with the environment that run_mutation builds.
Scenario: The new test runs on the base commit
- WHEN the new test runs against the code before the fix
- THEN it fails with
SecurityError: Prohibited dangerous environment variable override: 'PYTEST_ADDOPTS', and it passes after the fix.
Existing Tool Considered
No alternatives check has run. The tool is mutmut 3.8.1, which already runs the mutation check. Its pytest_add_cli_args_test_selection setting covers the scoped test selection without an environment key. It lacks nothing for this fix, so the change adds no new tool and no replacement code.
Key questions
- Where does the strength check set
PYTEST_ADDOPTS, and why does the guard refuse it?:run_mutationsets the key in the environment ofuv run mutmut run.run_subprocessrefuses it becauseCONST_DANGEROUS_ENV_KEYSlists it, after fix(security): the subprocess environment guard accepts the pytest and npm keys that make a child write a file #2747:--junitxml=<path>makes pytest write a file at a path that the caller names. [sources: src/devops_cli/roadmap/implement/implement_strength.py:170, src/devops_cli/config/constants.py:1949, src/devops_cli/core/process.py:226] - How does the strength check give the scoped test selection to mutmut?: The strength check writes the
pytest_add_cli_args_test_selectionkey of the mutmut configuration in the work tree before the run. The child gets noPYTEST_ADDOPTSkey. (best practice) [sources: src/devops_cli/config/constants.py:1949]- Rejected: The
PYTEST_ADDOPTSenvironment key.run_subprocessrefuses the key, because it is a file-write key (fix(security): the subprocess environment guard accepts the pytest and npm keys that make a child write a file #2747). - Chosen:
pytest_add_cli_args_test_selectionin the mutmut configuration. mutmut 3.8.1 reads the setting itself, so no denied key reaches the child. - Rejected: Remove
PYTEST_ADDOPTSfrom the deny list. The list is a security control (fix(security): the subprocess environment guard accepts the pytest and npm keys that make a child write a file #2747). - Rejected: Pass the test selection as arguments to
mutmut run. mutmut passes no test selection arguments to pytest, so the setting is the supported path.
- Rejected: The
- Which failure class does the check runner give a
SecurityErrorfrom a check command?: The check runner gives itplan_defectand puts the command in the stop text. (best practice) [sources: src/devops_cli/config/settings.py:1164, src/devops_cli/roadmap/failure.py, docs/CLUSTER.md:47]- Rejected:
ci_infra. Its action isretry, so the Service clears the stop on each new runner image and the same defect runs again. - Chosen:
plan_defect. A retry cannot fix a refused command, so its action does not clear the stop on a new runner image. - Rejected: A new class. It needs a new
FailureClassvalue, ledger, alert and settings changes for one case.
- Rejected:
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 15, 2026
Three of nine implement attempts stopped and each retry fails the same way, blocking the service pipeline.#3051 created the strength check; the candidate fixes a defect in that check's environment handling and error classification.devops-cli-service commentedon Nov 15, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
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