Skip to content

microskills: read conda run -p and micromamba run as the command they run - #256

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

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

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

conda run names its environment by name (-n ml) or by path (-p ./env, --prefix), and micromamba takes the same options. The observer read only conda|mamba run -n NAME, so conda run -p ./env pytest was observed as a call to the package tool conda, and micromamba run -n ml pytest was not observed at all. A repository that keeps its environment under a path, or uses micromamba, never got a fact naming the command that works there.

Fix: _CONDA_RUN_RE reads -n/--name and -p/--prefix (with a space or =), and the form keeps the environment as typed (conda run -p ./env pytest, micromamba run -n ml pytest). mamba run is still written as conda run, as before. micromamba joins conda in envfacts._RUN_WORDS, the launcher words that do not name the tool itself.

Tests, in a new tests/test_observe_conda_run.py:

  • the observed form of 7 commands; the 5 prefix and micromamba ones fail on main, the 2 -n ones pass on both;
  • conda run -p ./env pytest is a test run and conda install -n ml pytest is still a package-tool call;
  • end to end through EnvFactsDistiller on four made-up Codex sessions where python -m pytest fails and conda run -p ./env python -m pytest passes: the rendered block names the conda form. It fails on main and passes with the fix.
python -m pytest tests -rfEs --tb=line
1176 passed, 31 skipped

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

Fixes #252

… run

`conda run` names its environment by name (`-n ml`) or by path (`-p ./env`, `--prefix`), and
micromamba takes the same options. The observer read only `conda|mamba run -n NAME`, so
`conda run -p ./env pytest` was observed as a call to the package tool `conda`, and
`micromamba run -n ml pytest` was not observed at all. A repository that keeps its environment
under a path, or uses micromamba, never got a fact naming the command that works there.

The form now keeps the environment as typed (`conda run -p ./env pytest`,
`micromamba run -n ml pytest`); `--prefix=` and `--name=` are read too. `mamba run` is still
written as `conda run`, as before.
@SakshamUboweja
Saksham Uboweja (SakshamUboweja) merged commit 49394f1 into microsoft:main Nov 18, 2026
11 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.

microskills: conda run -p ./env pytest is observed as a call to conda, not a test run

2 participants