make sure hook is shown in collapsed title for subagent and thinking#295696
Merged
make sure hook is shown in collapsed title for subagent and thinking#295696
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where hook messages (blocked tools or warnings) were not being shown in the collapsed titles of thinking and subagent sections, even though they were visible in the dropdown when expanded.
Changes:
- Modified thinking part title update logic to allow hook titles to be displayed after response completion
- Added hook count tracking to inform LLM title generation about blocked/warned tools
- Updated subagent part to display hook messages in collapsed title immediately when hooks are appended
- Enhanced LLM title generation prompt to handle blocked/denied content appropriately
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.ts | Added hookCount tracking, modified setTitle to check generatedTitle instead of element.isComplete, updated LLM prompt to conditionally include hook-related guidance |
| src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentContentPart.ts | Added logic to appendHookItem to generate and display hook messages in the title before rendering the hook item |
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.ts:1372
- The change from checking
this.element.isCompletetothis.content.generatedTitlecreates a potential race condition. Consider this scenario:
- Response completes,
finalizeTitleIfDefault()is called - LLM title generation starts asynchronously via
generateTitleViaLLM() - Hook arrives and calls
setTitle()with hook message (line 1235 intrackToolMetadata) - this succeeds becausegeneratedTitleis not set yet - LLM title generation completes, sets
this.content.generatedTitleand callssuper.setTitle()(line 918), overwriting the hook title
The hook title would be briefly displayed then immediately overwritten. A more robust solution would be to:
- Track whether title finalization has started with a boolean flag
- Only allow hook-related updates after finalization starts
- Or, better yet, include hook information in the context passed to
generateTitleViaLLM()so hooks are incorporated into the generated title
protected override setTitle(title: string, omitPrefix?: boolean): void {
if (!title || this.element.isComplete) {
return;
}
if (omitPrefix) {
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatThinkingContentPart.ts
Outdated
Show resolved
Hide resolved
…chatThinkingContentPart.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
TylerLeonhardt
approved these changes
Feb 17, 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.
fixes issue where hooks wouldn't be shown in thinking and subagent titles when they were shown in the dropdown