Fix window title in agent title bar status widget#316247
Merged
Merged
Conversation
alexdima
approved these changes
May 13, 2026
Contributor
There was a problem hiding this comment.
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: WindowTitletoITitleServiceand implement it in the workbench and Agents window title services. - Update
AgentTitleBarStatusWidgetto consume the sharedWindowTitlefromITitleService(fixing missing variable resolution in the command center). - Expose the main titlebar part’s
WindowTitleinstance throughBrowserTitleService.
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; |
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.
Copilot Generated Description:Introduce awindowTitleproperty in theTitleServiceandBrowserTitleServiceto manage the window title for the agent title bar status widget. Update theAgentTitleBarStatusWidgetto utilize the sharedWindowTitleinstance for rendering the window title. This change centralizes window title management and ensures consistency across components.fixes #303429