Skip to content

fix: prevent package updates when appending channels#5405

Merged
ruben-arts merged 3 commits intoprefix-dev:mainfrom
benmoss:fix/channel-add-no-update
Jan 26, 2026
Merged

fix: prevent package updates when appending channels#5405
ruben-arts merged 3 commits intoprefix-dev:mainfrom
benmoss:fix/channel-add-no-update

Conversation

@benmoss
Copy link
Contributor

@benmoss benmoss commented Jan 26, 2026

Description

When running pixi workspace channel add, packages were being unnecessarily re-solved because any channel change was treated as requiring a full re-solve.

Due to channel priority semantics, appending channels (lower priority) doesn't affect existing package selections - packages from higher priority channels remain valid. Only prepending, removing, or reordering channels should trigger a re-solve.

This change distinguishes between:

  • ChannelsExtended: channels were appended (packages stay valid)
  • ChannelsMismatch: channels were changed in other ways (need re-solve)

Fixes #5077

How Has This Been Tested?

Creating a pixi project to reproduce the scenario:

pixi init
pixi add python==3.14.0
# manually edit the python constraint in pixi.toml to "*"

pixi workspace channel add https://prefix.dev/nvidia

On a build from this change the pixi.lock is only appending the channel:

diff --git i/pixi.lock w/pixi.lock
index 9252448..8c294ec 100644
--- i/pixi.lock
+++ w/pixi.lock
@@ -3,6 +3,7 @@ environments:
   default:
     channels:
     - url: https://conda.anaconda.org/conda-forge/
+    - url: https://prefix.dev/nvidia/
     options:
       pypi-prerelease-mode: if-necessary-or-explicit
     packages:

as opposed to regular pixi which upgrades python as described in #5077

@@ -3,6 +3,7 @@ environments:
   default:
     channels:
     - url: https://conda.anaconda.org/conda-forge/
+    - url: https://prefix.dev/nvidia/
     options:
       pypi-prerelease-mode: if-necessary-or-explicit
     packages:
@@ -18,7 +19,7 @@ environments:
       - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda
       - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda
       - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.6.0-h5503f6c_0.conda
-      - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.14.0-h40d2674_103_cp314.conda
+      - conda: https://conda.anaconda.org/conda-forge/osx-arm64/python-3.14.2-h40d2674_100_cp314.conda
       - conda: https://conda.anaconda.org/conda-forge/noarch/python_abi-3.14-8_cp314.conda
       - conda: https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.3-h46df422_0.conda
       - conda: https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-h892fb3f_3.conda

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

@benmoss benmoss force-pushed the fix/channel-add-no-update branch 5 times, most recently from 116b65d to 2d26685 Compare January 26, 2026 01:46
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Thank you, this looks good. I would like to make the test faster as this could be slowing down our pipelines.

@benmoss benmoss requested a review from ruben-arts January 26, 2026 13:48
@benmoss
Copy link
Contributor Author

benmoss commented Jan 26, 2026

Just because I did initially struggle with false positives on this test, I made sure that this test fails on main:

E               AssertionError: '0.1.0'
E                not found in stdout:
E                Name     Version  Build           Size  Kind   Source
E               package  0.2.0    h60d57d3_0  1.23 KiB  conda  file:///Users/mossity/workspace/pixi/tests/data/channels/channels/multiple_versions_channel_1

When running `pixi workspace channel add`, packages were being
unnecessarily re-solved because any channel change was treated as
requiring a full re-solve.

Due to channel priority semantics, appending channels (lower priority)
doesn't affect existing package selections - packages from higher
priority channels remain valid. Only prepending, removing, or
reordering channels should trigger a re-solve.

This change distinguishes between:
- ChannelsExtended: channels were appended (packages stay valid)
- ChannelsMismatch: channels were changed in other ways (need re-solve)

Fixes prefix-dev#5077
@benmoss benmoss force-pushed the fix/channel-add-no-update branch from 8f0b325 to 196becc Compare January 26, 2026 13:52
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

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

Thank you, it works for me!

@ruben-arts ruben-arts merged commit bb5e1f7 into prefix-dev:main Jan 26, 2026
37 checks passed
@benmoss benmoss deleted the fix/channel-add-no-update branch January 27, 2026 15:31
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.

pixi workspace channel add does a pixi update

2 participants