Commit Graph
9 Commits
Author SHA1 Message Date
ethernet 84e2250b10 fix(windows): packaged-npx install failures degrade to plain npx; payload venv must be real
Review follow-ups on the packaged-npx and payload-venv commits.

_packaged_npx_entry promised "None for a failed install" but only handled a
non-zero exit: a TimeoutExpired (10-minute hang) or an OSError (unwritable
prefix, AV lock, node not startable) escaped into the MCP connect loop and
burned the server's retry budget. Both now log and return None.

_validated_runtime_venv returned whatever the adjacent manifest.json declared,
unchecked, ahead of the VIRTUAL_ENV branch that requires a real pyvenv.cfg. A
stray manifest beside a checkout could hand back a phantom path that shadowed
the user's own venv, or raise from payload_venv per child spawn. The payload
venv now needs pyvenv.cfg (the shipped payload venv has one) and a manifest
that escapes its root reads as "not a payload".

The packaged-npx test stood in for node with an extensionless #!/bin/sh file,
which win32's PATHEXT lookup never finds, so the test was red on the platform
it targets. It now uses a real node(.exe) fixture and a fake install, and the
failure shapes and _outside_package have their own tests.

The packaged-npx cache now follows npx: only an exact version is reused as
installed; any other spec re-resolves on each start and keeps the previous
install when npm cannot run (offline). A git, URL or path spec returns None
before installing, because npm installs those under a name the spec does not
show, so the manifest lookup missed and every start reinstalled.
2026-10-13 22:51:07 -04:00
ethernet 671996b152 fix(terminal): strip a sealed payload's venv from child PYTHONPATH
activate_dependencies exports PYTHONPATH=<repo>:<payload>/venv/<site-packages>.
Before PM commits a generation, the sanitizer never recognised the second
entry as Hermes-owned. The payload boots its store interpreter, which is not
a venv, so _in_venv is false. There is no facts.json yet. VIRTUAL_ENV was
popped at boot and is never <repo>/venv on a payload. The terminal child of
an MSIX install therefore inherited Hermes's 3.14 site-packages, and a
different Python started from there (uv's 3.12 in the field report) crashed
importing pydantic's compiled core.

_validated_runtime_venv now accepts payload_venv(root) as provenance after
the committed-generation check. That is the venv activate_dependencies
selects on the same path.

Live repro: a fake payload (git archive of this tree plus a manifest.json
and a venv beside it), real modules, no mocks. Before: the child
PYTHONPATH kept <payload>/venv/lib/python3.14/site-packages. After: only
the user entry remains.
2026-10-13 15:54:55 -04:00
ethernet bbec973514 refactor(pm): pm owns the dependency-environment layout and interpreter paths
hermes_cli.runtime_paths (venv generations, selection, activation) moves to
pm.environments, and gains venv_bin_dir / venv_python / project_python. Every
in-tree caller asks pm for an interpreter now; pm no longer reaches back into
hermes_cli for its own environment layout (pm.packages, pm.extras, pm.ensure,
pm.paths imported hermes_cli.runtime_paths). The three open-coded
"Scripts/python.exe or bin/python" ladders in pm collapse onto venv_python.

hermes_constants.venv_python_path / venv_bin_dir and hermes_cli.runtime_paths
stay as frozen-updater-surface shims only (tests/compat/old_updater_surface.json).

To keep the boot path light, pm/__init__ resolves its facade lazily (PEP 562)
and pm.registry loads the built-in package definitions on first read instead of
at import: `import hermes_bootstrap` now loads pm + pm.environments only (25ms,
was 37ms with the eager facade dragging in the downloader). The stripped-payload
fixtures that ship only pre-import files keep working for the same reason.

Also restores two frozen-surface re-exports the F401 sweep dropped
(banner._github_compare_behind, cua_backend.resolve_cua_driver_cmd).
2026-09-18 20:02:36 -04:00
ethernet 92686159d1 fix(pm): integrate audited runtime and lifecycle repairs
Prepare dependency generations before selecting them. Keep shipped tool
bytes separate from writable additions, and store facts beside their entries.
Validate proposed plugin sets before config publication. Restore the previous
config if the facts write fails.

Consolidate duplicate updater, backup, setup, and voice helpers. Repair
launcher selection, dependency consumers, download ownership, update feeds,
and native Windows process and file handling.

Verification: 206 changed/prior-failing Python files reported 4630 passed,
one failed, and 330 skipped. Fix the remaining Hindsight fixture boundary.
The final targeted rerun reported 234 passed and two skipped. The store
review regression batch reported 83 passed and one skipped. Desktop
TypeScript checks, 56 selected Electron tests, 24 release tests, and the
removed-import/compatibility guards passed.

This is an integration checkpoint, not full audit acceptance. The complete
Python suite has not run on this fixed tree. Crash-atomic plugin publication,
generation cleanup, receipt correlation, and packaged lifecycle acceptance
remain open in docs/pm-audit-status.md.
2026-09-05 22:36:48 -04:00
Teknium e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
2026-09-03 09:44:26 -07:00
Teknium 9289406e13 refactor(tools): collapse suppress/try-pass layers, unify probe subprocess helper (_py_out), compact pythonpath/gitbash/policy docs 2026-09-02 23:30:48 -07:00
Teknium fc694f401e refactor(tools): unify scrub builders via _scrubbed_env, fold group-alive probe and kanban scrub, compact env_passthrough refusal loop and docstrings 2026-09-02 23:09:52 -07:00
Teknium 8b249e4b3d refactor(tools): compact local env builders, env_probe, env_passthrough, pythonpath/gitbash helpers; fold force-unwrap and kill-group flows 2026-09-02 22:24:19 -07:00
Teknium 3bbec90f23 refactor(tools/environments): split local/base into output/wait/session-env siblings; extract docker_egress + remote_common; dedupe remote backends; compact process_registry 2026-09-02 14:45:15 -07:00