anomalyco / anomalyco/opencode

web: Review tab stuck loading when session directory is not a git repo

Open
#49,260 1 comment 0 reactions 1 assignee View on GitHub

@Hona is already working on this.

Since Sep 16, 2026.

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

Description

Summary

The web UI Review tab spins forever on "loading changes" when the session directory is not a git repository (e.g. a working directory containing multiple service repos). Both backing APIs return empty data, but the UI never renders an empty state. Related: there is no way to switch the Review scope to a different repo without moving the whole session.

Environment

  • opencode version: 2.0.3 (background service, healthy; serve --service, pid confirmed via /api/health)
  • OS: Linux 6.18.33.2-microsoft-standard-WSL2 x86_64
  • Terminal: TERM=xterm-256color
  • Shell: /bin/bash
  • Install/channel: latest (npm @opencode/cli); opencode2 beta build also present but the serving instance is 2.0.3
  • Active plugins: none found in config

Reproduction

  1. Open (or move) a session whose location.directory is a plain directory that is NOT a git repository — e.g. /root/work which contains multiple independent service repos/worktrees (git rev-parsefatal: not a git repository).
  2. Open the web UI (served by the same server, e.g. http://127.0.0.1:49374, Basic auth user opencode) and click the Review tab (审查).
  3. The panel shows "loading changes" indefinitely.

Expected Behavior

  • When there is nothing to review, the panel should render an empty state (e.g. "no changes") instead of loading forever.
  • Ideally the Review scope can be switched to a specific repo (location) without moving the session, since VCS routes are already location-scoped and POST /api/session/{sessionID}/move exists for changing the project directory.

Actual Behavior

  • Infinite loading spinner; no empty state, no error.
  • Backing API evidence (all via opencode api, which uses the same discovery+auth flow as first-party clients):
    • GET /api/session/{id}/diff{"data":[]}
    • GET /api/vcs/status{"location":{...,"directory":"/root",...},"data":[]} (project resolves away from the non-git session dir, empty file list)
    • GET /api/vcs/diff without mode400 InvalidRequestError "Missing key at [\"mode\"]" (mode is required: working | branch | committed)

Additional Context

  • Frequency: consistent — reproduces every time the session directory has no git repo.
  • The empty-data case likely misses an empty-state branch in the web client; the fetch itself succeeds (200 with []), so this looks like a frontend handling gap rather than a server error. No error lines related to vcs/diff in ~/.local/share/opencode/log/opencode.log (role=server).
  • Workaround tried: none helps in place; reviewing per-repo requires opening a session scoped to that repo directory (one session per project directory, matching the session/move design) or falling back to git status/git diff in a terminal.
  • Related feature ask: allow the Review tab to pick/switch the repo (location) when the session directory spans multiple repos.

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.