Merge pull request 'fix: restore PR11 Linux preflight (clippy + async read)' (#12) from fix/pr11-linux-preflight into main

This commit is contained in:
clawdie 2026-05-31 17:38:27 +02:00
commit 328f860cd3

View file

@ -8,7 +8,7 @@ use colibri_glasspane::PaneSupervisor;
use colibri_store::Store;
use dashmap::DashMap;
use tokio::sync::{broadcast, Mutex, RwLock};
use tracing::{debug, error, info, warn};
use tracing::{debug, info, warn};
use crate::config::DaemonConfig;
use crate::session::Session;
@ -100,7 +100,7 @@ pub async fn run_loop(
tokio::select! {
_ = heartbeat_tick.tick() => {
heartbeat(&state, loop_config.agent_stall_timeout).await;
maybe_rewarm_cache(&state);
maybe_rewarm_cache(&state).await;
}
_ = rotation_tick.tick() => session_rotation(&state).await,
_ = handoff_tick.tick() => memory_handoff(&state).await,
@ -160,12 +160,12 @@ pub fn warm_cache(state: &SharedState) {
}
/// Re-warm if interval has elapsed since last warm.
pub fn maybe_rewarm_cache(state: &SharedState) {
pub async fn maybe_rewarm_cache(state: &SharedState) {
let interval_hours = state.config.cache_warming_interval_hours;
if interval_hours == 0 {
return;
}
let last = *state.last_warm_at.blocking_read();
let last = *state.last_warm_at.read().await;
match last {
None => warm_cache(state),
Some(last_at) => {
@ -227,10 +227,8 @@ async fn session_rotation(state: &SharedState) {
for entry in state.sessions.iter() {
let s = entry.value();
let (bc, tc) = { (s.byte_count().await, s.turn_count().await) };
if bc > max_bytes || tc > max_turns {
if s.compact_oldest_turns().await.is_ok() {
compacted += 1;
}
if (bc > max_bytes || tc > max_turns) && s.compact_oldest_turns().await.is_ok() {
compacted += 1;
}
if s.byte_count().await > max_bytes * 3 {
let _ = s.prune_to((max_turns / 2).max(1)).await;