Watch
0
0
Fork
You've already forked hyperhive
0

swarm-controller: drop the relay subscription to the refused hive-scoped agent subject

This commit is contained in:
atlas 2026-10-04 21:43:33 +02:00 • committed by mara
commit 8a7733b3f5
3 changed files with 37 additions and 63 deletions

View file

@ -2,8 +2,7 @@
//! turn-state header, sourced straight from the swarm queue.
//!
//! Sibling of [`crate::term_stream`] in every structural respect — the
//! reasoning there for resolving the hive at request time rather than
//! naming it in the path, and for a live tail with no replay, applies
//! reasoning there for keeping the hive out of the path, and for a live tail with no replay, applies
//! unchanged here and is not repeated. What differs is only what the two
//! subjects carry: a terminal row is an event that happened, a header is
//! the agent's current state.
@ -33,8 +32,8 @@ use crate::AppState;
/// Subject family carrying agent turn-state headers — must match
/// `hive-agent::swarm_agent_state::SUBJECT_PREFIX` exactly, since the two
/// ends never see the constant together. `crate::term_stream::agent_subjects`
/// spells the full subjects; as with the terminal relay's own copy, there is no
/// ends never see the constant together. `crate::term_stream::agent_subject`
/// spells the full subject; as with the terminal relay's own copy, there is no
/// way to check the two sides agree short of this comment and the module
/// docs on both ends staying honest about it.
const SUBJECT_PREFIX: &str = "$SWARM.agent-state";
@ -85,7 +84,7 @@ pub(crate) async fn stream_agent_state(
// One-agent "roster": reuses `AgentStatusReader::view`'s already-tested
// row logic rather than a second, narrower lookup that could disagree
// with it about what "never reported" means.
let hive = agent_status
agent_status
.view(std::slice::from_ref(&agent), SystemTime::now())
.await
.map_err(|e| {
@ -117,9 +116,9 @@ pub(crate) async fn stream_agent_state(
)
})?;
let subscriber = crate::term_stream::subscribe_all(
let subscriber = crate::term_stream::subscribe(
&client,
&crate::term_stream::agent_subjects(SUBJECT_PREFIX, &hive, &agent),
crate::term_stream::agent_subject(SUBJECT_PREFIX, &agent),
"state",
)
.await?;