From 2f2631e36a848d4d17d9f12f6f439ec38453efbc Mon Sep 17 00:00:00 2001 From: xiaoxixi Date: Wed, 29 Apr 2026 22:32:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(session):=20/new=20=E5=90=8E=E6=96=B0?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E8=A2=AB=E6=97=A7=E5=AF=B9=E8=AF=9D=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A6=86=E7=9B=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题原因:execute_slash_command 执行 /new 后,错误地将旧 session 的数据 存储到新 session 的 key 下,导致 current_sessions 虽然指向新 session, 但 sessions 里面存的是旧数据。 解决方案:移除错误的 session 映射更新逻辑。create_session 已经正确地将 新 session 存入 sessions 并更新 current_sessions,不需要额外覆盖。 --- src/session/session.rs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/session/session.rs b/src/session/session.rs index f336ca1..a7d9ec7 100644 --- a/src/session/session.rs +++ b/src/session/session.rs @@ -1087,15 +1087,6 @@ impl SessionManager { Some(&unified_id), ).await?; - // If a new session was created (e.g., /new, /delete), update the session binding - if let Some(new_id) = new_session_id { - // Update the session in the map with the new ID - let mut inner = self.inner.lock().await; - if let Some(old_session) = inner.sessions.remove(&unified_id.to_string()) { - inner.sessions.insert(new_id.to_string(), old_session); - } - } - return Ok(HandleResult::CommandOutput(response)); }