fix: 修复 P0 级技术债(useEffect 依赖项缺失 + prompt 注入吞错)
P0-1: web/src/App.tsx 话题刷新 useEffect 依赖项不完整
- 原依赖数组仅 [topicRefreshTrigger],但 effect 体内使用了
status/handleCommand/sendMessage/requestTopicList
- 导致断线重连后 status 从 disconnected→connected 时
effect 不会重新运行,话题刷新被静默丢失(stale closure bug)
- 补全依赖数组为 [topicRefreshTrigger, status, handleCommand,
sendMessage, requestTopicList],与同文件 200-208 行 effect 风格一致
P0-2: src/gateway/agent_prompt_provider.rs 静默吞错
- record_injection 中 let _ = repository.mark_agent_prompt_reinjected(...)
丢弃了 Result 错误
- 失败时 Agent prompt 注入计数错乱且无任何日志
- 改为 if let Err(e) = ... { tracing::warn!(...) } 记录 session_id 和 error
This commit is contained in:
parent
7c578af0bc
commit
fef5ae7626
@ -43,7 +43,13 @@ impl AgentPromptProvider {
|
|||||||
/// 记录注入事件
|
/// 记录注入事件
|
||||||
fn record_injection(&self, context: &SystemPromptContext) {
|
fn record_injection(&self, context: &SystemPromptContext) {
|
||||||
if let Some(session_id) = &context.session_id {
|
if let Some(session_id) = &context.session_id {
|
||||||
let _ = self.repository.mark_agent_prompt_reinjected(session_id);
|
if let Err(e) = self.repository.mark_agent_prompt_reinjected(session_id) {
|
||||||
|
tracing::warn!(
|
||||||
|
session_id = ?session_id,
|
||||||
|
error = %e,
|
||||||
|
"Failed to mark agent prompt reinjected; injection counter may be inaccurate"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -220,7 +220,7 @@ function App() {
|
|||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
return () => clearTimeout(timer)
|
return () => clearTimeout(timer)
|
||||||
}, [topicRefreshTrigger])
|
}, [topicRefreshTrigger, status, handleCommand, sendMessage, requestTopicList])
|
||||||
|
|
||||||
// Topics 加载后,自动选择第一个(仅当用户尚未手动选择 topic 时)
|
// Topics 加载后,自动选择第一个(仅当用户尚未手动选择 topic 时)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user