Skip to content

fix(app): refresh review panel on external git commits - #49148

Closed
lxqddd wants to merge 1 commit into
anomalyco:devfrom
lxqddd:fix/review-refresh-external-git-commit
Closed

lxqddd wants to merge 1 commit into
anomalyco:devfrom
lxqddd:fix/review-refresh-external-git-commit

Conversation

@lxqddd

@lxqddd lxqddd commented Sep 15, 2026

Copy link
Copy Markdown

The review panel caches its vcs.diff query with every refetch hook disabled, so it only refreshes through explicit invalidation. Most terminal git operations still refresh it by accident because they rewrite workspace files, but a git commit/add/amend only rewrites files under .git, which produced no event:

  • the server's .git subscription watches only HEAD, and a regular commit does not change HEAD's content
  • the client's session VCS listener dropped every .git path anyway (that check also compared a relative prefix against absolute event paths, so it never actually matched)

The panel then kept showing pre-commit changes until an unrelated event happened to refresh it.

  • watch .git/index alongside HEAD in the core watcher (staging and commits rewrite it; everything else under .git stays ignored)
  • in the session VCS listener, treat paths under .git whose basename is index or HEAD as VCS state changes and call the existing debounced refreshVcs(); basename matching also covers git worktrees, where the path is .git/worktrees//index
  • flip the watcher test to assert .git/index events are published and add coverage that other .git files remain ignored

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

The review panel caches its vcs.diff query with every refetch hook
disabled, so it only refreshes through explicit invalidation. Most
terminal git operations still refresh it by accident because they
rewrite workspace files, but a git commit/add/amend only rewrites files
under .git, which produced no event:

- the server's .git subscription watches only HEAD, and a regular
  commit does not change HEAD's content
- the client's session VCS listener dropped every .git path anyway
  (that check also compared a relative prefix against absolute event
  paths, so it never actually matched)

The panel then kept showing pre-commit changes until an unrelated event
happened to refresh it.

- watch .git/index alongside HEAD in the core watcher (staging and
  commits rewrite it; everything else under .git stays ignored)
- in the session VCS listener, treat paths under .git whose basename is
  index or HEAD as VCS state changes and call the existing debounced
  refreshVcs(); basename matching also covers git worktrees, where the
  path is .git/worktrees/<name>/index
- flip the watcher test to assert .git/index events are published and
  add coverage that other .git files remain ignored

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No "Type of change" checkbox is checked. Please select at least one.
  • No issue referenced. Please add Closes #<number> linking to the relevant issue.
  • "How did you verify your code works?" section is empty. Please explain how you tested.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 15, 2026
@github-actions github-actions Bot closed this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant