Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-subagent-mcp/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas 33da51382e subagent: make interrupt cancel a goal run, not just its turn
`interrupt` killed the child and trusted that to end the run. It didn't:
the default signal is SIGINT, and `claude --print` handles SIGINT by
writing its terminal `result` event and exiting **zero**. A zero exit is
`TurnEnd::Complete`, so `spawn_and_track`'s killed-turn early return —
the code that was supposed to stop the run — never fired, and the loop
went straight on to spawn the next goal turn. An interrupted run carried
on to completion; the interrupt changed nothing about the outcome.

Measured, not inferred: `claude --print --verbose --output-format
stream-json`, SIGINT'd mid-turn, exits 0 on every run.

So record the reason instead of inferring it. `interrupt` writes
`StopReason::Cancelled` — the same path `goal_reached`/`need_help`
already use — while it still holds the `running` lock, so there is no
instant in which the name has lost its cancel handle but not yet gained
its stop reason. `plan_after_turn` checks stop reasons ahead of the goal,
so the run stops whichever way the child ends up exiting. `force`'s
SIGKILL still produces a `TurnEnd::Killed`, and `status` still prefers
the kill record it already had.

`continue`'s budget reset is untouched: it clears the stop reason and
hands back a fresh allowance, which is what makes a cancel a pause an
operator can undo.

The test spawns the real continuation loop against a fake claude that
exits 0 on SIGINT, interrupts it, and asserts turn two never starts —
it reports `left: 2` without the fix.
2026-09-23 23:14:13 +02:00
..
lib.rs hive-subagent-mcp: name a role at dispatch, load it as the system prompt 2026-09-21 17:21:40 +02:00
main.rs subagent: give each run its own signal URL, and drop the name argument 2026-09-14 22:24:51 +02:00
mcp.rs subagent: make interrupt cancel a goal run, not just its turn 2026-09-23 23:14:13 +02:00
mcp_config.rs hive-c0re: render the new agent option paths into generated agent flakes 2026-09-17 20:19:30 +02:00
paths.rs hive-subagent-mcp: name a role at dispatch, load it as the system prompt 2026-09-21 17:21:40 +02:00
role.rs hive-subagent-mcp: name a role at dispatch, load it as the system prompt 2026-09-21 17:21:40 +02:00
session.rs subagent: make interrupt cancel a goal run, not just its turn 2026-09-23 23:14:13 +02:00