Skip to content

sessions: scope git availability to each session surface#326420

Open
sandy081 wants to merge 1 commit into
mainfrom
sessions/scope-git-availability
Open

sessions: scope git availability to each session surface#326420
sandy081 wants to merge 1 commit into
mainfrom
sessions/scope-git-availability

Conversation

@sandy081

Copy link
Copy Markdown
Member

Follow-up to #326396 addressing Copilot Code Review feedback that repository picker visibility was driven by the globally active session rather than each toolbar's scoped session.

Changes

  • Add optional observable ISession.hasGitRepository for provider-refined usable Git availability.
  • Publish it through setSessionContextKeys, so SessionHasGitRepositoryContext is set independently in root and per-session scoped context-key services.
  • Have Copilot CLI sessions expose reactive usable Git availability (requires a HEAD commit).
  • Keep Isolation and Branch visibility declarative through their existing menu when clauses.
  • Remove the provider contribution that mirrored only ISessionsService.activeSession into the global key.
  • Add regression coverage proving two scoped context-key services retain independent Git availability.
  • Shorten the inline rationale comment per repository guidance.

Validation

  • Focused session context / Isolation / Branch tests: 7 passing
  • valid-layers-check: passed before rebasing the identical patch onto latest main
  • Hygiene: passed (including commit hook)
  • typecheck-client: the change compiled before rebasing; latest main currently reports unrelated baseline errors in native proxy config and MCP server types

Publish usable Git availability on ISession and have the shared session context
key plumbing bind it into root and per-session scoped context key services. This
keeps repository picker menu visibility aligned with each toolbar's own session
when multiple session inputs are visible.

Remove the provider contribution that mirrored only the globally active session,
and add regression coverage for independent scoped contexts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 18, 2026 02:07
@sandy081 sandy081 self-assigned this Jul 18, 2026
@sandy081
sandy081 enabled auto-merge (squash) July 18, 2026 02:08
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • src/vs/sessions/services/sessions/common/session.ts
  • src/vs/sessions/services/sessions/common/sessionContextKeys.ts
  • src/vs/sessions/services/sessions/test/common/sessionContextKeys.test.ts

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

Scopes Git availability to individual Agents window session surfaces so repository controls reflect the correct session.

Changes:

  • Adds reactive, provider-refined Git availability to ISession.
  • Publishes Git availability through scoped context keys.
  • Removes global-session mirroring and adds regression coverage.
Show a summary per file
File Description
.github/skills/sessions/SKILL.md Documents scoped menu-state guidance.
src/vs/sessions/SESSIONS.md Documents the new session property.
src/vs/sessions/common/contextkeys.ts Clarifies Git context-key semantics.
src/vs/sessions/services/sessions/common/session.ts Adds hasGitRepository.
src/vs/sessions/services/sessions/common/sessionContextKeys.ts Publishes Git state per context scope.
src/vs/sessions/services/sessions/test/common/sessionContextKeys.test.ts Tests independent scoped values.
src/vs/sessions/contrib/providers/copilotChatSessions/COPILOT_CHAT_SESSIONS_PROVIDER.md Documents provider behavior.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts Exposes reactive HEAD-aware Git state.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.ts Removes global context-key mirroring.
src/vs/sessions/contrib/providers/copilotChatSessions/browser/isolationPicker.ts Simplifies HEAD availability detection.

Review details

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

Comment on lines +498 to +499
/** Whether the session has a usable Git repository. Providers may refine this beyond workspace metadata. */
readonly hasGitRepository?: IObservable<boolean>;

@javi0guerrero4-cloud javi0guerrero4-cloud left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

update

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.

4 participants