Skip to content

Toggling the chat in a new tab moves the existing session instead of creating one #302

Description

@schmoelder

Behaviour. Toggling the chat in a tab that shows no widget moves the most recent session out of the tab it was in, leaving that tab empty. Toggle can therefore never produce a second session, so every tab ends up showing the same conversation.

Expected. A new session for that tab, as before #297, when the tabpage-keyed registry created one for any tab that had none.

Repro.

  1. Open the chat in tab A.
  2. :tabnew.
  3. Toggle the chat in tab B.

Tab B shows session 1, tab A is empty, session count is still 1.

Cause. open/toggle resolve through current(), which falls back to _most_recent when nothing is visible in the current tab; show_session then moves it. The same fallback bites harder in create_with_current_session_guard: from a tab with no widget, the keep-or-destroy prompt is about a session in a different tab, and "destroy" kills it there.

new_session() still creates correctly, but it is not the key you reach for to open the chat and has no default keymap.

Not asking for one-conversation-per-tab back. Removing that limit did not require removing per-tab creation, and both went at once. Should open/toggle create when visible_here() is nil? I have a failing test if useful.

Found while rebasing #267 onto main; the reconnect path there needs rework for the same concurrent-session model, which I will follow up on in that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions