fix(lazy-deps): skip the install ladder on package-manager installs (salvage #48637) - #77500
Merged
kshitijk4poor merged 1 commit intoAug 3, 2026
Conversation
Salvage of NousResearch#48637 (Fixes NousResearch#48628). On a NixOS-style install the venv's site-packages lives in the read-only store, so ensure()'s uv -> pip -> ensurepip ladder spends ~15s bootstrapping ensurepip only to fail against a target it can never write. Fail fast with an actionable message pointing at the system package manager. Retargeted onto current main (the PR's base predates the durable-target subsystem by ~8.1K commits) with two corrections to the original: - Gate on _lazy_install_target() is None. The container deployment sets HERMES_MANAGED=true AND HERMES_LAZY_INSTALL_TARGET (a writable volume); the original guard would have blocked installs that path legitimately satisfies, breaking the NixOS-container mode. - Reason string starts with 'unsupported ' because refresh_active_features classifies FeatureUnavailable by that prefix; the original wording made 'hermes update' report a hard failure instead of a skip. Placed after _unsupported_feature_reason so a platform-specific reason (more actionable) wins, and so ensure() agrees with refresh_active_features, which pre-checks that same function.
kshitijk4poor
enabled auto-merge (rebase)
August 3, 2026 08:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #48637 by @liuhao1024 — retargeted onto current main with authorship preserved (the PR's base predates today's
ensure()by ~8,100 commits, so a cherry-pick was not viable; the change was reapplied at the correct site).Fixes #48628.
Context — what this fixes, for whom
NixOS users (and anyone running a package-manager build of Hermes): when a lazy feature's deps are missing,
ensure()walks auv → pip → ensurepipladder. On these installs the venv's site-packages lives in the read-only store, so the ladder spends ~15 seconds bootstrapping ensurepip and then fails against a target it could never write to.nix/packages.nixalready acknowledges this ("lazy-install can't write to the read-only /nix/store"), andnix/nixosModules.nixsetsHERMES_MANAGED=truefor the native service — the information to fail fast was there, unused.Now it fails immediately with a message that points at the system package manager.
Two corrections to the PR as authored (found in review)
HERMES_LAZY_INSTALL_TARGET=/opt/data/lazy-packages(a writable volume) and the NixOS container module runs withHERMES_MANAGED=true. The original guard sat before that check and would have unconditionally blocked installs the durable-target path legitimately satisfies — breaking the NixOS-container deployment. The guard is now gated on_lazy_install_target() is None.hermes updatemisreport (Medium).refresh_active_featuresclassifiesFeatureUnavailableby a"unsupported "prefix on the reason. The original wording ("cannot install on NixOS system; ...") was reported to users as a hard failure; the reason now starts with"unsupported "so it is reported as a skip. There is a test pinning that contract directly.Also simplified: one
get_managed_system()call replaces the originalis_managed()+get_managed_system()pair, and theexcept FeatureUnavailable: raisere-raise dance is gone (it existed only because the original raised inside its own try block).Placement
After
_unsupported_feature_reason, before spec validation. A platform-specific reason is more actionable than "managed install" (e.g. Matrix/python-olm on Windows tells you to use WSL), andrefresh_active_featurespre-checks that same function before callingensure()— a managed-first order would make the two paths disagree.Verification
tests/tools/test_lazy_deps*.py(3 files): 75 passed, 1 skipped on current maintools/lazy_deps.pyto main → 2 guard tests fail; restore → 6 pass_IGNORED_MANAGED_VALUESexplicitly ignores brew/homebrew on current main, so that test was dropped.Closes #48637 (superseded by this salvage — original author credited via commit authorship).