Skip to content

Default diffs to working changes#3974

Open
jakeleventhal wants to merge 3 commits into
pingdotgg:mainfrom
jakeleventhal:agent/default-diff-to-working-changes
Open

Default diffs to working changes#3974
jakeleventhal wants to merge 3 commits into
pingdotgg:mainfrom
jakeleventhal:agent/default-diff-to-working-changes

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • default the diff sidebar to Working tree when the repository has working changes
  • fall back to Branch changes for a clean working tree
  • preserve an explicit per-thread diff scope selection

Why

Opening the diff sidebar previously defaulted to Branch changes even when staged, unstaged, or untracked work existed. Using the existing VCS status result makes the initial scope reflect the changes a user is most likely trying to inspect without overriding a scope they selected themselves.

Validation

  • pnpm exec vp test apps/web/src/diffPanelStore.test.ts
  • pnpm exec vp check
  • pnpm exec vp run typecheck

Note

Default the diff panel to unstaged changes when the working tree is dirty

  • The diff panel now initializes to unstaged scope when the working tree has changes, and branch scope otherwise, instead of always defaulting to branch.
  • selectThreadDiffPanelSelection in diffPanelStore.ts accepts a new optional hasWorkingTreeChanges boolean to drive this defaulting logic.
  • ChatView.tsx queries git status using the thread's worktree path (falling back to project cwd) and passes the resolved scope as initialGitScope to DiffPanel.
  • The diff panel remounts when git status resolves so the correct initial scope is applied rather than the pre-resolution default.

Macroscope summarized 9b87512.


Note

Low Risk
UI-only defaulting on existing VCS status with tests; explicit per-thread scope and persisted selections are unchanged.

Overview
The diff sidebar now opens on Working tree when VCS status reports local changes, and on Branch when the working tree is clean—only for threads without a saved scope in diffPanelStore.

ChatView derives initialGitScope from gitStatusQuery.data?.hasWorkingTreeChanges, prefers the thread worktree for git status (gitStatusCwd), and remounts DiffPanel when the thread or status finishes loading so the default applies once status is known.

DiffPanel takes initialGitScope and freezes it on mount; selectThreadDiffPanelSelection uses a dirty-tree default when there is no per-thread persisted selection, without overriding an explicit branch/unstaged choice.

Reviewed by Cursor Bugbot for commit 9b87512. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4c401d7d-3a95-46f3-8bc8-5083e31da175

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 14, 2026
Comment thread apps/web/src/components/DiffPanel.tsx
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Jul 14, 2026
@jakeleventhal jakeleventhal marked this pull request as ready for review July 14, 2026 19:46

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ed774d7. Configure here.

Comment thread apps/web/src/components/ChatView.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Minor UI default change - diff panel now defaults to showing working (unstaged) changes when uncommitted changes exist, instead of always defaulting to branch changes. The logic is simple, well-tested, and users can still manually switch views.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant