Skip to content

Background - handle empty git repositories#308767

Merged
lszomoru merged 1 commit intomainfrom
lszomoru/northern-toucan
Apr 9, 2026
Merged

Background - handle empty git repositories#308767
lszomoru merged 1 commit intomainfrom
lszomoru/northern-toucan

Conversation

@lszomoru
Copy link
Copy Markdown
Member

@lszomoru lszomoru commented Apr 9, 2026

Fixes #308596

@lszomoru lszomoru enabled auto-merge (squash) April 9, 2026 11:59
Copilot AI review requested due to automatic review settings April 9, 2026 11:59
@lszomoru lszomoru self-assigned this Apr 9, 2026
@lszomoru lszomoru added this to the 1.116.0 milestone Apr 9, 2026
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

Fixes Copilot Chat Sessions “Background” flows when the workspace is a newly-initialized/empty Git repository (no commits), avoiding Git operations that expect a resolvable HEAD.

Changes:

  • Skip branch base resolution when the repository has no HEAD commit.
  • Skip baseline/post-turn checkpoint creation when the repository has no HEAD commit.
Show a summary per file
File Description
extensions/copilot/src/extension/chatSessions/vscode-node/folderRepositoryManagerImpl.ts Avoids calling branch-base resolution in empty repositories by requiring a headCommitHash.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeCheckpointServiceImpl.ts Avoids checkpoint creation in empty repositories by requiring a headCommitHash.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeCheckpointServiceImpl.ts:88

  • Same as above: this warning now fires when the repo exists but has no HEAD commit. Consider adjusting the message to explicitly mention the empty-repo/no-commit case to avoid confusing "No repository found" logs.
		if (!repository || !repository.headCommitHash) {
			this.logService.warn(`[ChatSessionWorktreeCheckpointService][handleRequestCompleted] No repository found for session ${sessionId}, skipping post-turn checkpoint`);
			return;

extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeCheckpointServiceImpl.ts:170

  • This warning is now emitted both when no repo is found and when the worktree repo is empty (no HEAD commit). Please tweak the message to reflect the empty-repository case so it’s clear why checkpoint creation is being skipped.
			if (!repository || !repository.headCommitHash) {
				this.logService.warn(`[ChatSessionWorktreeCheckpointService][handleAdditionalWorktreesRequest] No repository found for additional worktree ${props.worktreePath}`);
				continue;
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

@lszomoru lszomoru merged commit 7fe7589 into main Apr 9, 2026
27 checks passed
@lszomoru lszomoru deleted the lszomoru/northern-toucan branch April 9, 2026 13:02
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.

Background: No such branch: main

3 participants