Skip to content

Fix Agent Host branch diffs after base updates#315324

Merged
roblourens merged 3 commits intomainfrom
agents/22c21a88-7a28-4d01-82a0-e8f49bbe8554
May 9, 2026
Merged

Fix Agent Host branch diffs after base updates#315324
roblourens merged 3 commits intomainfrom
agents/22c21a88-7a28-4d01-82a0-e8f49bbe8554

Conversation

@roblourens
Copy link
Copy Markdown
Member

Summary

  • prefer origin/ when creating Agent Host worktrees from a stored base branch
  • prefer origin/ when computing Branch changes diffs so stale local base branches do not add unrelated upstream changes
  • add regression coverage for stale local base branch behavior

Validation

  • npm run compile-check-ts-native
  • npm run transpile-client
  • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/agentHostGitService.integrationTest.ts
  • node --experimental-strip-types build/hygiene.ts src/vs/platform/agentHost/node/agentHostGitService.ts src/vs/platform/agentHost/test/node/agentHostGitService.integrationTest.ts

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>
Copilot AI review requested due to automatic review settings May 8, 2026 17:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 for computeSessionFileDiffs, 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>
@roblourens roblourens marked this pull request as ready for review May 9, 2026 00:35
@roblourens roblourens enabled auto-merge (squash) May 9, 2026 00:35
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/67bfb687fd2818bd53771a60660541b9ed6f38b80d37da0aac15d267ecaeacec)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/0469dd8d0a587d94a1eaec514c79917b93b9a38694ef2b767bb1892819ae0a55)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidget/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/97162fc53c861ee13dc78a18e41fe3a25a42f62dc52a560510ebf084a418e1c3)

#### editor/inlineChatZoneWidget/InlineChatZoneWidgetTerminated/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/3b7e2eb5cc9ba727e2bc1c5113c3e17d8e9a6ce9a37b77519be3716ceb9a9afa)

@roblourens roblourens merged commit 514255b into main May 9, 2026
24 of 25 checks passed
@roblourens roblourens deleted the agents/22c21a88-7a28-4d01-82a0-e8f49bbe8554 branch May 9, 2026 00:47
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants