Skip to content

tui: /sessions no longer focuses the current session #63954

In progress

Description

@dreamorosi

Summary

Since v2.3.0, /sessions opens with the top session highlighted instead of the current one (f5ca39a97d, focusCurrent={false} in dialog-session-list.tsx). Please revert this, or add a setting to open the list on the current session.

For me this change has caused data loss. I used to close a session with /sessions and then ctrl+d twice. Now that deletes whatever is at the top of the list. I lost 4 sessions in one day before I worked out what was happening. Deleting is permanent, and the confirmation step doesn't help once pressing the key twice is a habit.

Environment

  • opencode version: 2.3.0 (latest)
  • OS: Ubuntu, Linux 7.0.0 aarch64
  • Terminal: rex (xterm-256color, truecolor)
  • Shell: zsh

Reproduction

  1. Open a session that isn't the most recent one in the list.
  2. Run /sessions.
  3. Press ctrl+d twice.

Expected Behavior

The current session is highlighted when the list opens, as it was before v2.3.0, so the delete action applies to it. Alternatively, a cli.json option such as session.list_focus: "current" | "top" would let users choose.

Actual Behavior

The first session in the list is highlighted, and that session gets deleted.

Additional Context

The commit has no linked PR. The changelog lists it as a bug fix ("Session lists now open at the top rather than at the current session"), so I'm not sure what problem it solved. If opening at the top should stay the default, an option to restore the old behavior would be enough.

Activity

  1. opencodejr commented on Nov 14, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report, and sorry about the lost sessions.

    You're asking for /sessions to open on the current session again, either by reverting f5ca39a or with an option to choose between the current session and the top of the list. I'm labelling this as a feature request rather than a bug. The change was made on purpose in v2.3.0: the changelog lists it as "Session lists now open at the top rather than at the current session.", and the dialog now sets focusCurrent={false}. ctrl+d acts on the highlighted row, so the press-twice habit you describe now deletes the top session. Maintainers will look at the request and take that risk into account. I can't promise what they will decide.

    Until then, check which row is highlighted before pressing ctrl+d the second time; that row is the one that gets deleted.

    Related:

  2. added
    area/tui
    type/feature
    version/v2
    on Nov 14, 2026
  3. gotenksIN commented on Nov 14, 2026

    @gotenksIN
    Contributor

    Hitting this exact same issue on v2.3.0 (Linux).

    I have also lost a few sessions to this because of muscle memory—running /session inside an active session and immediately hitting ctrl+d twice deletes whatever sits at the top of the list instead of the session I was in. Since the active session still gets the ● dot while the highlight sits on row 1, it is very easy to miss before confirming.

    Please either revert f5ca39a97d (focusCurrent={false} in packages/tui/src/component/dialog-session-list.tsx) or add a config option to pre-select the current session when opening the picker.

  4. uriva commented on Nov 16, 2026

    @uriva

    +1 on reverting this (or adding a config toggle). Using ctrl+x l to rename (ctrl+r) or delete (ctrl+d) the current session is way harder now because you have to go hunt for your active session in the list first instead of acting on it directly.

  5. Bearmancer commented on Nov 20, 2026

    @Bearmancer

    Triage update (2026-11-20) — version gate on the latest release, a Windows report, and one question for maintainers

    Version gate: still shipping. On v2.3.2 — the newest v2 release, published 2026-11-18 — the picker still passes focusCurrent={false} (dialog-session-list.tsx L219), and the same line is still at the same spot on the dev tip as of this comment. No open PR changes this behavior.

    Mechanism, confirmed at v2.3.2 (c0ad18b402eb2827fc1ee71c171b1177b3fc02d1):

    • The list store initializes with selected: 0 (dialog-select.tsx L151-L152), the branch that would move the selection to the current session is guarded by props.focusCurrent !== false (L313), and the effect that recenters on the current session returns early when focusCurrent === false (L398). So opening /sessions leaves the highlight on the top row, not the active session.
    • ctrl+d is the default binding for session.delete (keybind.ts L124).
    • Inside the picker, session.delete acts on the highlighted row: the first press arms it (setToDelete(option.value)), the second press calls session.remove on that row's id (dialog-session-list.tsx L263-L288). The arm resets only when the highlight moves first, so the old /sessions + ctrl+d, ctrl+d habit deletes the top session instead of the one you were in.

    New environment (third platform reported here). Windows 10 Pro, NT 10.0.19045, win32 x64; opencode v2.3.2 (latest channel); terminal xterm-256color. Observed: opening /sessions from an active chat does not pre-select that chat, and the destructive default ctrl+d then sits one confirm away from the wrong row. The two data-loss reports above are Linux — the mechanism is core TUI code with no platform path, so the risk carries to Windows unchanged. (The reporter's install has unrelated third-party TUI plugins active; every citation above is core source.)

    Question for maintainers. Opening at the top was a deliberate v2.3.0 change and this thread asks for a revert or a config toggle, so this needs a decision rather than more evidence: given that the picker's ctrl+d deletes the highlighted row and the two-press confirm arms on the top row the moment the dialog opens, do you consider that safe as the default, or should the session picker pre-focus the current session (revert focusCurrent={false}, or a session.list_focus: "current" | "top"-style setting) while other lists keep the new open-at-the-top behavior?

    This was generated by AI during triage.

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

    area/tuiplatform/linuxtype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions