Skip to content

Patch pixi projects: find .pixi/envs without activation - #2166

Merged
Mikola Lysenko (mikolalysenko) merged 9 commits into
mainfrom
fix/pixi-python-envs
Nov 20, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 9 commits into
mainfrom
fix/pixi-python-envs

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

pixi installs a project into conda prefixes of its own under .pixi/envs/<name>, and the Python crawler did not know them. Measured with the released 5.1.0 on a public pixi project (381 conda packages and one PyPI wheel, linux-64, 84 Python distributions in the environment), after pixi install:

Command, run from the project root 5.1.0 This branch
scan / scan --mode agent No packages found. Run your package manager's install first. 84 packages found, 2 patches applied
apply (patches recorded) exit 1, every patch "not found on disk" applied / already patched
vex package_not_found, nothing to attest 2 statements
the same under pixi run works, but only because the project also has a pyproject.toml works
a project with only pixi.toml, under pixi run No packages found works

The pixi run case worked by accident: with a pyproject.toml and no venv the crawler asks the Python on PATH, which pixi run points at the environment. Outside pixi run, on a machine that has a system Python (a CI runner), that same fallback crawled the system interpreter instead of the project's environment.

What changes

Discovery (crawlers/pixi_env.rs, python_crawler.rs)

  • Every conda prefix under .pixi/envs/ is one of the project's environments, with no activation, added to whichever venv another tool keeps beside it. It is read only where a pixi.toml or pixi.lock is (in the home directory that path holds pixi global tools). The link pixi leaves there for detached-environments is followed; where pixi leaves no link (Windows), the environment pixi run activated for this workspace is used.
  • A project only pixi installs, with no environment installed, has nothing installed. The interpreter on PATH is never crawled for it, the rule uv, Poetry and Pipenv projects already have. A file pip installs from beside pixi's files (requirements.txt, setup.py, setup.cfg, or a pyproject.toml with a [build-system]) keeps the fallback as it was in 5.1.0.
  • From a workspace member directory (its own pixi.toml, no environments of its own), the environment pixi run / pixi shell activated for the workspace is used. Another tool's project in the same tree is not given it.
  • A --system-site-packages venv built on a pixi environment's Python does not hide that environment's packages from the crawl.
  • scan --global reads pixi global install tool environments ($PIXI_HOME/envs, default ~/.pixi/envs).

Messages

  • Hosted mode (the default) changes nothing in a pixi project, as before, but now warns redirect_pypi_pixi_project, which names the agent-mode steps, instead of redirect_pypi_no_lockfile, whose remedy (pin the package in a requirements.txt) changes nothing pixi installs.
  • Agent-mode next steps name pixi install.
  • The advisory after an in-place Python patch names what reverts it in a conda prefix (pixi reinstall, conda install --force-reinstall) instead of pip check; a pixi environment ships no pip.
  • A copy in a conda prefix whose files are not the PyPI release's was already left untouched. The failure now says so, instead of only no matching variant found.

A conda build is patched only as the PyPI release it repackages (patch/conda_copy.rs)

Finding pixi's environments means PyPI patches now reach packages conda built, so the rule for those is explicit and enforced in the apply engine, where no caller or flag gets past it. A copy conda built (its INSTALLER says conda, or it has none) takes a patch only when:

  • the patch is not for a platform wheel, and the copy holds no compiled code (Root-Is-Purelib: true in its WHEEL, or, for an .egg-info install, no extension module among its files). A compiled conda package is built separately from the PyPI wheel and links conda's own libraries, so it is never that release, even when the Python file a patch touches is byte-identical;
  • every file the patch replaces has the release's bytes, and the patch replaces at least one file. --force and --allow-patch-conflicts do not overwrite a file that differs; --strict is unchanged.

A copy that already holds the patch (one an earlier release patched) has nothing written to it and is reported as already patched.

scan --mode agent leaves a patch out (warning conda_build_not_pypi_release, exit 0, nothing recorded) when no installed copy can take it, instead of recording a patch every later apply would refuse. A wheel pip or uv installed into the environment is the PyPI release itself and is patched as before.

