Files
vscode/src/vs/platform/agentHost/test/node/agentHostToolCallTracker.test.ts
T
Aaron MungerandCopilot 0d66fdd49d agentHost: track todo store telemetry (#328267)
* agentHost: track todo store telemetry

Classify successful Agent Host SQL access to todos and todo_deps without exposing raw queries. Add toolCallId correlation to generic tool telemetry while keeping the existing local todo-list event unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: classify todo SQL table access

Tokenize SQL before deriving todo telemetry so literals, comments, aliases, and unrelated writes cannot create false todo-store operations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* telemetry: update todo store owner

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: Adapt todo telemetry to referenced inputs

Classify only inline todo SQL after the Agent Host protocol added referenced tool input, and update the model-attribution telemetry expectation for tool-call correlation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* agentHost: scope todo telemetry to Copilot CLI

Move todo SQL classification and emission into the Copilot provider path so other harnesses do not participate. Keep generic tool-call correlation in the shared tracker.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-06 07:37:10 -07:00

58 lines
2.2 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
import { ToolCallContributorKind, type ToolCallContributor, type ToolCallResult } from '../../common/state/sessionState.js';
import { deriveToolInvokedResult, toolSourceKindFromContributor } from '../../node/agentHostToolCallTracker.js';
function result(success: boolean, code?: string): ToolCallResult {
return {
success,
pastTenseMessage: 'done',
error: code !== undefined || !success ? { message: 'failed', code } : undefined,
};
}
suite('agentHostToolCallTracker', () => {
ensureNoDisposablesAreLeakedInTestSuite();
test('deriveToolInvokedResult maps success/cancel/error buckets', () => {
const actual = {
success: deriveToolInvokedResult(result(true)),
denied: deriveToolInvokedResult(result(false, 'denied')),
rejected: deriveToolInvokedResult(result(false, 'rejected')),
cancelled: deriveToolInvokedResult(result(false, 'cancelled')),
otherCode: deriveToolInvokedResult(result(false, 'timeout')),
noCode: deriveToolInvokedResult(result(false)),
};
assert.deepStrictEqual(actual, {
success: 'success',
denied: 'userCancelled',
rejected: 'userCancelled',
cancelled: 'userCancelled',
otherCode: 'error',
noCode: 'error',
});
});
test('toolSourceKindFromContributor maps contributor kind', () => {
const mcp: ToolCallContributor = { kind: ToolCallContributorKind.MCP, customizationId: 'c1' };
const client: ToolCallContributor = { kind: ToolCallContributorKind.Client, clientId: 'x' };
const actual = {
none: toolSourceKindFromContributor(undefined),
mcp: toolSourceKindFromContributor(mcp),
client: toolSourceKindFromContributor(client),
};
assert.deepStrictEqual(actual, {
none: 'agentHost',
mcp: 'mcp',
client: 'client',
});
});
});