Skip to content

[Bug]: Session-switch data merging / cross-contamination — can't switch chats cleanly #65005

Description

@bgexpert

Description

When switching between two existing chat sessions in Hermes Desktop, data from one session bleeds into the other ("data merging bug"). It is not possible to switch between chats cleanly / simultaneously — the context or draft/state of one session gets pulled into the other, so the two sessions appear to share or merge state.

This looks related to the session-state integrity class (see #63210 composer draft race and the project-association-loss bug): the per-session state bucket is not being isolated correctly on switch.

Root cause (hypothesis)

The active-session state object is shared/mounted before the target session's state is fully hydrated, so the previous session's state remains attached. If the composer/state API mounts in a stale-session context (same class of bug as getState()-returns-null in #63210, but here the bug is the wrong state rather than null), switching carries the old session's data forward instead of swapping to the new one.

Steps to reproduce

  1. Open Hermes Desktop with at least two existing chat sessions that have distinct content/context.
  2. Switch from session A to session B (via the sidebar / session list).
  3. Observe whether session B shows any data, drafts, or context that belongs to session A, or whether the two appear merged.
  4. Switch back and forth — note if the contamination persists or chains.

Expected

Each session switch should fully swap to the target session's isolated state, with no carry-over from the previously active session.

Environment

  • OS: Windows 10 64-bit
  • Hermes: 0.18.2 (win-unpacked)

Possible fix direction

Ensure the session-state bucket is keyed strictly per-session id and that the switch handler awaits full teardown of the old state before mounting the new one (await hydration before binding the composer/state API, mirroring the fix direction in #63358 but for the switch path, not only new-session).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/desktopElectron desktop app (apps/desktop/*)needs-reproBug needs reproduction stepssweeper:implemented-on-mainSweeper: behavior already present on current mainsweeper:risk-session-stateSweeper risk: may lose/corrupt/mis-associate session or context statetype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions