Skip to content

Web Home hides global-project sessions (empty list for sessions created outside git repos) #46444

Closed as not planned

Description

@PRz-BigJ

Description

When I start the web UI with opencode web --hostname 0.0.0.0 --port 4096 from a directory that is not a git repo (my Windows home directory, C:\Users\Raphael), the Home page shows an empty session list ("Nothing here yet"), even though the CLI lists dozens of sessions:

  • opencode session list returns all my sessions
  • GET /session via the API returns them too
  • the SQLite DB (~/.local/share/opencode/opencode.db) contains them

Steps to reproduce

  1. Open opencode from C:\Users\Raphael (not inside a git repo)
  2. Create several sessions there (I have ~21 tied to non-git directories: C:/, C:/Users/Raphael, I:/Projetos)
  3. Run opencode web --hostname 0.0.0.0 --port 4096 from the same directory
  4. Open http://localhost:4096 → Home is empty despite sessions existing

Root cause I traced

The Home page filters sessions by matching session.directory against each project's allowed directories (worktree + sandboxes) in packages/app/src/pages/home/home-sessions-controller.tsx:

const directories = new Set(input.projectDirectories().map(pathKey))
const sessions = input.sessions().filter((s) => directories.has(pathKey(s.directory)))

where projectDirectories() = [worktree, ...sandboxes].

Sessions created outside a git repo belong to the global project, whose worktree is forced to / in packages/opencode/src/project/project.ts (fromDirectory). That same code skips adding sandboxes for the global project:

if (projectID !== ProjectV2.ID.global && ...) result.sandboxes.push(data.directory)

So a session with directory = C:/Users/Raphael (or C:/, I:/Projetos) is compared against the global project's allowed set ["/"] and never matches → dropped from the Home list. In my DB: 21 global sessions across 3 real directories, 0 shown in the web UI; the only visible one is from a separate git project (Email-agent).

The CLI doesn't hit this because it lists by project_id, so all global sessions match.

I believe this is the same underlying problem as #27837 / #37096 / #45011 (CLI-created sessions invisible in web Home), reported from the angle of the global project worktree/sandbox mismatch.

Suggested fix

Treat the global project specially in home-sessions-controller.tsx (fall back to session.directory when no worktree/sandbox matches), or let fromDirectory accumulate sandboxes for the global project. Compare the TUI-only fix already shipped for the related /sessions issue (#29581 / #29582) which was never applied to the web Home.

A local workaround that unblocks me: manually set the global project's sandboxes column (JSON array) to my working directories so Home's directory filter matches them.

Plugins

No response

OpenCode version

1.18.20

Steps to reproduce

See above

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

Windows Terminal / PowerShell

Activity

  1. github-actions commented on Aug 31, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (e.g. specifically about the global project worktree/sandbox mismatch on non-git directories), please note that in a comment so maintainers can track it separately.

  2. SeashoreShi commented on Sep 1, 2026

    @SeashoreShi
    Contributor

    Working on this — fix targets the web Home filter: sessions belonging to the global project (created outside any git repo) are no longer dropped when their directory doesn't match the global project's / worktree. PR coming shortly.

  3. vstandos commented on Sep 6, 2026

    @vstandos

    Can reproduce on Linux (WSL2) with opencode web --hostname 0.0.0.0 started with cwd / — project global has worktree: "/".

    Confirmed server-side: GET /session?directory=/&roots=true&limit=55 and GET /api/session both return the session; it renders fine when opened via deep link (open-project?directory=/ even issues the correct request — the item is still filtered out of the list).

    Two additional data points:

    • The one property that differs between hidden and visible sessions in the same project is subpath: hidden = root session with empty path/subpath, visible = non-empty subpath (e.g. home/ssa). Suggests the list filter drops subpath === "".
    • PATCH /session/:id {"directory": "/home/ssa"} returns 200 and echoes the session but does not persist — legacy root sessions cannot be migrated into a visible project at all.

    Related: #42627 (desktop remote server), and note that Windows desktop clients send their own cwd as project directory to a Linux server (C:\\temp was stored server-side as /home/ssa/C:\\temp), which compounds the visibility problem.

  4. vstandos commented on Sep 6, 2026

    @vstandos

    Additional data point: same WSL server, and the desktop client shows the identical empty list — the session is only reachable via deep link there too, so this is not web-Home-only. Confirmed on v1.18.29 (latest release): GET /session?directory=/home/ssa&roots=true and /api/session return the session, the deep link renders it, and the item is still filtered out because global has worktree: "/" and no sandboxes. Note the session carries subpath: "home/ssa" even though the project root is / — for global-project sessions the session's own directory (or subpath) should arguably be sufficient membership for Home.
    PR #46520 looks like the right direction but remains unmerged; since the filter is shared, landing it should also close the duplicate reports #37096 / #42668. Until it merges, the manual sandboxes column workaround from the issue body is the only known unblock (WAL caveat applies).

  5. SeashoreShi commented on Sep 7, 2026

    @SeashoreShi
    Contributor

    Thanks for the extra data points — both the web Home and desktop clients use the same directory filter, so they're affected identically.

    A fix is ready in #46520 (global-project sessions are no longer filtered out; rebased on latest dev, 1-file change). If you hit the empty-session-list issue, a 👍 on the PR helps it get maintainer attention — opencode's cleanup bot closes PRs older than a month with fewer than 2 positive reactions, so community support directly affects whether the fix lands.

  6. Mattheinrichs commented on Sep 21, 2026

    @Mattheinrichs

    Opened a fix for this: #50440

    Cause: the Home list dropped sessions that had already been fetched. buildHomeSessionRecords kept only sessions whose directory string matched a project worktree/sandbox, and sessions created outside a git repo belong to the global project — whose worktree is forced to / and which records no sandboxes — so nothing matched and the list rendered "Nothing here yet".

    The PR matches sessions to the scoped projects by projectID first (falling back to the previous directory match), which is what the issue's suggested fix describes.

  7. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

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