anomalyco / anomalyco/opencode

fix(app): Review pane stays on loading for file tree and changes

Open
#50,119 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

Desktop Review can sit forever on both panes:

  • Sidebar: Filter files (筛选文件), then 加载中...
  • Preview: Loading changes (正在加载更改…)

This is one shared pending flag, not two independent loaders. Related but not the same as #49260 (non-git directory) and #42964 (eager full diffs making Desktop unresponsive).

Environment

  • OS: Windows 10/11
  • Client: OpenCode Desktop Review tab (session-ui v2 sidebar + preview)
  • Workspace: git repository (not a non-git folder)

Reproduction

  1. Open a session in Desktop for a git project.
  2. Click Review.
  3. Leave the panel open.

Observed: left tree and right diff stay on loading copy with no empty state and no error.

A heavy working tree makes this easy to hit. git status --porcelain --untracked-files=all plus per-untracked git diff --no-index will run against every untracked file. A local Electron unpack directory with thousands of files is enough to keep the request outstanding.

Expected

  • Bound the VCS request; if it fails or times out, show an error, not a spinner.
  • If there is nothing to review, show the empty state.
  • Do not treat isPending as still loading when the query is disabled or never started.

Actual

Both panes key off createSessionReview().ready():

const ready = () => {
  if (mode() === "git" || mode() === "branch") return !vcsQuery.isPending
  return true
}
  • Sidebar loading: ReviewPanelSidebar diffsReady fallback (common.loading).
  • Preview loading: ReviewPanelEmpty when mode is git/branch and !ready() (session.review.loadingChanges).

vcsQuery has no timeout. ready() ignores isError / fetchStatus. TanStack Query v5 keeps isPending === true when there is no cached data even if enabled is false, so a disabled query (disconnected, missing project.vcs, review not yet wanted) also looks like an in-flight load.

Working-tree diffs then call git status --untracked-files=all and may statUntracked / patchUntracked (git diff --no-index) per ?? path in packages/core/src/plugin/vcs/git.ts. That can run for a long time on large untracked trees, so isPending never clears.

Suggested fix

  1. Treat loading as isFetching && !isFetched (or fetchStatus === "fetching"), not raw isPending.
  2. Add an error empty state when isError.
  3. Cap/timeout GET /api/vcs/diff; skip or bound untracked blobs instead of one git diff --no-index per file.
  4. Keep ignored build/unpack dirs out of status (--untracked-files=normal or respect ignore rules strictly).

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.

Research direction

Start with createSessionReview().ready() and the ReviewPanelSidebar and ReviewPanelEmpty loading paths, then inspect vcsQuery state handling. Trace GET /api/vcs/diff into packages/core/src/plugin/vcs/git.ts, including status, statUntracked, and patchUntracked. Done means disabled, failed, empty, and slow reviews no longer leave either pane stuck on a spinner.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
backend, desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.