cap get_loose_ends todo output + add ack_todos_until bulk-clear (#2944)

This commit is contained in:
damocles 2026-08-02 14:37:22 +02:00 committed by mara
commit eb570c003d
7 changed files with 167 additions and 9 deletions

View file

@ -202,6 +202,7 @@ fn dispatch(
} => clear_todo(store, &subsystem, key.as_deref(), all),
Request::ListTodos { subsystem } => list_todos(store, subsystem.as_deref()),
Request::MarkTodoDone { id } => mark_todo_done(store, id),
Request::MarkTodosDoneUntil { up_to } => mark_todos_done_until(store, up_to),
Request::StoreReminder {
message,
timing,
@ -417,6 +418,21 @@ fn mark_todo_done(store: &Todos, id: i64) -> Response {
}
}
/// `MarkTodosDoneUntil` handler: bulk-acks every un-acked todo id at or
/// below `up_to` — the escape hatch for a backlog too large to triage
/// one-by-one (see `Todos::mark_done_until`'s doc for why it's needed).
fn mark_todos_done_until(store: &Todos, up_to: i64) -> Response {
match store.mark_done_until(up_to) {
Ok(count) => {
tracing::debug!(up_to, count, "todo bulk mark-done");
Response::Acked {
count: u64::try_from(count).unwrap_or(0),
}
}
Err(e) => err(&e),
}
}
/// `Request::Compact` handler: gate on context usage, then queue the same
/// deferred `compact_pending` flag the operator's `/compact` button sets.
/// Mirrors `hive-agent::web_ui::actions::post_compact` but reachable from