Skip to content

The agent that grows with you

ci(process): mark the three detached spawns main gained since the ratchet

kshitijk4poordd9e087a1979
diff --git a/gateway/run_inbound_hooks.py b/gateway/run_inbound_hooks.py
index 319cde0d93f..c403aae69f2 100644
--- a/gateway/run_inbound_hooks.py
+++ b/gateway/run_inbound_hooks.py
@@ -188,7 +188,7 @@ class GatewayInboundHooksMixin:
env=build_subprocess_env(), cwd=cwd,
# Its own process group, so cleanup can reach what the shell started (POSIX;
# Windows ignores it and _stop_exec_tree walks the tree with taskkill /T).
- start_new_session=True,
+ start_new_session=True, # detached-spawn: ok — awaited; the timeout/cancel path kills its group
)
stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=_EXEC_QUICK_COMMAND_TIMEOUT)
output = (stdout or stderr).decode().strip()
diff --git a/gateway/session_managed_worker.py b/gateway/session_managed_worker.py
index 97a4dc9f75b..12ea1cdf18b 100644
--- a/gateway/session_managed_worker.py
+++ b/gateway/session_managed_worker.py
@@ -29,6 +29,7 @@ STOP_ACK_SECONDS = 30
LOSS_RECORD_WAIT_S = 10
# Own session (POSIX): a worker whose owner died kills its whole group (managed_worker
# _die_with_owner); on Windows it exits itself.
+# detached-spawn: ok — covered: the worker kills its own group when its owner dies (_die_with_owner)
WORKER_POPEN = {'start_new_session': True, 'close_fds': True}
diff --git a/hermes_cli/gateway_runtime_start.py b/hermes_cli/gateway_runtime_start.py
index ccb1ff0ad68..e5fb1ff4d46 100644
--- a/hermes_cli/gateway_runtime_start.py
+++ b/hermes_cli/gateway_runtime_start.py
@@ -91,6 +91,7 @@ def spawn_unmanaged_gateway(profile_home: Path, *, deadline: float, idle_exit: b
remaining(deadline)
return subprocess.Popen(command, cwd=root, env=env, close_fds=True,
stdin=subprocess.DEVNULL, stdout=output, stderr=output,
+ # detached-spawn: ok — a gateway daemon launch must outlive its launcher
**windows_detach_popen_kwargs())
except OSError as exc:
reason = "windows_breakaway_unavailable" if sys.platform == "win32" else "spawn_failed"