Skip to content

Conversation

@rebornix
Copy link
Member

@rebornix rebornix commented Nov 8, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 8, 2025 00:03
@rebornix rebornix enabled auto-merge November 8, 2025 00:03
@rebornix rebornix self-assigned this Nov 8, 2025
Copy link
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 refactors the worktree creation progress reporting in the Copilot CLI chat sessions to use a task-based progress indicator instead of separate progress and warning calls.

  • Modernizes progress reporting to use stream.progress() with a callback task
  • Changes warning reporting to use progress.report() within the task callback
  • Provides a more integrated UX by showing progress status during the asynchronous operation

Comment on lines +45 to 58
await stream.progress(vscode.l10n.t('Creating isolated worktree for session...'), async (progress) => {
try {
const worktreePath = await vscode.commands.executeCommand('git.createWorktreeWithDefaults') as string | undefined;
if (worktreePath) {
return vscode.l10n.t('Created isolated worktree at {0}', worktreePath);
} else {
progress.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Failed to create worktree for isolation, using default workspace directory')));
}
} catch (error) {
progress.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Error creating worktree for isolation: {0}', error instanceof Error ? error.message : String(error))));
}
} catch (error) {
stream.warning(vscode.l10n.t('Error creating worktree for isolation: {0}', error instanceof Error ? error.message : String(error)));
}
});

return undefined;
Copy link

Copilot AI Nov 8, 2025

Choose a reason for hiding this comment

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

The refactored code breaks the function's return value. Previously, createWorktreeIfNeeded would return the worktreePath string on success, which was then used at line 350 to store the worktree path. Now the function always returns undefined at line 58, even when a worktree is successfully created at line 47.

The worktree path needs to be captured from the progress callback and returned:

let worktreePath: string | undefined = undefined;
await stream.progress(vscode.l10n.t('Creating isolated worktree for session...'), async (progress) => {
	try {
		worktreePath = await vscode.commands.executeCommand('git.createWorktreeWithDefaults') as string | undefined;
		if (worktreePath) {
			return vscode.l10n.t('Created isolated worktree at {0}', worktreePath);
		} else {
			progress.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Failed to create worktree for isolation, using default workspace directory')));
		}
	} catch (error) {
		progress.report(new vscode.ChatResponseWarningPart(vscode.l10n.t('Error creating worktree for isolation: {0}', error instanceof Error ? error.message : String(error))));
	}
});

return worktreePath;

Copilot uses AI. Check for mistakes.
@rebornix rebornix added this pull request to the merge queue Nov 8, 2025
Merged via the queue into main with commit f1da07e Nov 8, 2025
22 checks passed
@rebornix rebornix deleted the rebornix/scrawny-elephant branch November 8, 2025 00:26
lszomoru added a commit that referenced this pull request Nov 8, 2025
github-merge-queue bot pushed a commit that referenced this pull request Nov 8, 2025
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