fix(runtime): isolate agent state by project (#101)

This commit is contained in:
2026-07-25 22:14:02 +02:00
parent 6a87c4635f
commit 6e98fd89f7
52 changed files with 1894 additions and 805 deletions

View File

@ -77,10 +77,11 @@ impl ReconcileLiveState {
///
/// # Errors
/// [`AppError::Store`] sur défaillance de chargement ou d'upsert du store.
pub async fn execute(&self, _input: ReconcileLiveStateInput) -> Result<(), AppError> {
pub async fn execute(&self, input: ReconcileLiveStateInput) -> Result<(), AppError> {
let state = self.store.load().await?;
let now_ms = u64::try_from(self.clock.now_millis()).unwrap_or(0);
let reconciled = state.reconcile_orphans(|a| self.registry.is_agent_live(a), now_ms);
let reconciled =
state.reconcile_orphans(|a| self.registry.is_agent_live(input.project_id, a), now_ms);
for entry in reconciled {
self.store.upsert(entry).await?;
}
@ -125,7 +126,7 @@ mod tests {
live: HashSet<AgentId>,
}
impl LiveAgentRegistry for FakeRegistry {
fn is_agent_live(&self, agent_id: &AgentId) -> bool {
fn is_agent_live(&self, _project_id: domain::ProjectId, agent_id: &AgentId) -> bool {
self.live.contains(agent_id)
}
fn is_node_live(&self, _node_id: &NodeId) -> bool {