Skip to content

Sessions: Report cloud session pull requests#327393

Open
benibenj wants to merge 2 commits into
mainfrom
benibenj/cloud-sessions-pr-reporting
Open

Sessions: Report cloud session pull requests#327393
benibenj wants to merge 2 commits into
mainfrom
benibenj/cloud-sessions-pr-reporting

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

Summary

  • report provider-backed pull requests for Copilot Cloud sessions in the Agents window
  • infer the pull request from cloud repository and branch metadata when the provider omits it
  • share the Agent Host live PR polling, status icon, and persistent icon cache behavior

Testing

  • Not run locally per request; validation is deferred to CI
  • Pre-commit hygiene hook passed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 21:12
@benibenj
benibenj enabled auto-merge (squash) July 24, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds pull request reporting for Copilot Cloud sessions in the Agents window.

Changes:

  • Resolves PRs from provider metadata or repository branch data.
  • Shares live PR icon polling and caching behavior.
  • Adds documentation and provider tests.
Show a summary per file
File Description
copilotChatSessionsProvider.test.ts Tests cloud PR resolution and icon updates.
COPILOT_CHAT_SESSIONS_PROVIDER.md Documents cloud PR behavior.
copilotChatSessionsProvider.ts Adds cloud PR inference and live icons.
baseAgentHostSessionsProvider.ts Uses the shared icon helper.
pullRequestIconStatus.ts Centralizes live and cached PR icon resolution.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Medium

aeschli
aeschli previously approved these changes Jul 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dmitrivMS

Copy link
Copy Markdown
Contributor

@benibenj
Error: [core-ci ] [21:59:11] src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts(1066,3): error TS2322: Type 'IObservableWithChange<IGitHubInfo | { owner: string; repo: string; pullRequest: { number?: number | undefined; uri?: URI | undefined; baseRefOid?: string | undefined; headRefOid?: string | undefined; icon: ThemeIcon | undefined; }; } | undefined, unknown>' is not assignable to type 'IObservable<IGitHubInfo | undefined>'.

...info,
pullRequest: {
...pullRequest,
icon: computeSessionPullRequestIcon(reader, this._gitHubService, this._pullRequestIconCache, info)

@dmitrivMS dmitrivMS Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Review: Could pullRequestUrl be the source of truth for the PR number here? _extractPullRequestNumber currently returns metadata.pullRequestNumber before parsing the URL, while the URI and icon cache continue to use the URL. With conflicting metadata, the live model can load one PR while the reported URI/cache refer to another.

return {
...info,
pullRequest: {
...pullRequest,

@dmitrivMS dmitrivMS Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Review: Similarly, _extractOwnerRepo prefers owner/name, repositoryNwo, and the workspace URI before pullRequestUrl. If those disagree, this live lookup can poll one repository while the reported PR URL points to another. Should owner/repo be parsed from pullRequestUrl whenever it is present?

- Constructs with initial values from the agent session's metadata and timing
- `update(session)` performs a batched observable transaction to update all reactive properties
- Extracts workspace info, changes, description, and GitHub info from session metadata
- Treats a cloud provider's `pullRequestUrl` as authoritative and falls back to resolving the PR from `owner`/`name`/`branch` when the URL is absent

@dmitrivMS dmitrivMS Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Review: Does URL-only metadata satisfy this contract? For cloud sessions, _buildWorkspace constructs a path from metadata.owner and metadata.name; when only pullRequestUrl is supplied, that becomes /undefined/undefined/..., and _extractOwnerRepo accepts the resulting workspace URI before reaching the URL fallback. Could the URL be checked first, or workspace construction guard missing owner/name?

owner: 'owner',
name: 'repo',
branch: 'feature',
pullRequestUrl: prUri.toString(),

@dmitrivMS dmitrivMS Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AI Review: Could this test deliberately conflict the scalar metadata with pullRequestUrl and add a URL-only case? The current tests use agreeing repository metadata and no conflicting pullRequestNumber, so they do not exercise the precedence paths above or the /undefined/undefined/ case.

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.

5 participants