The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(gateway): connector downloads are a trusted media delivery root
Siddharth Balyan2d6a0e6f32f2
diff --git a/gateway/platforms/base.py b/gateway/platforms/base.pyindex 197f6dca702..651743e88f0 100644--- a/gateway/platforms/base.py+++ b/gateway/platforms/base.py@@ -433,7 +433,7 @@ from gateway.warning_notifications import diagnostic_wake_mutedfrom hermes_cli.observability.shared_metrics_gateway import records_delivery, stop_reply_clockfrom gateway.session import SessionSource, build_session_keyfrom gateway.session_transcript import TranscriptReadError-from hermes_constants import get_default_hermes_root, get_hermes_dir, get_hermes_home+from hermes_constants import CONNECTOR_DOWNLOADS_SUBDIR, get_default_hermes_root, get_hermes_dir, get_hermes_homefrom agent.provider_media import GENERATED_SUBDIR, MEDIA_CACHE_MAX_AGE_HOURSif TYPE_CHECKING:@@ -855,16 +855,13 @@ _ROOT_CREDENTIAL_PATHS = (def _profile_cache_roots() -> list[Path]:- """Per-profile cache roots ``<root>/profiles/<name>/cache/{images,...}`` (the static safe- roots cover only the active HERMES_HOME). Enumerated at check time so profiles created after- startup count and are allowlisted BEFORE the ``/root`` denylist (HERMES_HOME symlinked).-- ``HERMES_HOME=/opt/data``) while the model emits a profile-scoped path silently fails delivery.- Enumerated dynamically at check time so profiles created after startup are covered, and so the resolved- profile path is allowlisted *before* the ``/root`` system denylist is consulted (which otherwise wins- when HERMES_HOME is symlinked under a denied prefix and $HOME is not that prefix). See issue #31733.+ """Per-profile cache roots ``<root>/profiles/<name>/cache/{images,...}`` and every home's connector+ downloads dir (the static safe roots cover only the launch HERMES_HOME). Enumerated at check+ time so profiles created after startup count, and allowlisted BEFORE the ``/root`` denylist,+ which otherwise wins when HERMES_HOME is symlinked under a denied prefix (#31733)."""- return [p / "cache" / subdir for p in _profile_dirs() for subdir in _MEDIA_DELIVERY_CACHE_SUBDIRS]+ return [*(p / "cache" / subdir for p in _profile_dirs() for subdir in _MEDIA_DELIVERY_CACHE_SUBDIRS),+ *(p / CONNECTOR_DOWNLOADS_SUBDIR for p in (get_hermes_home(), *_profile_dirs()))]def _profile_dirs() -> list[Path]:diff --git a/hermes_constants.py b/hermes_constants.pyindex e491c1e8e23..dc3dfd1599f 100644--- a/hermes_constants.py+++ b/hermes_constants.py@@ -208,6 +208,9 @@ def get_routing_process_hermes_home() -> Path:# default profile) so the two lists cannot drift apart.LOCAL_RUNTIME_ROOT_DIRS: frozenset[str] = frozenset({"models", "runtimes", "node"})+# Where connector tool results save the files they return, under each profile's home.+CONNECTOR_DOWNLOADS_SUBDIR = Path("downloads", "connectors")+# get_default_hermes_root() memo keyed on (native home, expanded HERMES_HOME) so it stays# fresh when a test or plugin mutates either input; saves ~80us/call at 31+ sites._default_hermes_root_memo: tuple[str, str, Path] | None = None