anomalyco / anomalyco/opencode
fix(app): Review pane stays on loading for file tree and changes
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
- Open a session in Desktop for a git project.
- Click Review.
- 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
isPendingas 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:
ReviewPanelSidebardiffsReadyfallback (common.loading). - Preview loading:
ReviewPanelEmptywhen mode isgit/branchand!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
- Treat loading as
isFetching && !isFetched(orfetchStatus === "fetching"), not rawisPending. - Add an error empty state when
isError. - Cap/timeout
GET /api/vcs/diff; skip or bound untracked blobs instead of onegit diff --no-indexper file. - Keep ignored build/unpack dirs out of status (
--untracked-files=normalor respect ignore rules strictly).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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