mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-16 02:46:38 +03:00
21aa99db8c
Every retired shim called stop_for_relaunch() unconditionally, so a current-tree caller (a plugin, a serve/dashboard/gateway, main.__getattr__'s lazy export) reaching one ran the whole update-finish takeover: dependency sync, desktop rebuild, gateway restart, backend kill -- and the restarted process could reach the shim again (#122656). lazy_deps.install_specs and psutil_android's import were already gated on in_historical_update(); the other 60 shims were not. One shared gate, _old_updater.stop_historical_updater(hook, error): hands off exactly as before when a historical updater entrypoint frame is on the stack (or the process already handed off and is unwinding), otherwise raises a catchable error (ImportError for installer-shaped shims, matching install_specs; RetiredUpdaterHook otherwise). install_specs now uses it too. main._write_update_incomplete_marker resolves to a gated old_updater_deps shim instead of aliasing stop_for_relaunch. Every frozen-surface name is retained. Fixes #124881 Fixes #122656
29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
"""Shims to stop the old updater doing work until relaunch, not Android support."""
|
|
|
|
from pathlib import Path
|
|
from typing import NoReturn
|
|
|
|
from hermes_cli._old_updater import in_historical_update, stop_for_relaunch, stop_historical_updater
|
|
|
|
# Frozen data for old imports, not a download performed by this module.
|
|
PSUTIL_URL = (
|
|
"https://files.pythonhosted.org/packages/aa/c6/"
|
|
"d1ddf4abb55e93cebc4f2ed8b5d6dbad109ecb8d63748dd2b20ab5e57ebe/"
|
|
"psutil-7.2.2.tar.gz"
|
|
)
|
|
|
|
|
|
def prepare_patched_psutil_sdist(archive: Path, destination: Path) -> NoReturn:
|
|
# Shim to stop the old updater doing work until relaunch. Extract nothing.
|
|
stop_historical_updater("hermes_cli.psutil_android.prepare_patched_psutil_sdist")
|
|
|
|
|
|
# Shim to stop the old updater doing work until relaunch. Historical callers
|
|
# download PSUTIL_URL BEFORE calling prepare_patched_psutil_sdist, so waiting
|
|
# for that call is too late. Stop the import without offering a fake URL.
|
|
# Only under a historical updater frame: anything else that imports this module
|
|
# (an import smoke, a doc tool) would otherwise run a whole update takeover --
|
|
# dependency sync, launcher publication and a gateway fleet restart.
|
|
if in_historical_update():
|
|
stop_for_relaunch()
|