修复: run_command 空路径报错 + 隧道日志洪水 + 启动残留清理
- tool_registry: run_command working_dir 空字符串 "" → None,修 Windows os error 123 - lib: tunnel subscriber 从频率压制(suppress_until)改为连接状态感知(is_connected), 断开时静默丢弃事件,重连后恢复透传,记 INFO 状态变迁(治本) - conversation_repo: 新增 cleanup_stale_pending(),超 24h 残留 pending 标记 interrupted - restore: 启动时先清理过期 pending 再恢复审批 - state: 实现 cleanup_orphan_pending_messages(),启动时清理对应已决/超时 tool 的 __PENDING__ 占位消息
This commit is contained in:
@@ -186,13 +186,29 @@ pub fn run() {
|
||||
let token = "devflow-relay-default-token".to_string();
|
||||
|
||||
// subscriber task:subscribe ai_event_bus → tunnel.send_raw_event 透传 miniapp
|
||||
// 治本:先查 is_connected()(AtomicBool 无锁读),未连接时静默丢弃事件,
|
||||
// 避免每次 send_raw_event 都失败并记 WARN(旧实现用 suppress_until 降频,是治标)。
|
||||
let mut rx = state.ai_event_bus.subscribe();
|
||||
let tunnel_for_sub = state.tunnel.clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
tracing::info!("[tunnel-sub] subscriber task 启动,透传 ai_event_bus → relay");
|
||||
let mut was_connected = false;
|
||||
while let Ok(value) = rx.recv().await {
|
||||
if !tunnel_for_sub.is_connected() {
|
||||
if was_connected {
|
||||
tracing::info!("[tunnel-sub] tunnel 已断开,暂停透传");
|
||||
was_connected = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if !was_connected {
|
||||
tracing::info!("[tunnel-sub] tunnel 已重连,恢复透传");
|
||||
was_connected = true;
|
||||
}
|
||||
if let Err(e) = tunnel_for_sub.send_raw_event(value).await {
|
||||
tracing::warn!("[tunnel-sub] send_raw_event 失败(可能未连接): {}", e);
|
||||
// 连接刚断(查询与发送间窗口),记一条 DEBUG 而非 WARN
|
||||
tracing::debug!("[tunnel-sub] send_raw_event 失败(连接瞬断): {}", e);
|
||||
was_connected = false;
|
||||
}
|
||||
}
|
||||
tracing::info!("[tunnel-sub] subscriber task 退出(rx 关闭)");
|
||||
|
||||
Reference in New Issue
Block a user