Skip to content

fix(desktop): poll messaging sessions so platform traffic appears live - #57636

Merged
OutThisLife merged 3 commits into
mainfrom
bb/desktop-messaging-poll
Jul 3, 2026
Merged

fix(desktop): poll messaging sessions so platform traffic appears live#57636
OutThisLife merged 3 commits into
mainfrom
bb/desktop-messaging-poll

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Supersedes #45677 — ported to main after the desktop refactor split refreshMessagingSessions and related infrastructure into use-session-list-actions.ts.

Problem

Inbound Telegram / WeChat / Discord messages are written by the background gateway, not the desktop WebSocket that drives local chats. Without explicit polling the messaging sidebar and the open transcript stay frozen until the user manually navigates away and back.

Changes

Desktop:

  • MESSAGING_POLL_INTERVAL_MS (10 s) — interval poll of the messaging session list while connected + visible, so new platform sessions surface automatically.
  • ACTIVE_MESSAGING_SESSION_POLL_INTERVAL_MS (5 s) — poll the currently-viewed messaging transcript and re-hydrate when the FNV-1a content signature changes.
  • sameCronSignature extended to compare lineage_root_id / source / profile / preview / message_count / last_active / ended_at — stale previews and timestamps were silently ignored before.
  • refreshMessagingSessions exported from useSessionListActions so the controller can use it in the poll effect.

Gateway:

  • _compression_tip_for_session_id — DB lookup for the latest compression continuation, outside the lock.
  • _heal_compression_tip_locked — rewrites a stale SessionStore entry to the compression child so a restart or failed send no longer leaves the mapping pinned to the compressed parent.

Tests

  • npm --workspace apps/desktop run typecheck
  • pytest tests/gateway/test_restart_resume_pending.py::TestGetOrCreateResumePending::test_resume_pending_follows_compression_tip

Co-authored-by: lawyer112 lawyer112@users.noreply.github.com

Inbound Telegram/WeChat/Discord messages are written by the background
gateway, not the desktop websocket that drives local chats. Without
explicit polling the messaging sidebar and the open transcript stay
frozen until the user manually refreshes.

Desktop:
- MESSAGING_POLL_INTERVAL_MS (10 s): interval poll of the messaging
  session list so new platform sessions surface automatically.
- ACTIVE_MESSAGING_SESSION_POLL_INTERVAL_MS (5 s): poll the currently-
  viewed messaging transcript and re-hydrate the chat state when the
  FNV-1a signature changes (hash covers role + timestamp + content).
- sameCronSignature now compares lineage_root_id / source / profile /
  preview / message_count / last_active / ended_at so stale previews
  and activity times are no longer silently ignored.
- sessionMatchesStoredId helper de-dups the id / _lineage_root_id check.
- refreshMessagingSessions exposed from useSessionListActions so the
  controller can use it in the poll effect.

Gateway:
- SessionStore._compression_tip_for_session_id: look up the latest
  compression continuation for a session id.
- SessionStore._heal_compression_tip_locked: rewrite a stale entry to
  the compression child before returning it, so a restart or failed send
  no longer leaves the store pinned to the compressed parent.

Co-authored-by: lawyer112 <lawyer112@users.noreply.github.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) comp/gateway Gateway runner, session dispatch, delivery sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state P3 Low — cosmetic, nice to have labels Jul 3, 2026
…sion

The active-transcript poll armed a 5 s timer for every selected session
and no-op'd inside the tick for local chats (already live over the
websocket). Derive activeIsMessaging and gate the effect on it so local
chats never spin an idle timer.
The routing-heal added to get_or_create_session calls
SessionDB.get_compression_tip; the stale-guard suite's bare MagicMock db
returned a Mock the heal then assigned as session_id, failing JSON
serialization. Model the real contract (a non-compressed session's tip is
itself) so the heal is a correct no-op.
@OutThisLife
OutThisLife merged commit 662426e into main Jul 3, 2026
36 checks passed
@OutThisLife
OutThisLife deleted the bb/desktop-messaging-poll branch July 3, 2026 10:05
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…ssaging-poll

fix(desktop): poll messaging sessions so platform traffic appears live
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…ssaging-poll

fix(desktop): poll messaging sessions so platform traffic appears live
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…ssaging-poll

fix(desktop): poll messaging sessions so platform traffic appears live
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…ssaging-poll

fix(desktop): poll messaging sessions so platform traffic appears live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants