docs(#1990): fix for_agent ordering doc + add # errors (argus review)

This commit is contained in:
damocles 2026-06-26 00:29:22 +02:00 committed by mara
commit eba637b36c

View file

@ -21,6 +21,8 @@ use hive_sh4re::{LooseEnd, MANAGER_AGENT};
use crate::coordinator::Coordinator;
/// Open threads pending against `agent`:
/// - undelivered inbox messages this agent still owes itself a `recv`
/// for (only when the count is non-zero);
/// - pending approvals where this agent is the submitter (a parent
/// agent with the `approvals` group submits for its children; the
/// root submits for top-level agents). Legacy rows with no recorded
@ -29,9 +31,15 @@ use crate::coordinator::Coordinator;
/// someone) OR the target (owes a reply);
/// - pending reminders this agent scheduled (`owner == self`).
///
/// Ordered approvals → questions → reminders within the returned
/// vector. Within each kind, source-of-truth ordering (sqlite's
/// `pending()` queries return newest-first within their indexes).
/// Ordered `pending_messages` (when non-zero) → approvals → questions →
/// reminders within the returned vector. Within each kind,
/// source-of-truth ordering (sqlite's `pending()` queries return
/// newest-first within their indexes).
///
/// # Errors
///
/// Propagates errors from `count_pending` and the pending-approval /
/// question / reminder sqlite queries.
pub fn for_agent(coord: &Coordinator, agent: &str) -> Result<Vec<LooseEnd>> {
let now = now_unix();
let mut out = Vec::new();