approvals: manager can withdraw pending approvals (closes #250)

This commit is contained in:
damocles 2026-05-27 11:57:27 +02:00 committed by Mara
commit c1f27e3b7b
8 changed files with 182 additions and 16 deletions

View file

@ -261,8 +261,10 @@ fn parse_loose_end_kind(raw: &str) -> Result<hive_sh4re::CancelLooseEndKind, Str
match raw.trim().to_ascii_lowercase().as_str() {
"question" | "q" => Ok(hive_sh4re::CancelLooseEndKind::Question),
"reminder" | "r" => Ok(hive_sh4re::CancelLooseEndKind::Reminder),
"approval" | "a" => Ok(hive_sh4re::CancelLooseEndKind::Approval),
other => Err(format!(
"cancel_loose_end: unknown kind '{other}' (expected \"question\" or \"reminder\")"
"cancel_loose_end: unknown kind '{other}' \
(expected \"question\", \"reminder\", or \"approval\")"
)),
}
}
@ -275,6 +277,7 @@ fn loose_end_kind_label(kind: hive_sh4re::CancelLooseEndKind) -> &'static str {
match kind {
hive_sh4re::CancelLooseEndKind::Question => "question",
hive_sh4re::CancelLooseEndKind::Reminder => "reminder",
hive_sh4re::CancelLooseEndKind::Approval => "approval",
}
}
@ -1628,11 +1631,14 @@ impl ManagerServer {
#[tool(
description = "Cancel any open thread in the swarm — a `question` (cancels \
with the operator-override sentinel so the asker unblocks) or a `reminder` \
(hard-deleted before fire). `kind` is `\"question\"` or `\"reminder\"`; `id` \
is the row id from `get_loose_ends` or the original submission reply. \
Manager surface bypasses the owner check on the sub-agent flavour use for \
hive-wide cleanup of stuck or stale threads."
with the operator-override sentinel so the asker unblocks), a `reminder` \
(hard-deleted before fire), or an `approval` (withdraws a pending approval \
you submitted; the dashboard pulls the card from pending and the row resolves \
as `cancelled` instead of approved/denied/failed closes #250). `kind` is \
`\"question\"`, `\"reminder\"`, or `\"approval\"`; `id` is the row id from \
`get_loose_ends` or the original submission reply. Manager surface bypasses \
the owner check on the sub-agent flavour use for hive-wide cleanup of \
stuck or stale threads, or to drop your own approvals that got superseded."
)]
async fn cancel_loose_end(&self, Parameters(args): Parameters<CancelLooseEndArgs>) -> String {
let log = format!("{args:?}");