Skip to content

fix(desktop): refresh active session for external messages - #53592

Closed
yungchentang wants to merge 1 commit into
NousResearch:mainfrom
yungchentang:fix/desktop-active-session-refresh-53563
Closed

fix(desktop): refresh active session for external messages#53592
yungchentang wants to merge 1 commit into
NousResearch:mainfrom
yungchentang:fix/desktop-active-session-refresh-53563

Conversation

@yungchentang

Copy link
Copy Markdown
Contributor

Summary

Fixes #53563.

Hermes Desktop now reacts when the currently open persisted session row is refreshed with additional externally appended messages. This covers Signal/gateway sessions whose sidebar metadata updates while the active chat timeline still has an older transcript loaded.

Root cause

The messaging sidebar slice used an id/title-only equality check, so Signal rows whose last_active, message_count, or preview changed could keep the same atom reference. Even when the session list refreshed, the active chat state did not observe that metadata change and did not rehydrate the open transcript.

Changes

  • Add useActiveSessionExternalRefresh to watch the selected stored session row across recents and messaging slices.
  • Hydrate the active runtime session when the refreshed persisted row has more messages than the in-memory transcript and the runtime is idle.
  • Use a fuller messaging row signature so external metadata changes update the messaging session atom.
  • Let stored-session hydration resolve profile metadata from messaging sessions as well as local recents.
  • Add focused jsdom regression coverage for external Signal-style row updates, busy-runtime skips, and metadata-only updates.

Validation

  • npm run test:ui -- use-active-session-external-refresh.test.tsx use-session-state-cache.test.tsx
  • npm run typecheck
  • npx eslint src/app/desktop-controller.tsx src/app/session/hooks/use-active-session-external-refresh.ts src/app/session/hooks/use-active-session-external-refresh.test.tsx
  • npx prettier --check src/app/desktop-controller.tsx src/app/session/hooks/use-active-session-external-refresh.ts src/app/session/hooks/use-active-session-external-refresh.test.tsx
  • git diff --cached --check

@yungchentang
yungchentang force-pushed the fix/desktop-active-session-refresh-53563 branch from 09dbdb9 to d5d92b4 Compare June 27, 2026 11:15
@yungchentang
yungchentang marked this pull request as ready for review June 27, 2026 11:16
@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state P3 Low — cosmetic, nice to have labels Jun 27, 2026
@yungchentang yungchentang changed the title [codex] fix desktop active session refresh for external messages fix(desktop): refresh active session for external messages Jun 27, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Desktop investigation and regression coverage.

Automated hermes-sweeper review found that the requested behavior is already implemented on current main:

  • 52d0d671e79ec1d5727881a6e8519332d04c1a07 (fix(desktop): poll messaging sessions so platform traffic appears live) updates messaging row comparison to include preview, message_count, and last_active, and is included in v2026.7.7.
  • apps/desktop/src/app/desktop-controller.tsx:547 reloads persisted messages for the active messaging session and publishes them only when the transcript signature changed.
  • apps/desktop/src/app/desktop-controller.tsx:926 polls the visible active messaging transcript every five seconds and refreshes immediately on activation/visibility changes.

This satisfies the Signal/gateway externally appended-message case described here, without needing the PR's older hook-based implementation.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 2026
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/*) P3 Low — cosmetic, nice to have sweeper:implemented-on-main Sweeper: behavior already present on current main 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.

Desktop chat timeline does not refresh externally appended gateway/Signal messages

3 participants