Skip to content

loopguard: count a test run in a conda environment as a verification - #255

Merged
Saksham Uboweja (SakshamUboweja) merged 1 commit into
microsoft:mainfrom
Shizoqua:fix-loopguard-conda-run
Nov 18, 2026
Merged

Saksham Uboweja (SakshamUboweja) merged 1 commit into
microsoft:mainfrom
Shizoqua:fix-loopguard-conda-run

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

conda run -n ml pytest, mamba run -p ./env python -m pytest and micromamba run -n ml pytest run the tests in a named or prefixed environment, as uv run and poetry run do in theirs. The prefix pattern knew those launchers but not conda's, so the run was not a verification, and a failing run after the last edit left the turn counted as ended green. The micro-skills observer already learns and injects the conda run -n <env> form, so an agent following that fact ran a command the loop guard did not read.

Fix: conda, mamba and micromamba run are passed over with their options in _PREFIX_RE; -n, -p, -r, --name, --prefix, --root-prefix and --cwd take a value. conda run -n ml python train.py, conda install pytest and conda run -n ml pytest --collect-only are still not test runs. The new alternative sits apart from the lines #240 and #247 change, and the branch merges with both.

Tests, in a new tests/test_loopguard_conda_run.py:

  • test_a_runner_in_a_conda_environment_counts_as_a_verification: 11 commands. Each is a verification, and a failing run after an edit is not ended green. All 11 fail on main (assert None == 'own') and pass with the fix.
  • test_conda_leaves_what_it_runs_to_decide: 4 commands that stay non-runs.
python -m pytest tests -rfEs --tb=line
1182 passed, 31 skipped

The skips need Windows, a real agent CLI (Codex, Hermes, opencode) or aider, or a non-root user.

Fixes #251

`conda run -n ml pytest`, `mamba run -p ./env python -m pytest` and `micromamba run -n ml pytest`
run the tests in a named or prefixed environment, as `uv run` and `poetry run` do in theirs. The
prefix pattern knew those launchers but not conda's, so the run was not a verification, and a
failing run after the last edit left the turn counted as ended green. The micro-skills observer
already learns and injects the `conda run -n <env>` form, so an agent following that fact ran a
command the loop guard did not read.

conda, mamba and micromamba `run` are now passed over with their options; `-n`, `-p`, `-r`,
`--name`, `--prefix`, `--root-prefix` and `--cwd` take a value. `conda run -n ml python train.py`
and `conda install pytest` are still not test runs.
@SakshamUboweja
Saksham Uboweja (SakshamUboweja) merged commit ec13f5a into microsoft:main Nov 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loopguard: a test run in a conda environment is not counted as a verification

2 participants