Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): acknowledge the room join that actually happened

Shanufd6c528bf5d0
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index 2ead912adb..92d8f1e168 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -6728,7 +6728,7 @@ const messages: TranslationMap = {
'userErrors.scope.chat': 'Chat',
'userErrors.replyDeliveryFailed.title': 'Impossible d’afficher la réponse',
'userErrors.replyDeliveryFailed.body':
- 'L’agent a terminé ce tour, mais sa réponse n’a pas pu être enregistrée ni relue. Redemande-lui de la répéter.',
+ 'L’agent a terminé ce tour, mais sa réponse n’a pas pu être enregistrée ni récupérée. Redemande-lui de la répéter.',
'userErrors.memoryStoreCorrupt.title': 'L’index mémoire a été corrompu',
'userErrors.memoryStoreCorrupt.body':
'La base de données de l’arbre mémoire était endommagée. Le fichier endommagé a été conservé à côté de vos données mémoire et un index vide a été reconstruit. Resynchronisez vos sources mémoire pour le remplir à nouveau.',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 3e032f8bf4..fde717d9f8 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -6682,7 +6682,7 @@ const messages: TranslationMap = {
'userErrors.scope.chat': 'Chat',
'userErrors.replyDeliveryFailed.title': 'Impossibile mostrare la risposta',
'userErrors.replyDeliveryFailed.body':
- 'L’agente ha completato questo turno, ma la sua risposta non è stata salvata né rilette. Chiedi di nuovo per fartela ripetere.',
+ 'L’agente ha completato questo turno, ma la sua risposta non è stata salvata né riletta. Chiedi di nuovo per fartela ripetere.',
'userErrors.memoryStoreCorrupt.title': 'L’indice della memoria era corrotto',
'userErrors.memoryStoreCorrupt.body':
'Il database dell’albero della memoria era danneggiato. Il file danneggiato è stato conservato accanto ai tuoi dati di memoria ed è stato ricostruito un indice vuoto. Risincronizza le tue fonti di memoria per riempirlo di nuovo.',
diff --git a/src/core/socketio.rs b/src/core/socketio.rs
index b5f6910ffb..2efa67f297 100644
--- a/src/core/socketio.rs
+++ b/src/core/socketio.rs
@@ -492,7 +492,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
log::info!("[socketio] client connected id={client_id} (authenticated)");
// Join a room named after the client ID for targeted event delivery.
- join_room_logged(&socket, &client_id, &client_id);
+ let _ = join_room_logged(&socket, &client_id, &client_id);
// Also auto-join the "system" room so every connected client
// receives broadcast-style events that aren't tied to a
// specific chat thread. Today this covers proactive messages
@@ -501,7 +501,7 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
// emits with `client_id = "system"` — see `emit_web_channel_event`.
// If this join fails the welcome message silently disappears,
// so we log both success and failure for diagnosability.
- join_room_logged(&socket, "system", &client_id);
+ let _ = join_room_logged(&socket, "system", &client_id);
let ready_payload = json!({ "sid": client_id });
log::debug!("[socketio] emit event=ready to_client={}", socket.id);
let _ = socket.emit("ready", &ready_payload);
@@ -699,8 +699,12 @@ pub fn attach_socketio() -> (socketioxide::layer::SocketIoLayer, SocketIo) {
return;
}
let room = format!("thread:{thread_id}");
- join_room_logged(&socket, &room, &socket.id.to_string());
- ack.send(&ThreadSubscribeAck { joined: true }).ok();
+ // Report what actually happened. Acknowledging a join that
+ // failed is worse than not acknowledging at all: the client
+ // stops queueing the thread for retry and reads on the
+ // strength of a room it is not in.
+ let joined = join_room_logged(&socket, &room, &socket.id.to_string());
+ ack.send(&ThreadSubscribeAck { joined }).ok();
},
);
},
@@ -1385,11 +1389,23 @@ pub(crate) fn channel_connection_update_payload(
/// so both the happy and error paths are logged with enough context
/// (room name + client id) to diagnose missing welcome messages from
/// logs alone.
+///
+/// Returns whether the socket is actually in the room. Callers that only log
+/// may ignore it; a caller that *tells the client* it joined must not — a
+/// client told it is in a room it never joined reads the thread, waits for
+/// events that will never be routed to it, and reproduces the invisible-reply
+/// bug this room exists to prevent (#6034).
#[cfg(feature = "http-server")]
-fn join_room_logged(socket: &SocketRef, room: &str, client_id: &str) {
+fn join_room_logged(socket: &SocketRef, room: &str, client_id: &str) -> bool {
match socket.join(room.to_string()) {
- Ok(()) => log::debug!("[socketio] joined room '{room}' for client {client_id}"),
- Err(e) => log::warn!("[socketio] failed to join room '{room}' for client {client_id}: {e}"),
+ Ok(()) => {
+ log::debug!("[socketio] joined room '{room}' for client {client_id}");
+ true
+ }
+ Err(e) => {
+ log::warn!("[socketio] failed to join room '{room}' for client {client_id}: {e}");
+ false
+ }
}
}