mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-20 15:33:54 +00:00
fix(api): allow dashboard updates for git checkouts in containers (#51005)
Salvages #50469 by @libre-7. _dashboard_local_update_managed_externally() previously blocked every containerized dashboard from the local update API, even when the running install was a bind-mounted git checkout that can be updated with hermes update. Allow the dashboard updater only for git installs inside containers, while keeping hosted /opt/data, docker, and pip installs managed externally. Pip remains blocked because its apply path mutates the running container filesystem and is not the self-managed checkout case. Adds regression coverage for docker, git, and pip install-method handling inside containers, and maps the contributor email for release attribution. Co-authored-by: libre-7 <libre-7@users.noreply.github.com>
This commit is contained in:
parent
6681f28d5b
commit
2a58fee1a1
3 changed files with 49 additions and 1 deletions
|
|
@ -1322,13 +1322,35 @@ def _dashboard_local_update_managed_externally() -> bool:
|
|||
in-browser local update action. Keep this dashboard capability separate
|
||||
from install-method detection: manual git/pip installs inside containers can
|
||||
still behave like their actual install method in the CLI.
|
||||
|
||||
However, when the install method is ``git`` (a bind-mounted checkout inside
|
||||
a container — e.g. the hermes-webui image sharing the Hermes source tree),
|
||||
the dashboard's ``hermes update`` button is the correct update path and
|
||||
should not be suppressed. Other containerized install methods remain
|
||||
externally managed unless their apply path is proven safe inside the
|
||||
running container filesystem.
|
||||
"""
|
||||
if _default_hermes_root_is_opt_data():
|
||||
return True
|
||||
try:
|
||||
from hermes_constants import is_container
|
||||
|
||||
return is_container()
|
||||
if not is_container():
|
||||
return False
|
||||
except Exception:
|
||||
return False
|
||||
# We are inside a container, but the install may still be self-managed.
|
||||
# If the install method is git, the dashboard update button works against
|
||||
# the mounted checkout and should be offered. Keep pip blocked inside
|
||||
# containers: its apply path mutates the running container filesystem and
|
||||
# is not the bind-mounted checkout case this gate is meant to recover.
|
||||
try:
|
||||
method = detect_install_method(PROJECT_ROOT)
|
||||
if method == "git":
|
||||
return False
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
def _managed_files_policy(request: Request, *, create_root: bool = True) -> ManagedFilesPolicy:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue