Skip to content

Fix window title in agent title bar status widget#316247

Merged
benibenj merged 1 commit into
mainfrom
benibenj/lesser-hippopotamus
May 13, 2026
Merged

Fix window title in agent title bar status widget#316247
benibenj merged 1 commit into
mainfrom
benibenj/lesser-hippopotamus

Conversation

@benibenj
Copy link
Copy Markdown
Contributor

Copilot Generated Description: Introduce a windowTitle property in the TitleService and BrowserTitleService to manage the window title for the agent title bar status widget. Update the AgentTitleBarStatusWidget to utilize the shared WindowTitle instance for rendering the window title. This change centralizes window title management and ensures consistency across components.

fixes #303429

Copilot AI review requested due to automatic review settings May 13, 2026 14:05
@benibenj benibenj enabled auto-merge May 13, 2026 14:05
@benibenj benibenj self-assigned this May 13, 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

This PR centralizes window.title template resolution by exposing a shared WindowTitle instance via ITitleService, then reuses that instance in the agent title bar status widget so it honors all registered window-title variables (e.g. SCM branch name) instead of constructing its own WindowTitle.

Changes:

  • Add windowTitle: WindowTitle to ITitleService and implement it in the workbench and Agents window title services.
  • Update AgentTitleBarStatusWidget to consume the shared WindowTitle from ITitleService (fixing missing variable resolution in the command center).
  • Expose the main titlebar part’s WindowTitle instance through BrowserTitleService.
Show a summary per file
File Description
src/vs/workbench/services/title/browser/titleService.ts Extends ITitleService with a shared windowTitle property.
src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.ts Uses titleService.windowTitle instead of instantiating a separate WindowTitle.
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts Implements windowTitle on BrowserTitleService and exposes it from the main titlebar part.
src/vs/sessions/browser/parts/titlebarPart.ts Adds a lazy windowTitle implementation for the Agents window TitleService.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines 465 to +486
updateProperties(properties: ITitleProperties): void {
for (const part of this.parts) {
part.updateProperties(properties);
}
}

registerVariables(variables: ITitleVariable[]): void {
for (const part of this.parts) {
part.registerVariables(variables);
}
}

private _windowTitle: WindowTitle | undefined;

get windowTitle(): WindowTitle {
// The Agents window title bar does not render `window.title`, so we
// lazily construct a `WindowTitle` only when a consumer (e.g. a custom
// command center widget) actually asks for one.
if (!this._windowTitle) {
this._windowTitle = this._register(this.instantiationService.createInstance(WindowTitle, mainWindow));
}
return this._windowTitle;
@benibenj benibenj merged commit b8363eb into main May 13, 2026
29 checks passed
@benibenj benibenj deleted the benibenj/lesser-hippopotamus branch May 13, 2026 14:27
@vs-code-engineering vs-code-engineering Bot added this to the 1.121.0 milestone May 13, 2026
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.

Window title variable resolution not working in new command center

3 participants