anomalyco / anomalyco/opencode

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

Open
#46,444 5 comments 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Aug 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.