From 39b8fab1f8f857ff7caa52857268f3fdddddbab0 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 28 Sep 2026 03:01:30 +0000 Subject: [PATCH] voelin-core: remember a server's addresses with the gateway's id When voice connected while the gateway was already up, the bookmark's voice address was not remembered with the server's unique id, so a later visit without the gateway could not show the stored history before the voice connection was up. Addresses are now remembered with the key in use (the gateway's) whichever source reports last. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G --- crates/voelin-core/src/session.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/voelin-core/src/session.rs b/crates/voelin-core/src/session.rs index 6dc83c8..fcbbb50 100644 --- a/crates/voelin-core/src/session.rs +++ b/crates/voelin-core/src/session.rs @@ -558,12 +558,11 @@ impl Session { /// A source told the server's unique id. The gateway's wins: its /// history is the one synced. `true` if the history key changed. fn learn_server_uid(&mut self, uid: String, from: Source) -> bool { - if from != Source::Gateway && self.gateway_client.is_some() { - return false; - } + let gateway_key = self.state.server_uid.clone().filter(|_| self.gateway_client.is_some()); + let keep = from != Source::Gateway && gateway_key.is_some(); if from != Source::Query { let aliases = self.aliases.clone(); - let key = uid.clone(); + let key = gateway_key.filter(|_| keep).unwrap_or_else(|| uid.clone()); self.history.current().run_then( self.memory(), move |s| aliases.iter().try_for_each(|a| s.set_server_alias(a, &key)), @@ -574,7 +573,7 @@ impl Session { }, ); } - if self.state.server_uid.as_deref() == Some(uid.as_str()) { + if keep || self.state.server_uid.as_deref() == Some(uid.as_str()) { return false; } self.state.server_uid = Some(uid);