Fix Agent Host branch diffs after base updates#315324
Merged
roblourens merged 3 commits intomainfrom May 9, 2026
Merged
Conversation
Prefer remote-tracking base refs for Agent Host worktree creation and branch-changes diff computation so stale local base branches do not introduce unrelated upstream changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Agent Host git plumbing so that branch-based diffs and worktree creation prefer origin/<base> when a corresponding remote-tracking ref exists, avoiding incorrect diffs/worktrees caused by stale local base branches. It also adds integration coverage to prevent regressions in this stale-local-branch scenario.
Changes:
- Prefer
origin/<startPoint>(when present) when creating worktrees so new worktrees are based on the remote-tracking ref rather than a stale local branch. - Prefer
origin/<baseBranch>(when present) when computing merge-base forcomputeSessionFileDiffs, producing PR-style diffs even if the local base branch hasn’t been updated. - Add regression tests covering stale local base branch behavior for both diff computation and worktree creation.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/node/agentHostGitService.ts | Adds remote-tracking branch resolution and uses it for worktree start points and merge-base computation. |
| src/vs/platform/agentHost/test/node/agentHostGitService.integrationTest.ts | Adds integration tests validating correct behavior when local base branches are stale. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
Add a direct filesystem cleanup fallback after removing the temporary worktree so the regression test remains hermetic if git cleanup fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
blocks-ci screenshots changedReplace the contents of Updated blocks-ci-screenshots.md<!-- auto-generated by CI — do not edit manually -->
#### editor/codeEditor/CodeEditor/Dark

#### editor/codeEditor/CodeEditor/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
 |
dmitrivMS
approved these changes
May 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation