Let the worker agent run straight from a checkout

It expects worker_main.py beside it, which is true on a worker host and not in
a clone — so trying a remote worker started with copying files around. It now
looks one directory over as well.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AD8SfVhzXBG2nAfFcVh3iD
This commit is contained in:
2026-08-18 18:03:28 +02:00
co-authored by Claude Fable 5
parent 52d4de62c9
commit 328e3c8e98
+18 -1
View File
@@ -48,7 +48,24 @@ PROTOCOL = 1
HEARTBEAT_S = 10.0
#: Reconnection backs off to this and no further.
MAX_BACKOFF_S = 30.0
WORKER_MAIN = Path(__file__).with_name("worker_main.py")
def _worker_main() -> Path:
"""The user-code runner: beside this file once deployed, or in a checkout.
On a worker host the two files sit together, which is what the install
instructions say. Run straight from a clone and the runner is one directory
over, in the engine's own package — worth finding, so trying this out does
not start with copying files around.
"""
here = Path(__file__).resolve().parent
for candidate in (here / "worker_main.py", here.parent / "flow" / "worker_main.py"):
if candidate.exists():
return candidate
return here / "worker_main.py"
WORKER_MAIN = _worker_main()
class Subprocess: