Skip to content

[Desktop] Session list is not updating when switching between projects #12262

Closed

Description

@sengtech

Description

The session list is not updating when switching between projects

Plugins

No response

OpenCode version

Desktop Version 1.1.51 (1.1.51)

Steps to reproduce

Switch between projects

Screenshot and/or share link

Image Image

Operating System

macOS 26.2

Terminal

No response

Activity

  1. github-actions commented on Feb 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. benoitheinrich commented on Feb 17, 2026

    @benoitheinrich

    Hi! I’m seeing what looks like a Web UI-only session list scoping/refresh bug after upgrading OpenCode 1.2.5 -> 1.2.6.

    Environment

    • OpenCode: 1.2.6
    • OS: Linux
    • Storage: SQLite at ~/.local/share/opencode/opencode.db
    • Important: Sessions show correctly in the TUI, but not in the Web UI.

    My setup / workflow

    • I start OpenCode Web from a “neutral” directory (not inside a repo), e.g. ~/safe:
      • opencode web
    • In the Web UI, I then select/navigate to various projects.
    • One of those projects is a git repo that uses multiple git worktrees:
      • main repo: ~/dev/sfp-3pl-approval
      • worktrees live under: ~/dev/_wt/sfp-3pl-approval-*
    • Each worktree directory has its own sessions historically, and Web UI used to show them.

    Problem

    After upgrading to 1.2.6, when I’m in the Web UI and select the ~/dev/sfp-3pl-approval project:

    • the Web UI session list shows only 1 (or almost none) of the existing sessions
    • BUT the TUI/CLI still lists all the sessions correctly, including those in the worktree directories

    So sessions don’t seem lost—Web UI just isn’t showing them.

    Repro steps

    1. Start web server from a directory outside the project:
      • opencode web (started from ~/safe)
    2. In the web UI, select project ~/dev/sfp-3pl-approval
    3. Observe the session list (nearly empty / missing lots of sessions)
    4. Compare with TUI/CLI:
      • (cd ~/dev/sfp-3pl-approval && opencode session list -n 50)
      • sessions appear as expected there

    Evidence: sessions exist in DB for the worktree directories

    These show that many sessions exist for the repo + worktrees:

    opencode db "SELECT COUNT(*) AS n, directory FROM session WHERE directory LIKE '%sfp-3pl-approval%' GROUP BY directory ORDER BY n DESC;"
    

    Example output (abridged):

    • ~/dev/sfp-3pl-approval -> lots of sessions
    • ~/dev/_wt/sfp-3pl-approval-... -> lots of sessions

    Also, opencode debug scrap shows the repo worktree plus sandboxes (worktrees) are known:

    opencode debug scrap
    

    Additional clue: duplicate project rows for the same worktree path

    In my DB there are two project rows with the same worktree path (~/dev/sfp-3pl-approval) but sessions are mostly associated to one of the two project_ids.

    opencode db "SELECT id, worktree, time_updated FROM project WHERE worktree LIKE '%/sfp-3pl-approval' ORDER BY time_updated DESC;"
    opencode db "SELECT project_id, COUNT(*) AS n FROM session WHERE directory LIKE '%/dev/_wt/sfp-3pl-approval-%' GROUP BY project_id ORDER BY n DESC;"
    

    It looks like Web UI might be picking the “wrong” project id (the one with very few sessions), so the list looks empty.

    Expected

    When selecting a project in Web UI, session list should include all sessions for that project/worktree + its worktree sandboxes (as it did previously), consistent with the TUI.

    Actual

    Web UI shows almost none, while TUI shows all.

    If you want, I can provide more DB queries / a minimal DB snapshot (sanitized) or run with debug logging.

  3. benoitheinrich commented on Feb 18, 2026

    @benoitheinrich

    Follow-up: I think this is not only a “project switch doesn’t refresh” issue in my case — it’s a Web UI sidebar scoping/filtering issue that hides worktree/sandbox sessions.

    What I’m seeing

    • OpenCode: 1.2.6 (Linux)
    • Sessions exist and are visible via TUI/CLI and via the web server API
    • Web UI sidebar only shows sessions for the current directory (e.g. repo root), and hides sessions whose session.directory is a different worktree/sandbox directory.

    Server API proof: roots exist across multiple directories (repo + worktrees)

    When I query the server in the repo context, GET /session?roots=true returns root sessions whose directory spans multiple worktree dirs:

    curl -fsS \
      -H "x-opencode-directory: /home/USER/dev/REPO" \
      "http://127.0.0.1:4096/session?roots=true&limit=1000" \
    | jq -r '[.[].directory] | group_by(.) | map({dir:.[0], count:length}) | sort_by(.count) | .[] | "\(.count)\t\(.dir)"'

    Example output shape (counts vary, but note multiple directories):

    28  /home/USER/dev/REPO
    8   /home/USER/dev/_wt/REPO-WT-1
    2   /home/USER/dev/_wt/REPO-WT-2
    ...
    

    So the backend can return root sessions for worktree dirs when in the repo project context.

    Frontend proof: Web sidebar filters to current directory only

    I inspected the downloaded web bundle and found two key pieces:

    1) Session list request is directory-scoped + roots-only

    async function oX(t){
      try {
        return {
          data: (await t.list({ directory: t.directory, roots: !0, limit: t.limit })).data,
          limited: !0
        }
      } catch {
        return t.onFallback(), {
          data: (await t.list({ directory: t.directory, roots: !0 })).data,
          limited: !1
        }
      }
    }

    2) Sidebar list filters sessions to session.directory === currentDirectory (+ root + unarchived)

    const Xle = (s, dir) =>
      normalize(s.directory) === normalize(dir) &&
      !s.parentID &&
      !s.time?.archived;
    zl = (t, now) =>
      t.session
       .filter(s => Xle(s, t.path.directory))
       .sort(sortByRecent(now));

    This exact directory equality check seems to be why sessions from worktree/sandbox directories are not shown when I’m “in” the repo root directory, even though the server can return them.

    Expected behavior (for worktree/sandbox repos)

    When a project has sandboxes/worktrees, the sidebar should either:

    • include root sessions across all sandbox/worktree directories (grouped by directory), or
    • offer a toggle: This directory vs Whole project (incl. sandboxes/worktrees).
      If you’d prefer, I can open a separate issue focused specifically on “Web sidebar hides worktree/sandbox sessions due to directory-equality filter” and cross-link it here — but wanted to add the concrete repro + snippets first.
  4. benoitheinrich commented on Feb 18, 2026

    @benoitheinrich

    In fact, I believe what I'm experiencing is a really a different issue, so I'll be opening a new ticket and put the details above there.

  5. benoitheinrich commented on Feb 18, 2026

    @benoitheinrich

    Created #14082

  6. github-actions commented on Apr 20, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwebRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions