修复: 飞书渠道错误话术分类透传+探活 inflight 口径前移(18)
This commit is contained in:
@@ -254,6 +254,13 @@ async fn handle_message(
|
||||
.and_then(|u| u.open_id.clone())
|
||||
.unwrap_or_default();
|
||||
|
||||
// 18 探活口径修正:inflight 计数从此(白名单通过即受理)覆盖到投递完成——原计数点
|
||||
// 在 spawn 前,占位卡 HTTP+per-chat 锁排队(可等上一任务全程)不在覆盖内,该窗口
|
||||
// 连接假活会误报「无在途会话」。全部早退路径(占位卡失败/注入旁路/常规路径后续
|
||||
// return)经 RAII 回落,纯过滤段(@/空文本/白名单拒)在计数点之前不受影响。
|
||||
ctx.inflight.fetch_add(1, Ordering::SeqCst);
|
||||
let _inflight_guard = InflightGuard(ctx.inflight.clone());
|
||||
|
||||
// 白名单(D2 热加载):空=放行;非空且不在内 → 提示并附自己的 open_id(首启自助回填,
|
||||
// 免翻日志)。每消息现读 KV,设置面板改白名单即生效免重启
|
||||
let whitelist = read_whitelist(&ctx).await;
|
||||
@@ -312,9 +319,8 @@ async fn handle_message(
|
||||
};
|
||||
feishu_log(&format!("spawn 会话 conv={conv_id}"));
|
||||
|
||||
// D3 在途计数:从此到投递完成期间连接假活判定须让位,RAII 保任意退出路径回落
|
||||
ctx.inflight.fetch_add(1, Ordering::SeqCst);
|
||||
let _inflight_guard = InflightGuard(ctx.inflight.clone());
|
||||
// D3 在途计数已前移至 handle_message 白名单通过处(探活口径修正,18),此处不再重复计数
|
||||
|
||||
let state = ctx.app.state::<crate::state::AppState>();
|
||||
// 通知桥注册(#14):oneshot 接收端有意 drop——两段式下终版走事件广播
|
||||
// (deliver_completion_report_if_waited 的 AiAgentFinished publish),桥条目存在的
|
||||
@@ -367,12 +373,20 @@ async fn handle_message(
|
||||
drop(deliver_tx);
|
||||
let _ = stream_task.await;
|
||||
feishu_log(&format!("spawn 失败 conv={conv_id}: {e}"));
|
||||
// 18 渠道错误话术透传:并发护栏拒绝(生成中)≠真失败——固定「启动失败」话术
|
||||
// 吞掉真实原因,用户误判 bot 坏了重试白撞。按引擎层错误文案分类:
|
||||
// 生成中→明示任务进行中不会丢;其余→附截断原始原因(不吞因)。
|
||||
let user_msg = if e.contains("正在生成") || e.contains("生成中") {
|
||||
"⏳ 该会话已有任务进行中,本条将在任务完成后处理;可稍后重发,或先 /status 查看进度。".to_string()
|
||||
} else {
|
||||
format!("❌ 会话启动失败:{}`,请稍后重试", truncate(&e, 120))
|
||||
};
|
||||
deliver_result(
|
||||
&ctx.client,
|
||||
&placeholder_id,
|
||||
&message_id,
|
||||
&chat_id,
|
||||
"❌ 会话启动失败,请稍后重试",
|
||||
&user_msg,
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user