diff --git a/nix/agent-modules/mcp.nix b/nix/agent-modules/mcp.nix index 1a02336c..d41e92fb 100644 --- a/nix/agent-modules/mcp.nix +++ b/nix/agent-modules/mcp.nix @@ -353,6 +353,11 @@ in # no stdio fallback — same reasoning as `hive-mcp-http` below. Restart = "always"; RestartSec = 3; + # systemd's default `stop` tears the whole unit down when the kernel + # kills *any* process in its cgroup, so one OOM-killed task would + # take every running sibling task with it. `continue` scopes the + # loss to the process the kernel chose. + OOMPolicy = "continue"; User = userName; Group = userName; }; diff --git a/nix/module-eval/agent-memory.nix b/nix/module-eval/agent-memory.nix index e1377e9c..dd1b09dc 100644 --- a/nix/module-eval/agent-memory.nix +++ b/nix/module-eval/agent-memory.nix @@ -30,6 +30,7 @@ let agentUncapped = agent { }; + agentBashDaemon = machine: machine.systemd.services.hive-bash-daemon; agentSubagentDaemon = machine: machine.systemd.services.hive-subagent-daemon; cases = [ { @@ -82,6 +83,12 @@ let name = "one subagent losing the OOM draw does not stop the daemon"; ok = (agentSubagentDaemon agentUncapped).serviceConfig.OOMPolicy == "continue"; } + { + # Each bash task is a process in the daemon's cgroup; under `stop` one + # OOM-killed task would end every running sibling task. + name = "one bash task losing the OOM draw does not stop the daemon"; + ok = (agentBashDaemon agentUncapped).serviceConfig.OOMPolicy or null == "continue"; + } ]; in runGroup "agent-memory" cases