hive-agent: surface an interrupted-turn banner in the wake prompt after /cancel

This commit is contained in:
damocles 2026-08-01 18:25:41 +02:00
commit a11f945532
5 changed files with 72 additions and 6 deletions

View file

@ -54,7 +54,17 @@ pub(super) async fn post_send(
pub(super) async fn post_cancel_turn(State(state): State<AppState>) -> Response {
let out = super::sigint_claude().await;
let note = match out {
Ok(o) if o.status.success() => "operator: /cancel — sent SIGINT to claude".to_owned(),
Ok(o) if o.status.success() => {
// A process actually got signalled — the *next* turn's wake
// prompt should tell the agent it was cut off mid-work. Only
// set on an actual signal: a `pkill` exit 1 ("no process to
// interrupt") means /cancel raced an already-finished turn, so
// there's nothing to flag as interrupted.
state
.interrupted
.store(true, std::sync::atomic::Ordering::Relaxed);
"operator: /cancel — sent SIGINT to claude".to_owned()
}
Ok(o) if o.status.code() == Some(1) => {
"operator: /cancel — no claude process to interrupt".to_owned()
}