Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-bash-mcp/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas b31db6c7d9 subagent, bash: run each subagent run and bash task in its own cgroup
hive-subagent-daemon and hive-bash-daemon are now delegated their cgroup
(Delegate=memory pids, DelegateSubgroup=daemon). At start each daemon
enables memory+pids below its unit and creates runs/ (subagent) or
tasks/ (bash). Each subagent run gets runs/<name>-<n>/ and each bash
task tasks/<id>/, both with memory.oom.group=1, and the daemon removes
the directory when the run ends. An OOM kill now takes one whole run
instead of one process out of the daemon's shared cgroup, and never the
daemon itself.

Subagent runs get oom_score_adj +1000; bash tasks and both daemons stay
at 0; the harness stays at -500. The unit-level OOMScoreAdjust=500 on
the subagent daemon goes: it was both the daemon's own score and a floor
no run below it could be lowered past.

Bash tasks enter their cgroup from the existing pre_exec hook, writing
to a cgroup.procs fd opened by the parent. hive-claude builds its
Command itself and exposes neither a pre_exec hook nor the child's pid,
so a subagent's claude (and an ACP agent's process) is started as the
daemon's own binary with the run's cgroup in its environment; main()
enters the cgroup, raises oom_score_adj and execs the real program, the
trampoline swarm-review-classifier already uses. Both enter before the
program executes, so nothing it forks starts outside the run's cgroup.

Without a delegated `daemon` leaf (tests, a dev shell) each daemon logs
one warning and runs everything in its own cgroup, as before.

The shared helper is hive-agent-sock's run_cgroup module, the crate
both daemons already use for what in-container plugins share.

Closes #5007
2026-10-13 12:25:27 +02:00
..
lib.rs hive-bash-mcp: share one HARNESS_DIR_ENV_LOCK across test modules 2026-08-10 23:36:12 +02:00
main.rs subagent, bash: run each subagent run and bash task in its own cgroup 2026-10-13 12:25:27 +02:00
mcp.rs hive-bash-mcp: drop the redundant output-path line from status's description 2026-09-13 15:56:10 +02:00
paths.rs move hive-sh4re's harness_dir() into hive-agent-sock, drop the dev-fallback derivation 2026-08-09 19:54:13 +02:00
protocol.rs hive-sh4re: split bash-task schema into its own topic module 2026-08-10 22:12:38 +02:00
runner.rs subagent, bash: run each subagent run and bash task in its own cgroup 2026-10-13 12:25:27 +02:00
stats.rs feat: capture normalised bash command heads for the favorite-tools stat 2026-06-06 00:52:56 +02:00
test_util.rs hive-bash-mcp: share one HARNESS_DIR_ENV_LOCK across test modules 2026-08-10 23:36:12 +02:00