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

@ -136,6 +136,11 @@ pub enum ApprovalStatus {
Approved,
Denied,
Failed,
/// Manager withdrew the request before the operator acted on it
/// (closes #250). Distinct from `Denied` (operator decision) and
/// `Failed` (post-approval lifecycle error) so the dashboard can
/// chip / sort cancellations separately.
Cancelled,
}
/// Reminder activity statistics for an agent over a time window.
@ -271,10 +276,10 @@ pub enum ReminderTiming {
/// as a short bulleted list — the per-row fields are all the context
/// needed without a follow-up fetch.
///
/// `Question` and `Reminder` rows are cancellable via the
/// `CancelLooseEnd` request (and the `cancel_loose_end` MCP tool);
/// `Approval` rows are not (operator approves/denies via the
/// dashboard, manager has no withdraw path today).
/// All three variants are cancellable via `CancelLooseEnd` /
/// `cancel_loose_end`. `Question` and `Reminder` can be cancelled
/// from either surface (subject to ownership checks); `Approval`
/// is manager-only since sub-agents can't submit approvals.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum LooseEnd {
@ -325,15 +330,20 @@ pub enum LooseEnd {
}
/// Kind discriminator for `CancelLooseEnd`. Maps to which underlying
/// store the dispatcher reaches into (`OperatorQuestions` vs
/// `Broker::reminders`). Approvals are deliberately not cancellable
/// — the operator approves/denies via the dashboard, manager has no
/// withdraw path today.
/// store the dispatcher reaches into (`OperatorQuestions` /
/// `Broker::reminders` / `Approvals`). The `Approval` variant is
/// manager-only — sub-agents can't submit approvals so they have
/// nothing to withdraw (closes #250).
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum CancelLooseEndKind {
Question,
Reminder,
/// Withdraw a pending approval (manager surface only). The row
/// transitions to `ApprovalStatus::Cancelled` and an
/// `ApprovalResolved` event fires so the dashboard pulls the card
/// out of the pending pane.
Approval,
}
/// Requests on a per-agent socket. The agent's identity is the socket