Skip to content

fix(doctor): detect wheel-installed virtualenv entry points - #68505

Closed
YuYigeng wants to merge 1 commit into
NousResearch:mainfrom
YuYigeng:agent/doctor-wheel-entrypoint
Closed

fix(doctor): detect wheel-installed virtualenv entry points#68505
YuYigeng wants to merge 1 commit into
NousResearch:mainfrom
YuYigeng:agent/doctor-wheel-entrypoint

Conversation

@YuYigeng

@YuYigeng YuYigeng commented Jul 21, 2026

Copy link
Copy Markdown

Summary

  • Detect the hermes console script from the active Python environment's platform-aware scripts directory.
  • Treat a healthy wheel-installed virtualenv entry point as self-contained instead of requiring or creating a global ~/.local/bin/hermes symlink.
  • Preserve the existing source-checkout candidates, global-link checks, and remediation.
  • For a wheel layout with a missing script, recommend reinstalling the package with the active interpreter instead of suggesting an editable install from site-packages.

Root cause and impact

For a wheel install, PROJECT_ROOT resolves inside site-packages, but the console script lives in the virtualenv's scripts directory. The doctor check only searched PROJECT_ROOT/venv and PROJECT_ROOT/.venv, so a healthy ordinary virtualenv produced a false Venv entry point not found warning. Its remediation also assumed a source checkout and suggested pip install -e from site-packages.

After locating the active environment's console script, the source-oriented global symlink check must also be skipped. Otherwise the original false warning is merely replaced with ~/.local/bin/hermes not found, and doctor --fix leaks an isolated wheel venv into the user's global command path.

The updated check uses sysconfig.get_path("scripts") only when Python reports an active virtualenv, keeps the existing source layout behavior, skips the global link requirement only for an external wheel environment, and safely falls back when the environment path cannot be resolved.

Validation

  • scripts/run_tests.sh tests/hermes_cli/test_doctor.py tests/hermes_cli/test_doctor_command_install.py tests/hermes_cli/test_doctor_dedicated_provider_skip.py — 89 passed
  • ruff check hermes_cli/doctor.py tests/hermes_cli/test_doctor_command_install.py — passed
  • Built the changed wheel, installed it into a fresh Python 3.11 virtualenv, and ran hermes doctor with an isolated HOME. Doctor reported the venv entry point as present and did not create or request ~/.local/bin/hermes.
  • Regression coverage runs both doctor and doctor --fix against a wheel layout with no global link and verifies neither mode creates one.
  • Full scripts/run_tests.sh -j 8 from the earlier revision — 43,564 passed; 49 unrelated failures across 20 files plus 2 unrelated provider test files timed out on this macOS host. Failures were in existing platform/tooling paths such as systemd, missing Node, macOS /tmp resolution, and network safety fixtures; none touched the changed doctor code or tests.

Addresses the ordinary PyPI wheel + virtualenv doctor facet of #49529.

This intentionally does not change the separate optional-skills packaging facet tracked in the same issue.

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/install-update Installer, updater, packaging, wheels, doctor P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 21, 2026
@YuYigeng
YuYigeng force-pushed the agent/doctor-wheel-entrypoint branch 2 times, most recently from 492877a to 9209ed3 Compare July 22, 2026 06:13
@YuYigeng
YuYigeng force-pushed the agent/doctor-wheel-entrypoint branch from 9209ed3 to eb51c36 Compare July 22, 2026 09:06
@YuYigeng
YuYigeng marked this pull request as ready for review July 22, 2026 09:07

Copy link
Copy Markdown
Author

Closing this after re-auditing against current main.

#68217 has since merged and deliberately removes PyPI wheel/sdist as supported Hermes distribution paths; setup.py now rejects wheel/sdist builds outside the sealed Nix path, and the supported matrix is git installer, Docker, Nix/NixOS, and editable development installs. This PR's only behavior change is for an ordinary wheel-installed virtualenv, so its premise no longer matches the project's current direction.

The implementation and focused tests remain internally sound, but merging it would revive handling and remediation (pip install --force-reinstall hermes-agent) for a retired installation path. Withdrawing it avoids carrying obsolete compatibility code. The source-checkout doctor behavior is left unchanged.

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 sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants