delete c0re-side reminder plumbing (#2635 inc 1 commit 6)
This commit is contained in:
parent
dcb2b79715
commit
a80d0b0fed
16 changed files with 70 additions and 1136 deletions
|
|
@ -3,7 +3,8 @@
|
|||
//! a single agent (`for_agent`) or the whole hive (`hive_wide`).
|
||||
//! `Request::GetLooseEnds` from either the agent or manager socket
|
||||
//! lands here so the routing logic + age-seconds derivation stay in
|
||||
//! one place.
|
||||
//! one place. Reminders are agent-local (in-container store) and no
|
||||
//! longer sourced from here.
|
||||
//!
|
||||
//! Call frequency is low (an agent doing self-introspection between
|
||||
//! turns), so the sweep happens fresh every time — no caching, no
|
||||
|
|
@ -27,18 +28,17 @@ use hive_sh4re::wire_time::now_unix;
|
|||
/// root submits for top-level agents). Legacy rows with no recorded
|
||||
/// submitter count as the root's;
|
||||
/// - unanswered questions where `agent` is the asker (waiting on
|
||||
/// someone) OR the target (owes a reply);
|
||||
/// - pending reminders this agent scheduled (`owner == self`).
|
||||
/// someone) OR the target (owes a reply).
|
||||
///
|
||||
/// 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).
|
||||
/// Ordered `pending_messages` (when non-zero) → approvals → questions
|
||||
/// 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.
|
||||
/// question sqlite queries.
|
||||
pub fn for_agent(coord: &Coordinator, agent: &str) -> Result<Vec<LooseEnd>> {
|
||||
let now = now_unix();
|
||||
let mut out = Vec::new();
|
||||
|
|
@ -85,25 +85,13 @@ pub fn for_agent(coord: &Coordinator, agent: &str) -> Result<Vec<LooseEnd>> {
|
|||
age_seconds: saturating_age(now, q.asked_at.timestamp()),
|
||||
});
|
||||
}
|
||||
for r in coord.broker.list_pending_reminders()? {
|
||||
if r.agent != agent {
|
||||
continue;
|
||||
}
|
||||
out.push(LooseEnd::Reminder {
|
||||
id: r.id,
|
||||
owner: r.agent,
|
||||
message: r.message,
|
||||
due_at: r.due_at,
|
||||
age_seconds: saturating_age(now, r.created_at.timestamp()),
|
||||
});
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Hive-wide loose-ends view: EVERY pending approval + EVERY
|
||||
/// unanswered question + EVERY pending reminder. Manager surface
|
||||
/// only; sub-agents can't see each other's threads via the agent
|
||||
/// surface (`for_agent` filters by name).
|
||||
/// unanswered question. Manager surface only; sub-agents can't see
|
||||
/// each other's threads via the agent surface (`for_agent` filters by
|
||||
/// name).
|
||||
pub fn hive_wide(coord: &Coordinator) -> Result<Vec<LooseEnd>> {
|
||||
let now = now_unix();
|
||||
let mut out = Vec::new();
|
||||
|
|
@ -125,15 +113,6 @@ pub fn hive_wide(coord: &Coordinator) -> Result<Vec<LooseEnd>> {
|
|||
age_seconds: saturating_age(now, q.asked_at.timestamp()),
|
||||
});
|
||||
}
|
||||
for r in coord.broker.list_pending_reminders()? {
|
||||
out.push(LooseEnd::Reminder {
|
||||
id: r.id,
|
||||
owner: r.agent,
|
||||
message: r.message,
|
||||
due_at: r.due_at,
|
||||
age_seconds: saturating_age(now, r.created_at.timestamp()),
|
||||
});
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue