Skip to content

tui: archived sessions still appear in the session picker (Ctrl+O) #58364

Closed

Description

@AlexeyShirshov

Description

Archiving a session has no visible effect in the TUI: the session keeps showing up in the Ctrl+O session picker, indistinguishable from active ones, and selecting it opens it normally.

The API already has the filter — GET /api/session?archived=false returns no archived sessions — but the client lists them anyway, so "archive" cannot be used to keep the session list tidy. Today the only way to get an archived session out of the list is to delete it.

Plugins

Local CLI plugins (clear-session, git-status, sidebar-plugins) plus wsl-notify, opencode-roslyn, superpowers, btw-context, zen-failover.

The problem does not depend on them: it is visible from the API alone, and the stock Ctrl+O dialog renders the archived rows it receives.

OpenCode version

2.1.3

Steps to reproduce

  1. Create a session and send any prompt.
  2. Archive it:
    opencode api patch /api/session/<sessionID> --data '{"archived":true}'
  3. Confirm the flag is stored:
    opencode api get '/api/session?limit=50' | jq -r '.data[] | select(.time.archived) | "\(.id)  \(.title)  archived=\(.time.archived)"'
  4. Confirm the server-side filter works:
    opencode api get '/api/session?limit=50&archived=false' | jq '[.data[] | select(.time.archived)] | length'
    # 0
  5. Open the TUI and press Ctrl+O, then search for the session title: the archived session is listed and opens.

Expected Behavior

Archived sessions are hidden from the session picker by default (the same rows that ?archived=false removes), or at least marked as archived so they are distinguishable from active ones.

Actual Behavior

The archived session is listed like any active session and opens on select.

Additional Context

Evidence on 2.1.3 (Linux, WSL2):

$ opencode api get '/api/session?limit=50' | jq -r '.data[] | select(.time.archived) | ...'
ses_e98bca318ffexGreoXd6JqV5Sd  Greeting  archived=1792733839425
ses_ebf348006ffea85OfCCyiyNU5D  Ping      archived=1792733733726
ses_ebf34e8b5ffey1qe8UBcJgoOnp  Ping      archived=1792733716640

$ opencode api get '/api/session?limit=50&archived=false' | jq '[.data[] | select(.time.archived)] | length'
0

So the archived rows are returned by GET /api/session without the archived parameter, and the picker renders them as-is.

Related attempts, all closed without merge (they targeted the per-project server query, not the client):

Operating System

Ubuntu on WSL2 (Linux 6.18.33.2-microsoft-standard-WSL2, x64)

Terminal

Windows Terminal, TERM=xterm-256color, bash

Activity

  1. opencode-agent commented on Oct 23, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the API checks, @AlexeyShirshov.

    You're asking for the TUI's Ctrl+O picker (and the session list) to hide archived sessions by default, or at least mark them, the same way GET /api/session?archived=false does. That would make archiving useful for keeping the list tidy.

    I checked the code: the server supports the filter, and the desktop/web app already hides archived sessions. The v2 TUI doesn't support archiving at all yet. It has no archive action, and its session queries (dialog-open.tsx, dialog-session-list.tsx) don't filter by archived. So this works as currently built, and I've filed it as a feature request: adding archive support to the TUI. Maintainers will consider it.

    Related issues:

  2. AlexeyShirshov commented on Oct 23, 2026

    @AlexeyShirshov
    Author

    Some numbers from a real 2.1.3 setup (Linux/WSL2) to size the impact.

    Scale

    • 9,527 sessions, 53 distinct project directories, 6 archived
    • average 180 sessions per directory (median 4, the distribution is skewed): ~/sources/nextorm 6,758 · ~/sources/webpdca 1,323 · ~/sources/opencode-config 625 · ~/sources/skills 147
    • 249 sessions created in the last 24 h, 2,158 in the last 7 days; history spans 2026-09-14 → 2026-10-23
    • store size: ~/.local/share/opencode/opencode.db ≈ 11.0 GiB, i.e. ~1.2 MB per session on average

    Why the missing filter hurts navigation

    • The Ctrl+O dialog renders a recent-sessions window: 8 rows fit on screen and the rest are reached by scrolling. With 9,527 sessions and ~249 new ones per day, that window covers only a few hours of work — anything older is found by typing a search term only.
    • Archived sessions are returned by GET /api/session and sit inside that window unmarked. In the current list, 2 of the ~8 visible rows were archived "Ping" sessions — indistinguishable from active ones. Selecting one silently reopens it, so it is easy to continue work in a session you believed was closed.
    • Archiving bumps time.updated, so it moves the session to the top of the recency window instead of out of it. Today archiving makes the list worse, not better:
    $ opencode api get '/api/session?limit=50' | jq -r '.data[] | select(.time.archived) | "\(.id)  \(.title)  updated=\(.time.updated) archived=\(.time.archived)"'
    ses_ebf348006ffea85OfCCyiyNU5D  Ping  updated=1792733733726 archived=1792733733726
    ses_ebf34e8b5ffey1qe8UBcJgoOnp  Ping  updated=1792733716640 archived=1792733716640
    

    (updated == archived for both — they were archived minutes ago and are now at the top.)

    Suggestion

    1. Pass archived=false by default in dialog-open.tsx / dialog-session-list.tsx (the server filter already exists).
    2. Or keep them but mark the rows as archived and add a "show archived" toggle.
    3. Add an archive action to the picker so the flag can actually be set without the API.

    Happy to test a build against this dataset.

  3. simPod commented on Oct 29, 2026

    @simPod

    Confirmed on OpenCode 2.2.0 (release), macOS arm64, iTerm2, zsh. Read-only checks of the picker query returned 15 archived sessions among 50; adding archived=false returned zero archived sessions. Both project and all-project queries included a known archived root.

    The 2.2.0 picker source omits that filter and also leaves archived sessions in its local fallback. This blocks migration of file archives even when they are imported already archived.

    Verification was through live API and source inspection, not a new interactive TUI reproduction. No sessions were imported or changed.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions