Skip to content

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

Closed

Description

@xwh5

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-parse → fatal: 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 mode → 400 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.

Activity

  1. github-actions commented on Sep 16, 2026

    @github-actions
    Contributor

    This issue might be related to existing issues around non-git directory handling. Please check:

    If your specific symptom (Review tab stuck on "loading changes" with no empty-state render) is already tracked in one of those, consider adding a comment there instead.

  2. Hona commented on Sep 22, 2026

    @Hona
    Member

    Fixed by #50265 (fix(app): show empty review state for projects without VCS), merged to v2 as 8aebed1 on 2026-09-21. Closing manually because v2 is not the default branch, so the PR did not auto-close this issue.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions