fix(agent): allow driver upgrades after closing connections

This commit is contained in:
zipg authored and GitHub committed 2026-07-16 17:31:05 +08:00
1 parent c4f4ce2460
commit 0f335119e3
5 files changed
+164 -16

No files matched your search

+8 -2
View File
@@ -198,7 +198,7 @@ fn emit_agent_progress(app: &tauri::AppHandle, event: AgentProgressEvent) {
}
async fn ensure_no_agent_update_blockers(state: &AppState, db_types: &[String]) -> Result<(), String> {
let blockers = agent_update_blockers(state, db_types).await;
let blockers = update_blockers_from_keys(state.prepare_agent_driver_updates(db_types).await, db_types);
if blockers.is_empty() {
return Ok(());
}
@@ -207,11 +207,17 @@ async fn ensure_no_agent_update_blockers(state: &AppState, db_types: &[String])
}
async fn agent_update_blockers(state: &AppState, db_types: &[String]) -> Vec<AgentUpdateBlocker> {
update_blockers_from_keys(state.active_agent_connection_driver_keys().await, db_types)
}
fn update_blockers_from_keys(
active_keys: std::collections::HashSet<String>,
db_types: &[String],
) -> Vec<AgentUpdateBlocker> {
let candidate_keys: std::collections::HashSet<&str> = db_types.iter().map(String::as_str).collect();
if candidate_keys.is_empty() {
return Vec::new();
}
let active_keys = state.active_agent_driver_keys().await;
let mut blockers = active_keys
.into_iter()
.filter(|key| candidate_keys.contains(key.as_str()))