Skip to content

The agent that grows with you

fix(worker): bare -m worker entries select the install's dependencies

teknium19f4fec6054a7
diff --git a/agent/managed_worker.py b/agent/managed_worker.py
index eb6b2443d69..bc1d690c798 100644
--- a/agent/managed_worker.py
+++ b/agent/managed_worker.py
@@ -4,6 +4,14 @@ stdin is the owner's bounded bootstrap/control pipe; a duplicate of stdout is
reserved for framed events before runtime imports redirect ordinary output.
Neither assignment secrets nor launch credentials appear in argv or logs.
"""
+# Spawned as a bare ``sys.executable -m``: in a PM install that interpreter carries no dependencies
+# until hermes_bootstrap selects the committed environment, so it must be the first import.
+try:
+ import hermes_bootstrap # noqa: F401
+except ModuleNotFoundError as exc:
+ if exc.name != "hermes_bootstrap":
+ raise
+
import json
import os
from pathlib import Path
diff --git a/hermes_cli/kanban_worker_client.py b/hermes_cli/kanban_worker_client.py
index c13be3ed346..5d1a1633d1f 100644
--- a/hermes_cli/kanban_worker_client.py
+++ b/hermes_cli/kanban_worker_client.py
@@ -1,4 +1,12 @@
"""Dispatcher subprocess: submit one claim to its profile owner; never run an agent."""
+# Spawned as a bare ``sys.executable -m``: in a PM install that interpreter carries no dependencies
+# until hermes_bootstrap selects the committed environment, so it must be the first import.
+try:
+ import hermes_bootstrap # noqa: F401
+except ModuleNotFoundError as exc:
+ if exc.name != "hermes_bootstrap":
+ raise
+
import asyncio
import os
from pathlib import Path