hive-runtime: kill an ACP agent's whole process group, not just its pid
The ACP agent was spawned with only `kill_on_drop`, which SIGKILLs the agent's own pid. Commands the agent had started (a `nix build`, a test run) were reparented and kept running after the agent was killed: when a subagent run ends after `interrupt`, when an agent ignores `session/cancel` past the grace, and when the harness drops the runtime. The agent now leads its own process group (`process_group(0)`), and dropping its `Connection` SIGKILLs that group. The soft path is unchanged: `interrupt` / `Canceller::cancel` still sends `session/cancel`. Refs #4999. The claude half needs hive-claude 0.1.3, which is not on crates.io yet.
This commit is contained in:
parent
916fdb35b8
commit
8d206f124f
6 changed files with 149 additions and 7 deletions
|
|
@ -317,18 +317,19 @@ page applies as written.
|
|||
|
||||
On `acp`:
|
||||
|
||||
- each run spawns its own copy of the parent's ACP agent, which exits
|
||||
when the run ends. The unit loads `backendEnvironmentFile` for it. On the
|
||||
`opencode` preset, the daemon reads a provider key that file leaves unset
|
||||
from the swarm secret store at `swarm/agents/<agent>/acp-provider`, as the
|
||||
harness does.
|
||||
- each run spawns its own copy of the parent's ACP agent. The end of the
|
||||
run kills it and every command it started. The unit loads
|
||||
`backendEnvironmentFile` for it. On the `opencode` preset, the daemon
|
||||
reads a provider key that file leaves unset from the swarm secret store
|
||||
at `swarm/agents/<agent>/acp-provider`, as the harness does.
|
||||
- the session id lives in `subagent-acp-session-<name>` under the harness
|
||||
dir. `start` moves an old one aside, `continue` loads it into a fresh
|
||||
agent process, and a `continue` with none recorded fails straight away.
|
||||
- a role goes in front of the session's first prompt, since ACP has no
|
||||
system prompt.
|
||||
- `interrupt` sends `session/cancel`, and `force` changes nothing. The
|
||||
runtime kills an agent that ignores the cancel for 10s.
|
||||
runtime kills an agent that ignores the cancel for 10s, with every
|
||||
command it started.
|
||||
- the runtime sets `model` and `effort` on the session when the agent
|
||||
offers that value for its `model` or `thought_level` config option. Any
|
||||
other value does nothing (`hive_runtime::AcpRuntime`).
|
||||
|
|
|
|||
Loading…
Reference in a new issue