Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1262,13 +1262,13 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
}
}

private static readonly _PR_DETECTION_RETRY_COUNT = 3;
private static readonly _PR_DETECTION_RETRY_COUNT = 5;
Comment thread
osortega marked this conversation as resolved.
private static readonly _PR_DETECTION_INITIAL_DELAY_MS = 2_000;

private async handlePullRequestCreated(session: ICopilotCLISession): Promise<void> {
const sessionId = session.sessionId;
let prUrl = session.createdPullRequestUrl;
let prState = 'open';
let prState = '';

this.logService.debug(`[CopilotCLIChatSessionParticipant] handlePullRequestCreated for ${sessionId}: createdPullRequestUrl=${prUrl ?? 'none'}`);

Expand All @@ -1285,7 +1285,7 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
this.logService.debug(`[CopilotCLIChatSessionParticipant] No PR URL from session, attempting retry detection for ${sessionId}, branch=${worktreeProperties.branchName}`);
const prResult = await this.detectPullRequestWithRetry(sessionId);
prUrl = prResult?.url;
prState = prResult?.state ?? 'open';
prState = prResult?.state ?? prResult?.url ? 'open' : '';
} else {
this.logService.debug(`[CopilotCLIChatSessionParticipant] Skipping retry detection for ${sessionId}: branch=${worktreeProperties.branchName ?? 'none'}, repoPath=${!!worktreeProperties.repositoryPath}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1535,13 +1535,13 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
}
}

private static readonly _PR_DETECTION_RETRY_COUNT = 3;
private static readonly _PR_DETECTION_RETRY_COUNT = 5;
private static readonly _PR_DETECTION_INITIAL_DELAY_MS = 2_000;
Comment thread
osortega marked this conversation as resolved.

private async handlePullRequestCreated(session: ICopilotCLISession): Promise<void> {
const sessionId = session.sessionId;
let prUrl = session.createdPullRequestUrl;
let prState = 'open';
let prState = '';

this.logService.debug(`[CopilotCLIChatSessionParticipant] handlePullRequestCreated for ${sessionId}: createdPullRequestUrl=${prUrl ?? 'none'}`);

Expand All @@ -1559,7 +1559,7 @@ export class CopilotCLIChatSessionParticipant extends Disposable {
this.logService.debug(`[CopilotCLIChatSessionParticipant] No PR URL from session, attempting retry detection for ${sessionId}, branch=${worktreeProperties.branchName}`);
const prResult = await this.detectPullRequestWithRetry(sessionId);
prUrl = prResult?.url;
prState = prResult?.state ?? 'open';
prState = prResult?.state ?? prUrl ? 'open' : '';
} else {
this.logService.debug(`[CopilotCLIChatSessionParticipant] Skipping retry detection for ${sessionId}: branch=${worktreeProperties.branchName ?? 'none'}, repoPath=${!!worktreeProperties.repositoryPath}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2097,8 +2097,8 @@ describe('CopilotCLIChatSessionParticipant.handleRequest', () => {
await vi.runAllTimersAsync();
await handlerPromise;

// 3 attempts total (after 2s, 4s, and 8s delays)
expect(findPr).toHaveBeenCalledTimes(3);
// 5 attempts total (after 2s, 4s, 8s, 16s, and 32s delays)
expect(findPr).toHaveBeenCalledTimes(5);
// Should NOT have persisted any PR URL since all attempts failed
const setPropsCallsWithPrUrl = (worktree.setWorktreeProperties as ReturnType<typeof vi.fn>).mock.calls
.filter((args: unknown[]) => (args[1] as { pullRequestUrl?: string })?.pullRequestUrl !== undefined);
Expand Down
Loading