Measured on the project's lock, comparing each conda package with its PyPI wheel file by file:

conda-forge builds compared identical to the wheel in every file differ
pure Python (noarch) 51 45 6: a generated version file in 3, one module changed by the recipe in setuptools, one source snapshot, one metapackage
compiled (sample) 10 0 all: the extension modules, and pillow also a Python source

All 48 pure-Python builds with a .dist-info record INSTALLER: conda and Root-Is-Purelib: true; all 10 compiled ones record Root-Is-Purelib: false; the two .egg-info installs record neither, and are judged by the wheel the patch names.

Not covered: files a patch does not replace are not compared, because a patch record holds no hashes for them. A recipe that changes another module of an otherwise identical build (setuptools above) is not seen. Closing that needs the release's file hashes from the patch service.

Tests and docs

  • Unit tests for the discovery rules; in-process scan tests for all three modes; hermetic apply tests for a pixi layout.
  • For the conda rule: unit tests of each refusal, apply tests (a compiled build whose file matches is refused with and without --force; no flag overwrites a differing file; a wheel pip or uv installed is patched; an earlier Socket patch still gives way) and a scan test (nothing recorded, exit 0). Checked by hand against a real compiled conda pillow: refused, file unchanged, with and without --force.
  • scripts/backtest-pixi.py and pixi-compatibility.yml run real pixi releases (SHA-256 pinned): pixi 0.20.1, 0.39.5, 0.63.2 and 0.84.2 on Linux, the ends of the range on macOS on pushes to main.
  • docs/ecosystems.md gains a pixi row and section, CLI_CONTRACT.md the discovery rule and the new warning code, docs/testing/pixi-compatibility.md the test guide.

Why agent mode only

Measured on pixi 0.84.2:

  • A [pypi-dependencies] URL pointing at a hosted wheel is ignored when a conda package provides the same name at that version: pixi keeps the conda build and records no PyPI entry. At another version the solve fails ("pinned by the conda solve"). A hosted pin can therefore never replace a conda-provided package, and writing one would look wired while the unpatched conda build is what gets installed.
  • For a package that does come from PyPI, a URL pin in the manifest works. A rewrite of pixi.lock alone installs the hosted wheel into a fresh environment, but the next re-solve (pixi add) silently puts the PyPI URL back, and an existing environment keeps the upstream bytes until pixi reinstall.

So this PR does not rewrite pixi files. Hosted mode names agent mode, and vendored mode keeps refusing (pypi_no_requirements / pypi_pyproject_only, exit 1), which already names agent mode. Hosting or vendoring PyPI-sourced pixi dependencies is possible follow-up work; conda-provided ones would need patched conda packages.

