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

@ -12,7 +12,11 @@ use crate::turn_stats::TurnStatRow;
/// system prompt; this is just the wake signal body. `id` is the broker row
/// id, rendered as a `[msg #<id>]` marker so the agent can reference it in
/// `ack_until`. `unread` is the inbox depth after this message was popped.
/// `redelivered` prepends a "may already be handled" banner.
/// `redelivered` prepends a "may already be handled" banner; `interrupted`
/// prepends a "previous turn was /cancel'd" banner instead (the two are
/// mutually exclusive in practice — a redelivered message means the harness
/// itself restarted, which also clears the in-memory interrupted flag — so
/// `redelivered` takes priority if both were somehow set).
#[must_use]
pub fn format_wake_prompt(
id: i64,
@ -20,9 +24,12 @@ pub fn format_wake_prompt(
body: &str,
unread: u64,
redelivered: bool,
interrupted: bool,
) -> String {
let banner = if redelivered {
hive_sh4re::REDELIVERY_HINT
} else if interrupted {
hive_sh4re::INTERRUPTED_HINT
} else {
""
};