Skip to content

Background - add repository state to the metadata#309034

Merged
lszomoru merged 8 commits intomainfrom
lszomoru/copilot-metadata
Apr 10, 2026
Merged

Background - add repository state to the metadata#309034
lszomoru merged 8 commits intomainfrom
lszomoru/copilot-metadata

Conversation

@lszomoru
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 10, 2026 15:17
@lszomoru lszomoru enabled auto-merge (squash) April 10, 2026 15:17
@lszomoru lszomoru self-assigned this Apr 10, 2026
@lszomoru lszomoru added this to the 1.116.0 milestone Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Screenshot Changes

Base: 6d3ab98d Current: 751a4149

Changed (1)

agentSessionsViewer/ApprovalRowLongLabel/Light
Before After
before after

jrieken
jrieken previously approved these changes Apr 10, 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

Adds Git repository “state” signals (incoming/outgoing/uncommitted changes + GitHub remote presence) into Copilot CLI session/worktree metadata so consumers can reason about repository status when rendering/backgrounding sessions.

Changes:

  • Extend RepoContext to expose HEAD ahead/behind counts and surface them from the VS Code Git extension state.
  • Compute and persist repository-state booleans into session/worktree properties and include them in session item metadata payloads.
  • Adjust change-computation helpers to return richer “properties + changes” bundles so computed state can be stored alongside diffs.
Show a summary per file
File Description
extensions/copilot/src/platform/git/vscode-node/gitServiceImpl.ts Exposes HEAD.ahead/behind via RepoContextImpl.
extensions/copilot/src/platform/git/common/gitService.ts Extends RepoContext with incoming/outgoing counts and exports GitHub remote helper used by session services.
extensions/copilot/src/extension/chatSessions/vscode-node/folderRepositoryManagerImpl.ts Computes repository-state booleans for repository properties used during session initialization.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Adds repo-state fields to session item metadata (worktree + workspace).
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Adds repo-state fields to worktree metadata and reorders change/metadata building.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts Computes repo-state booleans and stores them into v2 worktree properties when computing changes.
extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts Computes repo-state booleans for workspace sessions and persists them to metadata store.
extensions/copilot/src/extension/chatSessions/common/chatSessionWorktreeService.ts Extends v2 worktree properties schema with repo-state fields.
extensions/copilot/src/extension/chatSessions/common/chatSessionMetadataStore.ts Extends persisted RepositoryProperties schema with repo-state fields.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts:805

  • Repository state computation for hasUncommittedChanges ignores mergeChanges, which are also uncommitted. This can cause hasUncommittedChanges to be false during merge conflict resolution. Include worktreeRepository.changes?.mergeChanges.length in the check.
			hasIncomingChanges: (worktreeRepository.headIncomingChanges ?? 0) > 0,
			hasOutgoingChanges: (worktreeRepository.headOutgoingChanges ?? 0) > 0,
			hasUncommittedChanges: (worktreeRepository.changes?.indexChanges.length ?? 0) > 0 ||
				(worktreeRepository.changes?.workingTree.length ?? 0) > 0 ||
				(worktreeRepository.changes?.untrackedChanges.length ?? 0) > 0

extensions/copilot/src/extension/chatSessions/vscode-node/chatSessionWorkspaceFolderServiceImpl.ts:253

  • hasUncommittedChanges ignores mergeChanges. Merge conflict changes are uncommitted and should be included in this state calculation to avoid false negatives.
			hasIncomingChanges: (repository.headIncomingChanges ?? 0) > 0,
			hasOutgoingChanges: (repository.headOutgoingChanges ?? 0) > 0,
			hasUncommittedChanges: (repository.changes?.indexChanges.length ?? 0) > 0 ||
				(repository.changes?.workingTree.length ?? 0) > 0 ||
				(repository.changes?.untrackedChanges.length ?? 0) > 0
  • Files reviewed: 11/11 changed files
  • Comments generated: 6

jrieken
jrieken previously approved these changes Apr 10, 2026
@lszomoru lszomoru enabled auto-merge (squash) April 10, 2026 17:19
@lszomoru lszomoru requested a review from jrieken April 10, 2026 18:13
@lszomoru lszomoru merged commit dede8c6 into main Apr 10, 2026
25 of 26 checks passed
@lszomoru lszomoru deleted the lszomoru/copilot-metadata branch April 10, 2026 18:29
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