Skip to content

fix(desktop): clear stale session bubbles and busy state on new chat - #39211

Open
Morad37 wants to merge 1 commit into
NousResearch:mainfrom
Morad37:fix/39086-stale-session-rows
Open

fix(desktop): clear stale session bubbles and busy state on new chat#39211
Morad37 wants to merge 1 commit into
NousResearch:mainfrom
Morad37:fix/39086-stale-session-rows

Conversation

@Morad37

@Morad37 Morad37 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

After #37975, a newly-started chat could visually show stale user bubbles and red session busy errors from another live session. This was render contamination, not model-context contamination — the assistant in the new chat ignored the stale visuals.

Two changes:

  1. startFreshSessionDraft now clears workingSessionIds and attentionSessionIds, so background sessions that were still working when navigated away from don't persist as running rows in the new chat.
  2. Added a guard in the session cache update to only update global working/attention atoms when the session is the currently-viewed one. Background sessions update their own cache entry but can't re-add themselves to the sidebar indicators after being cleared.

Fixes #39086

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 4, 2026
@alt-glitch alt-glitch added comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state and removed comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Jun 26, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the new-chat/session-state interaction. The transcript-bleed portion is already guarded on current main, but the proposed status handling conflicts with the current background-session model.

Problems

  • use-session-state-cache.ts on current main intentionally records working and attention state for every session at apps/desktop/src/app/session/hooks/use-session-state-cache.ts:263-271; sidebar rows consume those atoms at apps/desktop/src/app/chat/sidebar/index.tsx:252,342 and apps/desktop/src/app/chat/sidebar/session-row.tsx:80.
  • The active-session-only update proposed here would therefore hide legitimate background work and clarify prompts. Commit 3c163cb0353c6dc5e0b5278998e721368ed71a68 introduced the persistent background needs-input indicator for that purpose.
  • Current foreground isolation is already enforced at apps/desktop/src/app/session/hooks/use-session-state-cache.ts:176-189, which rejects background state before it reaches the shared view.

Suggested changes

  • Re-scope around a reproducible stale-ID lifecycle issue, preserving indicators for genuinely live background sessions.
  • Add a regression covering a fresh draft while a separate session remains busy or needs input.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/sessions Session lifecycle, resume, persistence, history labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades 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: stale user bubbles/session busy rows can still render in a new chat after #37975

3 participants