Skip to content

Show warning when claude code hooks are detected but disabled#294724

Merged
roblourens merged 5 commits intomainfrom
roblou/xenacious-cockroach-main
Feb 13, 2026
Merged

Show warning when claude code hooks are detected but disabled#294724
roblourens merged 5 commits intomainfrom
roblou/xenacious-cockroach-main

Conversation

@roblourens
Copy link
Member

Port of #294712 to main

Copilot AI review requested due to automatic review settings February 11, 2026 23:26
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 11, 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

This PR ports functionality to detect Claude Code hook files in a workspace and surface a one-time in-chat warning when those hooks are present but disabled, alongside introducing a new chat.useClaudeHooks setting to control whether Claude-format hooks can execute.

Changes:

  • Add chat.useClaudeHooks setting and wire it into hook discovery/collection (including cache invalidation).
  • Extend hook collection API to return both collected hooks and a “disabled Claude hooks detected” flag.
  • Add a new chat progress/rendering part to display a warning with a Settings link when disabled Claude hooks are detected.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.ts Adapts to updated hooks API by extracting hooks from the returned info object.
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts Tracks disabled Claude hooks during hook parsing; skips Claude hooks when setting is disabled; invalidates hooks cache on setting changes.
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts Adds IConfiguredHooksInfo and updates getHooks return type.
src/vs/workbench/contrib/chat/common/promptSyntax/config/config.ts Introduces PromptsConfig.USE_CLAUDE_HOOKS constant.
src/vs/workbench/contrib/chat/common/model/chatViewModel.ts Allows renderer pipeline to carry the new disabledClaudeHooks content part.
src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.ts Treats disabledClaudeHooks as a static serialized response part for storage diffing.
src/vs/workbench/contrib/chat/common/model/chatModel.ts Adds disabledClaudeHooks to progress/serialization unions and ignores it for copy-text generation.
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts Emits the new warning progress part and persists a “shown” flag in workspace storage.
src/vs/workbench/contrib/chat/common/chatService/chatService.ts Defines IChatDisabledClaudeHooksPart and includes it in IChatProgress.
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts Renders disabledClaudeHooks via a new content part implementation.
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatDisabledClaudeHooksContent.css Styles the warning row (icon + italic message).
src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatDisabledClaudeHooksContentPart.ts Implements the warning UI with a command link to Settings.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers the new chat.useClaudeHooks setting in configuration schema.
src/vs/workbench/contrib/chat/browser/actions/chatCustomizationDiagnosticsAction.ts Adds diagnostics messaging for the new skip reason claude-hooks-disabled.

Comment on lines +1056 to +1058
this.storageService.store(disabledClaudeHooksDismissedKey, true, StorageScope.WORKSPACE, StorageTarget.USER);
if (hasDisabledClaudeHooks) {
progressCallback([{ kind: 'disabledClaudeHooks' }]);
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dismissal flag is stored before checking hasDisabledClaudeHooks, so the “disabled Claude hooks” warning can be permanently suppressed for the workspace even when there was nothing to warn about (and it also won’t show later if Claude hooks are added). Only persist the dismissal flag when the warning is actually shown (or store a separate “already checked” flag).

Suggested change
this.storageService.store(disabledClaudeHooksDismissedKey, true, StorageScope.WORKSPACE, StorageTarget.USER);
if (hasDisabledClaudeHooks) {
progressCallback([{ kind: 'disabledClaudeHooks' }]);
if (hasDisabledClaudeHooks) {
progressCallback([{ kind: 'disabledClaudeHooks' }]);
this.storageService.store(disabledClaudeHooksDismissedKey, true, StorageScope.WORKSPACE, StorageTarget.USER);

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +45
const enableLink = createMarkdownCommandLink({
title: localize('chat.disabledClaudeHooks.enableLink', "Enable"),
id: 'workbench.action.openSettings',
arguments: [PromptsConfig.USE_CLAUDE_HOOKS],
});
const message = localize('chat.disabledClaudeHooks.message', "Claude Code hooks are available for this workspace. {0}", enableLink);
const content = new MarkdownString(message, { isTrusted: true });

const rendered = this._register(this._markdownRendererService.render(content, {
actionHandler: (href) => openLinkFromMarkdown(this._openerService, href, true),
}));
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MarkdownString is marked isTrusted: true, which allows all command links in the rendered markdown. Since this message only needs to invoke workbench.action.openSettings, it would be safer to restrict trust to an explicit allow-list (e.g. isTrusted: { enabledCommands: ['workbench.action.openSettings'] }).

Copilot uses AI. Check for mistakes.
joshspicer
joshspicer previously approved these changes Feb 12, 2026
…roach-main

# Conflicts:
#	src/vs/workbench/contrib/chat/browser/chat.contribution.ts
#	src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts
@roblourens roblourens merged commit 1da341f into main Feb 13, 2026
18 checks passed
@roblourens roblourens deleted the roblou/xenacious-cockroach-main branch February 13, 2026 09:24
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