Verification

  • cargo clippy --locked --workspace --all-features -- -D warnings and cargo check --workspace --all-targets --all-features: clean.
  • At the current head: cargo test -p socket-patch-core --lib: 8316 passed. -p socket-patch-cli --lib: 1024 passed. CLI suites apply (166), scan (267), in_process_python_envs (26), rollback (140), remove (89), mode_migration_pypi (83): all pass. Earlier heads of this branch also ran in_process_pypi_apply, in_process_pypi_multi_release, scan_requirements_lock_only, policy_pypi_names, hosted_superseding_pypi, in_process_alternate_installers, in_process_redirect_{poetry,pipenv}, in_process_vendor_pypi_takeover, scan_vendor_requirements_unwired and core crawler_python_e2e; CI runs them all.
  • scripts/backtest-pixi.py with a build of this branch: every cell passes on Linux x86_64 userland (environments hard-linked into pixi's cache) for 0.20.1, 0.39.5, 0.63.2 and 0.84.2, and on macOS arm64 for 0.20.1 to 0.84.2. Against 5.1.0 the agent, hosted and vendored cells fail.
  • The real project above, on Linux, with no activation: scan --mode agent applies both available patches, apply is idempotent, vex attests both, the environment's Python imports the patched modules, and rollback restores the upstream bytes.

Code review

/code-review high reported two important findings and five nits. All seven are addressed in the last commit:

  1. A pixi project that pip also installs lost the interpreter fallback (a container image that runs pip install -r requirements.txt and then socket-patch apply in a repo that also has a pixi.toml). Fixed: a requirements.txt, setup.py or setup.cfg beside pixi's files keeps the fallback, and a pixi project whose own files name another lock tool keeps that tool's hosted remedy. (The second round extended this to a packaged pyproject.toml, below.)
  2. pixi run from a workspace member directory found nothing. Fixed: the activated environment counts from any directory at or below the exported workspace root, unless that directory has environments of its own.
  3. Conda wording for a copy pip or uv installed into a conda prefix. Fixed: the reason offers the conda build as a cause instead of asserting it, and names the copy; the plain-conda advisory names the pip reinstall too.
  4. The conda reason could be printed for a non-Python package. Fixed: Python purls only.
  5. A stale copy in a pixi environment got a remedy that cannot clear it. Fixed: its own remedy, naming agent mode.
  6. Next steps could still say pip install for a pixi project. Fixed: either pixi file counts, and pixi install is named beside another tool's install.
  7. The harness's fresh-checkout cell did not prove its claim. Fixed: it plants a decoy interpreter with one package first on PATH, runs on a shape with a pyproject.toml, and uses dry runs only. It fails against a build without the fix.

A second /code-review high, after the conda rule was added, reported six important findings, one pre-existing and two nits:

  1. An sdist record beside the wheel's made apply fail on a pure-Python conda build. Fixed: only a platform wheel is refused by its name; for an sdist or unnamed record the copy's own metadata decides.
  2. --strict was loosened for conda builds. Fixed: only --force and --allow-patch-conflicts are tightened to the default policy.
  3. A pixi project with a packaged pyproject.toml, installed with pip, was no longer found. Fixed: a pyproject.toml with a [build-system] keeps the interpreter fallback. One that only holds metadata or tool settings (the project this was found on) does not.
  4. A compiled conda copy an earlier release had patched made every apply fail while staying patched. Fixed: a copy that already holds the patch is reported as already patched; a refusal names socket-patch remove.
  5. A --system-site-packages venv on a pixi environment's Python hid that environment's packages. Fixed.
  6. Any directory below an activated workspace root got the workspace's environment. Fixed: only a member with pixi files of its own and no environments of its own.
  7. (pre-existing) A pyproject.toml built with hatchling goes down the Hatch lane before the pixi check in hosted mode. Not changed here: that is how the Hatch lane has always claimed such a project, and changing which lane a hosted run takes belongs with hosted support for pixi, not with this agent-mode change. The part this PR added is fixed: a build backend no longer stops the pixi warning; only a tool's own table or a Pipfile does.
  8. A run from the home directory took ~/.pixi/envs (pixi's global tools) for a project. Fixed: .pixi/envs is read only beside a pixi.toml or pixi.lock.
  9. Extra directory listings. The apply engine now reads a copy's metadata once. Not changed: an agent-mode scan or get that selects PyPI patches looks up their installed copies once more than before (local listing only, no network); folding that into the release filter would change its four callers.

Bugbot reported two findings, both fixed by the PR shepherd in 72a5e5e:

  1. An environment activated over pixi's variables was taken for the workspace's without checking pixi installed it (conda activate inside pixi shell). Fixed: the activated prefix needs pixi's own conda-meta record, which every tested pixi release writes.
  2. Next steps named only pixi install for a pixi project that pip also installs. Fixed: pip install is named too when a requirements.txt, setup.py or setup.cfg is there.

The PR shepherd's final review found one blocker, fixed in bddbcff:

  • A clean apply could exit 1 depending on the order of the manifest's records. A release with a platform wheel beside its pure-Python one has a record for each, with the same Python files. On a pure-Python conda build the platform wheel's record was refused when it came first, although the pure wheel's record then patched the file. Fixed: on each copy the records a conda build never takes are tried after the others, in purl order, and such a record is an error only when it is the first one tried on the copy. After another record of the release it reads as already patched when its files hold the patch (as in a venv), and is otherwise not reported. scan --mode agent and get leave such a record out without the warning when they keep another record of the same release. Tests: a_platform_wheel_record_beside_the_pure_one_does_not_fail_a_pure_python_conda_build (fails without the fix) and a_conda_build_two_records_fail_on_is_reported_once.

A /code-review high of that fix alone reported three findings, all addressed before the push: the skipped record was still listed as not installed (now it reads as already patched, and the tests pin that); a copy the pure wheel's record failed on got a second refusal naming the wrong cause (now reported once); the test's rounds did not cover what its comment said (comment corrected, outputs asserted).

Two smaller points from the shepherd's review are not changed, because both only withhold a patch and never allow a wrong write:

  • A legacy .egg-info install in a conda prefix has no INSTALLER, so it is judged as a conda build, including one pip installed with setup.py install. Nothing in such a copy reliably says pip put it there: a conda recipe that ran an old pip leaves the same files. A pure-Python copy of this kind is still patched when its files are the release's; a compiled one is refused.
  • For an .egg-info install the search for extension modules walks its whole top-level directory, so a pure distribution in a shared namespace package (zope, google) beside a compiled one can be taken for compiled.

Not in this PR

  • pixi.lock is not read as a lockfile, so a fresh checkout has no packages until pixi install has run.
  • vex in a project whose only manifest is pixi.toml and that has no git remote still needs --product.
  • A conda environment that is not pixi's is found as before (through the Python on PATH when the project has a Python marker).

🤖 Generated with Claude Code


Generated by Claude Code

pixi installs a project into conda prefixes of its own under
`.pixi/envs/<name>`. The Python crawler did not know them, so in a pixi
project `scan`, `apply`, `vex`, `rollback` and `remove` only saw the
installed packages when run through `pixi run` in a project that also had
a `pyproject.toml` (the crawler's project-marker fallback then asked the
Python on PATH, which `pixi run` points at the environment). Run plainly
after `pixi install`, as a CI step is, `scan` reported "No packages
found", `apply` exited 1 with every patch "not found on disk", and `vex`
had nothing to attest. A project with only `pixi.toml` was not patchable
at all, and on a machine with a system Python the fallback crawled that
interpreter instead of the project's environment.

- Every conda prefix under `.pixi/envs/` is now one of the project's
  environments, added to whichever venv another tool keeps beside it. The
  link pixi leaves there for `detached-environments` is followed, and an
  environment `pixi run` activated for this workspace is found where there
  is no link (Windows).
- A project with a `pixi.toml` or `pixi.lock` and no environment installed
  has nothing installed: the interpreter on PATH is never crawled for it,
  as for a uv, Poetry or Pipenv project.
- `scan --global` reads the tool environments `pixi global install`
  creates under `$PIXI_HOME/envs` (default `~/.pixi/envs`), like uv tools
  and pipx apps.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With the environments found, the text around a pixi project's patches
still spoke of pip and requirements files:

- Hosted mode (the default) cannot rewrite a pixi project: pixi installs
  from its own lock, mostly from conda channels, and it keeps a conda
  package over a PyPI source for the same name. The run now warns
  `redirect_pypi_pixi_project`, which names the agent-mode steps, in
  place of `redirect_pypi_no_lockfile`, whose remedy (pin the package in
  a requirements.txt, or commit another tool's lock) changes nothing pixi
  installs. `pixi.toml` and `pixi.lock` are presence-only inputs of the
  hosted planner; nothing is written, as before.
- The agent-mode next steps name `pixi install` when the project has a
  `pixi.lock`.
- The advisory after an in-place Python patch names what reverts it in a
  conda prefix (`pixi reinstall`, or `conda install --force-reinstall`)
  instead of `pip check` and `pip install --force-reinstall`, which a
  pixi environment has no pip for.
- A copy in a conda prefix whose files are not the PyPI release's (a
  recipe that changes the source, a compiled extension built for conda)
  was already left untouched; the failure now says that, instead of only
  "no matching variant found".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`scripts/backtest-pixi.py` downloads pinned pixi releases (SHA-256 pinned
per release and host) and runs the CLI from the project root with no
`pixi run` around it, against the public urllib3 patch: agent mode must
leave the patched bytes in every environment and the upstream bytes in
pixi's package cache, survive `pixi install` and `pixi run`, be restored
by `apply` after the environments are rebuilt, and be undone byte for
byte by `rollback`; hosted mode must change nothing and name agent mode;
vendored mode must refuse; a checkout with no environment must read
nothing from the Python on PATH. Shapes: the package from conda-forge,
from PyPI, a `pyproject.toml` manifest, two environments, and detached
environments.

`pixi-compatibility.yml` runs it for pixi 0.20.1, 0.39.5, 0.63.2 and
0.84.2 on Linux (path-filtered pull requests and pushes to main) and for
the ends of that range on macOS on pushes to main.

The ecosystems guide gains a pixi row and section, the CLI contract the
discovery rule and the new warning code, and docs/testing a pixi guide.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- A project pip installs too keeps the interpreter fallback. With a
  `requirements.txt`, `setup.py` or `setup.cfg` beside pixi's files, the
  packages may be in the Python on PATH (a container image that runs `pip
  install -r requirements.txt`, then `socket-patch apply`), which 5.1.0
  found and the first version of this change no longer did. Only a
  project nothing but pixi installs skips that fallback. A pixi project
  whose own files name another lock tool (a Pipfile, a pyproject naming
  uv, Poetry or PDM) keeps that tool's hosted lock remedy.
- `pixi run` from a workspace member directory finds the workspace's
  environment: pixi exports the root it found by walking up, and the
  activated prefix now counts from any directory below it, unless that
  directory has environments of its own.
- The "no matching variant" reason for a copy in a conda prefix is given
  for Python packages only, names the copy, and offers the conda build as
  a cause instead of asserting it (pip and uv install wheels there too).
  The advisory for a plain conda environment names the pip reinstall
  beside conda's.
- A copy in a pixi environment that a hosted run finds stale gets a
  remedy that can clear it (agent mode), not "reinstall from the
  rewritten lock".
- Agent-mode next steps name `pixi install` for either pixi file, beside
  another tool's install when the project has both.
- The harness's fresh-checkout cell plants a decoy interpreter with one
  package first on PATH, runs on a shape with a `pyproject.toml`, uses
  dry runs only, and checks both halves of the rule.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 19, 2026 19:46
@cursor

cursor Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core Python discovery and apply messaging for conda/pixi layouts; wrong path logic could miss packages or over-crawl system Python, but behavior is heavily tested and hosted/vendored remain fail-safe for pure pixi projects.

Overview
Adds first-class pixi support so agent-mode discovery, apply, and scan work from the project root after pixi install, without pixi run or shell activation.

A new pixi_env layer finds conda prefixes under .pixi/envs/ (including detached-env symlinks and workspace-member activation via PIXI_* / CONDA_PREFIX), merges them into Python crawling, and suppresses crawling the system Python for pixi-only projects with no env installed. Mixed layouts (e.g. requirements.txt or another lock beside pixi) keep existing interpreter behavior.

Hosted/vendored behavior is documented and gated: pixi manifest/lock are presence-only in the format registry; hosted runs emit redirect_pypi_pixi_project instead of misleading “add a requirements lock” advice, with tailored stale-install messaging for pixi env copies. Apply improves conda/pixi mismatch errors and post-patch advisories (pixi reinstall vs pip check); agent next steps can list pixi install alongside other installers.

CI and docs: new pixi-compatibility.yml, scripts/backtest-pixi.py, docs/testing/pixi-compatibility.md, ecosystem matrix row, and contract/docs updates. Broad unit, in-process, and e2e tests cover discovery, scan modes, and apply on pixi layouts.

Reviewed by Cursor Bugbot for commit d8387cd. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d8387cd. Configure here.

Finding pixi's environments means PyPI patches now reach packages conda
built. A patch records the hash each file it replaces has in the PyPI
release, and a conda build is not always that release. Compared file by
file with the PyPI wheels, the 51 pure-Python conda-forge packages of one
project held 45 identical builds and 6 that differ somewhere (a generated
version file in three, one module the recipe patches in setuptools); every
compiled package differed, in its extension modules and, for pillow, in a
Python source too.

The apply engine now refuses a PyPI patch for a copy conda built (its
INSTALLER says conda, or it has none; a copy whose metadata cannot be read
counts as one) unless:

- the patch is for a pure-Python wheel (`...-none-any`) and the copy does
  not say it holds compiled code (`Root-Is-Purelib: false`). A compiled
  conda package is built separately from the PyPI wheel and links conda's
  own libraries, so it is never that release, even when the Python file a
  patch touches is byte-identical;
- every file the patch replaces has the release's bytes, and the patch
  replaces at least one file.

The check is in the engine, so `--force` and `--allow-patch-conflicts` do
not get past it: they consent to losing local changes to the distribution
a patch was made for, not to writing one distribution's files into
another. Content an earlier Socket patch wrote still gives way to its
update. A wheel pip or uv installed into a conda prefix is the PyPI
release and takes the usual rules.

`scan --mode agent` and `get` leave a patch out, with the warning
`conda_build_not_pypi_release` and nothing recorded, when every installed
copy of its package is such a build, instead of recording a patch every
later `apply` would refuse.

Not covered: files a patch does not replace are not compared, since a
patch record holds no hashes for them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The conda rule:

- A record made from a source distribution, or keyed by the bare purl,
  was refused by its name with text about a compiled package, so a
  manifest holding it beside the wheel's record failed `apply` on a
  pure-Python conda build. Only a platform wheel is refused by name now;
  for the others the copy shows what it holds: its WHEEL metadata, or,
  for an install without one (`.egg-info`), whether an extension module
  is among its files.
- `--strict` was replaced by the default policy on a conda build, which
  let content an earlier Socket patch wrote be overwritten. Only
  `--force` and `--allow-patch-conflicts` are tightened now.
- A compiled conda copy an earlier release patched made every `apply`
  fail while its files stayed patched. A copy that already holds the
  patch has nothing written to it and is reported as already patched. A
  refusal names the `socket-patch remove` that drops the record.
- The engine reads a copy's metadata once instead of three times.

Discovery:

- A pixi project with a `pyproject.toml` that declares a
  `[build-system]` (a library that keeps pixi for development and is
  `pip install`ed elsewhere) keeps the interpreter fallback, like one
  with a `requirements.txt`. A `pyproject.toml` of metadata and tool
  settings does not.
- `.pixi/envs` is read only beside a `pixi.toml` or `pixi.lock`: in the
  home directory that path holds the tools of `pixi global install`.
- Below an activated workspace root, only a member (pixi files of its
  own, no environments of its own) is given the workspace's environment,
  not another tool's project that sits in the same tree.
- A `--system-site-packages` venv built on a pixi environment's Python
  no longer hides that environment's packages: `pixi run` imports them.

Hosted mode: a build backend (`poetry-core`, `pdm-backend`, `uv_build`)
no longer keeps a pixi project from the pixi warning; only a tool's own
table or a Pipfile does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Resolves the CLI_CONTRACT.md conflict: keeps main's rewrite of the hosted
mode paragraph and adds this branch's redirect_pypi_pixi_project code to
its warning list.

Assisted-by: Claude Code:claude-opus-5-5
Two Bugbot findings:

- The environment pixi activated (CONDA_PREFIX under PIXI_PROJECT_ROOT
  or PIXI_WORKSPACE_ROOT) was taken for the workspace's without checking
  that pixi installed it. A `conda activate` inside `pixi shell` leaves
  pixi's variables set over a plain conda prefix, which was then crawled
  and patched as the project's. It now needs pixi's conda-meta record.
- Agent-mode next steps named only `pixi install` for a pixi project
  that also has a requirements.txt, setup.py or setup.cfg, although the
  crawl then also reads the interpreter on PATH that `pip install`
  fills. They now name `pip install` too.

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

[agent] PR shepherd: final review on 72a5e5e found one blocker that needs a decision, so this PR is not labelled Ready for review yet.

A clean apply can exit 1, depending on manifest order. The setup is a pure-Python conda build (INSTALLER: conda, Root-Is-Purelib: true) in a pixi env, and a manifest that holds two records for the same release: a py3-none-any one and a platform one (cp313-…-manylinux) with the same file hashes. Agent mode records both when a .venv beside the pixi env takes the platform wheel, for example for charset-normalizer or black.

  • In the variant loop of commands/apply.rs, the platform record passes the first-file hash check. The conda rule in patch/apply.rs then refuses it, and the CLI sets has_errors.
  • The order of variants follows the manifest's HashMap:
    • platform record first: the pure record patches the file, but the run exits 1 with conda_build_not_pypi_release.
    • pure record first: the platform record finds the file already patched, and the run exits 0.
  • Reproduced by changing an_sdist_record_beside_the_wheels… so it uses a manylinux record instead of the sdist one: exit 1 in 4 of 6 runs, and the file was patched every time. Before this PR both records applied and the run exited 0.

Question: should a conda build's static refusal of a record count as "this record is not the installed distribution"? Under that reading the loop skips the record quietly, like a first-file mismatch, whenever another record of the same base applies or is already patched, and fails only when no record of the base can take the copy. Or do you want it handled some other way, for example by ordering pure records first? Either way, this needs a test that runs both orders.

Smaller points, not blockers:

  • A pip-installed legacy .egg-info (setup.py install, or pip before 23.1 without wheel) has no INSTALLER, so it is judged as a conda build. This follows the stated rule but is a behaviour change for some pip users.
  • holds_extension_modules walks the whole top-level directory of an .egg-info dist. A shared namespace such as zope or google can make a pure dist look compiled. This only blocks too much; it never allows a bad write.

Everything else checked out: the discovery rules, the pixi global envs, CRLF and case in WHEEL/INSTALLER, Windows Lib/site-packages, --force/--strict mapping, and non-PyPI purls. ci-ok and clippy are green on 72a5e5e, and CHANGELOG.md is untouched.


Generated by Claude Code

A release with a platform wheel beside its pure-Python one has a record
for each, and their Python files are the same. On a pure-Python conda
build the pure wheel's record patches the copy, and the platform
wheel's, which a conda build never takes, is refused. `apply` tried the
records in the order the manifest's map yielded them, so the same
project exited 1 (platform record first: refused, then the pure record
patched the file) or 0 (pure record first: the platform record found
the file patched).

On each copy the records a conda build never takes are now tried after
the others, in purl order, and such a record is an error only when it
is the first one tried on the copy. After another record of the
release it reads as already patched when its files hold the patch, as
it does in a venv, and is otherwise not reported: the copy's outcome is
the earlier record's. So a copy that fails is reported once, with its
own cause, instead of a second refusal naming the wrong one.

`scan --mode agent` and `get` leave such a record out without the
`conda_build_not_pypi_release` warning when they keep another record of
the same release: the package is patched, so there is nothing to
report.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

The blocker from the final review is fixed in bddbcff, with the reading the review proposed: a record a conda build never takes is not that copy's distribution once another record of the release has been tried on it.

  • apply: on each copy the records a conda build never takes (a platform wheel's always; every record when the build holds compiled code) are tried after the others, in purl order, so the manifest's map order no longer matters. Such a record is an error only when it is the first one tried on the copy. After another record of the release it reads as already patched when its files hold the patch, as in a venv, and is otherwise not reported, neither as failed nor as not installed. A copy that fails is reported once, with its own cause.
  • scan --mode agent and get: such a record is left out without the conda_build_not_pypi_release warning when another record of the same release is kept.
  • Tests: a_platform_wheel_record_beside_the_pure_one_does_not_fail_a_pure_python_conda_build (pure and platform records with the same file, with and without --force, dry run then two runs; it fails without the fix) and a_conda_build_two_records_fail_on_is_reported_once.

The two smaller points are left as they are, since both only withhold a patch: the PR description says why under "Code review".

@mikolalysenko Mikola Lysenko (mikolalysenko) added Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review and removed agent:needs-human labels Nov 20, 2026
Merged via the queue into main with commit e123f6b Nov 20, 2026
130 of 131 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the fix/pixi-python-envs branch November 20, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants