Skip to content

Commit 9085c61

Browse files
fix: use switch_foreground in auto-switch to avoid desync after /thread bg
switch_to() returns the old foreground ID, which is None after /thread bg. This caused the .is_some() check to fail, skipping the ThreadSwitched notification and permanently desyncing the client. switch_foreground() returns bool indicating success, which is the correct check here. Co-Authored-By: Erica Stith <rexlunae@gmail.com>
1 parent b01148b commit 9085c61

File tree

1 file changed

+1
-1
lines changed
  • crates/rustyclaw-core/src/gateway

1 file changed

+1
-1
lines changed

crates/rustyclaw-core/src/gateway/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ async fn handle_connection(
12031203
if let Some(last_user) = messages.iter().rev().find(|m| m.role == "user") {
12041204
if let Some(better_thread_id) = thread_mgr.find_best_match(&last_user.content) {
12051205
// Found a better match — switch threads
1206-
if thread_mgr.switch_to(better_thread_id).is_some() {
1206+
if thread_mgr.switch_foreground(better_thread_id) {
12071207
// Get the context summary from the new foreground thread
12081208
let context_summary = thread_mgr
12091209
.foreground()

0 commit comments

Comments
 (0)