Skip to content

fix(update): preserve activated extras across runtime rebuilds - #73309

Closed
hxwvaa wants to merge 1 commit into
NousResearch:mainfrom
hxwvaa:fix/preserve-runtime-extras
Closed

fix(update): preserve activated extras across runtime rebuilds#73309
hxwvaa wants to merge 1 commit into
NousResearch:mainfrom
hxwvaa:fix/preserve-runtime-extras

Conversation

@hxwvaa

@hxwvaa hxwvaa commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Root cause

hermes update rebuilt the managed environment with .[all], then called active_features() to decide what to refresh. That detector infers activation from packages currently installed in the environment. A replacement runtime has already removed a lazy backend's anchor package, so the updater cannot recover the previously active feature.

Reproduction

  1. Activate Telegram (python-telegram-bot[webhooks]==22.6).
  2. Set security.allow_lazy_installs: false.
  3. Run an update that replaces the managed runtime.
  4. The core .[all] install omits Telegram, and post-rebuild active_features() returns no Telegram feature.

Why active-feature detection fails after removal

It is intentionally presence-based and does not persist history. Once the replacement runtime has dropped the package, its anchor is gone; probing after the rebuild cannot distinguish “previously activated then removed” from “never activated.”

Fix design

Snapshot the allowlisted active lazy features before the update can replace site-packages, then restore that exact snapshot after the core dependency install. The restore path only accepts names in LAZY_DEPS and its pinned specs, so it is general across declared lazy backends without accepting arbitrary packages. Cold features remain absent.

Security behavior

This does not modify security.allow_lazy_installs. Runtime ensure() remains blocked when it is false. The explicit updater may restore only dependencies already captured before its own managed-runtime rebuild.

Tests executed

  • Added regression test: failed before the fix with AttributeError: module 'tools.lazy_deps' has no attribute 'restore_features'.
  • python -m pytest tests/tools/test_lazy_deps.py tests/hermes_cli/test_lazy_refresh_venv_repair.py -q: 84 passed.
  • ruff check tools/lazy_deps.py hermes_cli/main.py tests/tools/test_lazy_deps.py tests/hermes_cli/test_lazy_refresh_venv_repair.py: passed.
  • py_compile tools/lazy_deps.py hermes_cli/main.py: passed.
  • Canonical scripts/run_tests.sh could not run on the Windows author host because it invokes WSL and no WSL distribution is installed. Direct broader collection is also blocked by Linux-only test prerequisites; CI is required for platform-parity validation.
  • ty check tools/lazy_deps.py hermes_cli/main.py reports existing diagnostics across hermes_cli/main.py outside this diff.

Fixes #72924

@hxwvaa hxwvaa closed this Jul 28, 2026
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Runtime rebuild silently drops declared extras during hermes update

2 participants