Skip to content

Agents - code review service cleanup#312354

Draft
lszomoru wants to merge 2 commits intomainfrom
lszomoru/naval-termite
Draft

Agents - code review service cleanup#312354
lszomoru wants to merge 2 commits intomainfrom
lszomoru/naval-termite

Conversation

@lszomoru
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 24, 2026 14:16
@lszomoru lszomoru enabled auto-merge (squash) April 24, 2026 14:16
@lszomoru lszomoru self-assigned this Apr 24, 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

This PR refactors the Agents window CodeReviewService PR-review integration to better manage GitHub PR model polling lifecycles and session cleanup behavior.

Changes:

  • Updates PR-review initialization to return an IDisposable so polling can be stopped via autorun disposal.
  • Removes eager PR-review initialization/cleanup tied to session change events and instead ties PR polling to the active session.
  • Expands session-change cleanup to dispose PR review data alongside regular code review state resets.
Show a summary per file
File Description
src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts Adjusts PR review initialization and polling lifecycle management; refactors session-change cleanup logic.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

return;
}
}));

Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

The autorun only reacts to activeSession changes. After removing the onDidChangeSessions hook, PR review initialization will not re-run when activeSession.gitHubInfo (and its pullRequest) becomes available later, so PR review can remain stuck in None for the active session. Consider reading activeSession.gitHubInfo (and any other needed observables) inside this autorun, or reintroduce a reactive/session-change trigger for PR review initialization.

Suggested change
const gitHubInfo = activeSession.gitHubInfo.read(reader);
gitHubInfo?.pullRequest.read(reader);

Copilot uses AI. Check for mistakes.
Comment on lines 649 to 653
private _ensurePRReviewInitialized(sessionResource: URI): IDisposable {
const data = this._getOrCreatePRReviewData(sessionResource);
if (data.initialized) {
return;
return Disposable.None;
}
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

_ensurePRReviewInitialized returns Disposable.None once data.initialized is true, but the caller now disposes the polling handle via reader.store when the active session changes. This means switching away from a session stops PR polling, and switching back later will not restart polling (because the method short-circuits). Suggest separating “wiring initialized” from “polling active” (e.g., keep the model on data and always call startPolling() on activation, returning a disposable that stopPolling()s), so polling reliably resumes when a session becomes active again.

Copilot uses AI. Check for mistakes.
@lszomoru lszomoru disabled auto-merge April 24, 2026 14:25
alexr00
alexr00 previously approved these changes Apr 24, 2026
@lszomoru lszomoru marked this pull request as draft April 24, 2026 18:21
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