Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates PromptsService hook loading to cache and emit full hook discovery diagnostics (IHookDiscoveryInfo) alongside the resolved hooks, improving observability and avoiding a second discovery pass during logging.
Changes:
- Change the hooks cache (
cachedHooks) to storeIHookDiscoveryInfo(discovery + resolved hooks) instead of onlyIConfiguredHooksInfo | undefined. - Refactor hook computation to build discovery results (
files,sourceFolders) in the same pass as hook collection, including parallel processing of hook files. - Add tests covering hook discovery logging behavior and Claude/setting interactions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts | Adds tests for hook discovery logging and a Claude hooks edge case. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts | Refactors hook loading to compute/cache IHookDiscoveryInfo and log it directly. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts | Introduces IHookDiscoveryInfo to pair discovery info with resolved hooks. |
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts
Outdated
Show resolved
Hide resolved
| const result = await service.getHooks(CancellationToken.None); | ||
| // No hooks should be collected (the only file has disableAllHooks) | ||
| assert.strictEqual(result, undefined, 'Expected no hooks result'); |
There was a problem hiding this comment.
This test name/comment says it is validating hasDisabledClaudeHooks, but the assertions only check that getHooks() returns undefined. If the intent is to guard the hasDisabledClaudeHooks behavior, capture the hook discovery log (or otherwise access the discovery info) and assert on hooksInfo?.hasDisabledClaudeHooks (or adjust the test name/comments to match what’s actually being asserted).
| const result = await service.getHooks(CancellationToken.None); | |
| // No hooks should be collected (the only file has disableAllHooks) | |
| assert.strictEqual(result, undefined, 'Expected no hooks result'); | |
| // Capture hook discovery info to verify hasDisabledClaudeHooks behavior. | |
| const sessionResource = URI.file('/session'); | |
| let capturedDiscoveryInfo: IPromptDiscoveryInfo | undefined; | |
| const logDisposable = service.onDidLogDiscovery((entry: IPromptDiscoveryLogEntry) => { | |
| if (entry.discoveryInfo?.type === PromptsType.hook) { | |
| capturedDiscoveryInfo = entry.discoveryInfo; | |
| } | |
| }); | |
| const result = await service.getHooks(CancellationToken.None, sessionResource); | |
| logDisposable.dispose(); | |
| // No hooks should be collected (the only file has disableAllHooks) | |
| assert.strictEqual(result, undefined, 'Expected no hooks result'); | |
| // Discovery info should be logged, but should not report Claude hooks as disabled | |
| assert.ok(capturedDiscoveryInfo, 'Expected discovery info to be logged for hooks'); | |
| assert.notStrictEqual(capturedDiscoveryInfo!.hasDisabledClaudeHooks, true, 'Claude hooks should not be reported as disabled when Claude hooks are turned off'); |
…ptsServiceImpl.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.