chat: show repository badge for pinned sessions#304896
Open
bpasero wants to merge 1 commit intomicrosoft:mainfrom
Open
chat: show repository badge for pinned sessions#304896bpasero wants to merge 1 commit intomicrosoft:mainfrom
bpasero wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
isGroupedByRepositoryis true andsession.isPinned()is true). There are existing tests foragentSessionsViewergrouping behavior, but none appear to coverAgentSessionRenderer.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;
}
}
}
eleanorjboyd
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
agentSessionsViewer.tsWhy
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-nativenode --experimental-strip-types build/hygiene.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer.ts