Skip to content

chat: show repository badge for pinned sessions#304896

Open
bpasero wants to merge 1 commit intomicrosoft:mainfrom
bpasero:copilot/bored-jay
Open

chat: show repository badge for pinned sessions#304896
bpasero wants to merge 1 commit intomicrosoft:mainfrom
bpasero:copilot/bored-jay

Conversation

@bpasero
Copy link
Member

@bpasero bpasero commented Mar 25, 2026

Summary

When agent sessions are grouped by repository/project, pinned sessions appear under the separate Pinned section rather than under their repository header. Because of that, hiding a badge that matches the repository name removes the only visible repository context for those sessions.

This change keeps the repository badge visible for pinned sessions in repository grouping, matching the existing archived-session behavior.

What changed

  • updated the badge-hiding logic in agentSessionsViewer.ts
  • continue hiding repository badges for regular repository-grouped sessions when the badge matches the section header
  • preserve the badge for pinned sessions, because they are rendered in the Pinned section instead of a repository section
  • keep archived-session behavior unchanged

Why

Pinned and archived sessions are both extracted out of repository groups into their own sections. For those sections, the repository header is no longer visible, so the badge needs to remain visible to show which repository the session belongs to.

Validation

  • npm run compile-check-ts-native
  • node --experimental-strip-types build/hygiene.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts
  • reviewed the branch diff and verified the change is limited to the session badge visibility logic

Copilot AI review requested due to automatic review settings March 25, 2026 20:24
@bpasero bpasero self-assigned this Mar 25, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 25, 2026
Copy link
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

Updates the agent sessions list UI to preserve repository context for pinned sessions when sessions are grouped by repository, by keeping the repository badge visible for pinned sessions (matching existing archived-session behavior).

Changes:

  • Adjusted badge-hiding logic so badges are only hidden for non-pinned, non-archived sessions in repository grouping when the badge matches the repository section header.
  • Ensured pinned sessions keep their repository badge since they render under the Pinned section (not under a repository header).
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts:338

  • Consider adding a unit test covering the repository-grouping badge hiding behavior for pinned sessions (i.e., ensure the badge is not hidden when isGroupedByRepository is true and session.isPinned() is true). There are existing tests for agentSessionsViewer grouping behavior, but none appear to cover AgentSessionRenderer.renderBadge, so this UI behavior could regress silently.
		// When grouped by repository, hide the badge only if the name it shows
		// matches the section header (i.e. the repository name for this session).
		// Badges with a different name (e.g. worktree name) are still shown.
		// Pinned and archived sessions always keep their badge since they are
		// grouped under their own section, not a repository section.
		if (
			this.options.isGroupedByRepository?.() &&
			!session.element.isArchived() &&
			!session.element.isPinned()
		) {
			const raw = typeof badge === 'string' ? badge : badge.value;
			const match = raw.match(/^\$\((?:repo|folder|worktree)\)\s*(.+)/);
			if (match) {
				const badgeName = match[1].trim();
				const repoName = getRepositoryName(session.element);
				if (badgeName === repoName) {
					return false;
				}
			}
		}

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