feat(matrix): log message-handler firing + wake delivery to localise the no-wake bug

This commit is contained in:
damocles 2026-06-06 09:04:32 +02:00 committed by mara
commit b7529f2e00

View file

@ -34,12 +34,29 @@ pub fn install_message_handler(client: &Client, hyperhive_socket: PathBuf) {
let socket = socket.clone();
let own_user = own_user.clone();
async move {
// INFO so the live host journal shows the handler actually
// firing on an incoming event — the daemon previously logged
// only handler *install*, which made a non-firing dispatch
// path (sync not advancing → events deduped, or a room-state
// mismatch) impossible to distinguish from a delivery failure.
tracing::info!(
room = %room.room_id(),
sender = %event.sender,
state = ?room.state(),
"matrix: message handler fired"
);
if room.state() != RoomState::Joined {
tracing::info!(
room = %room.room_id(),
state = ?room.state(),
"matrix: skipping message — room not in Joined state"
);
return;
}
// Self-event filter so the agent's own outgoing messages
// don't wake it. matches forge_notify's self-skip pattern.
if own_user.as_ref().is_some_and(|u| u == &event.sender) {
tracing::debug!(sender = %event.sender, "matrix: skipping self-event");
return;
}
// Build a wake body that covers all rooms with unread
@ -68,7 +85,7 @@ pub fn install_message_handler(client: &Client, hyperhive_socket: PathBuf) {
if let Err(e) = wake::send_wake(&socket, &body).await {
tracing::warn!(error = %e, "failed to deliver matrix wake to hyperhive");
} else {
tracing::debug!(room = %room.room_id(), "matrix wake delivered");
tracing::info!(room = %room.room_id(), "matrix wake delivered");
}
}
}