fix: unify event names and fix tool calls test

This commit is contained in:
Dallin Romney 2025-09-19 21:46:46 -07:00
parent 4e1cea9891
commit 0f940883bc
4 changed files with 10 additions and 12 deletions

View file

@ -46,7 +46,7 @@ export const callToolById = createAsyncThunk<
const selectedChatModel = selectSelectedChatModel(state);
posthog.capture("gui_tool_call_decision", {
posthog.capture("tool_call_decision", {
model: selectedChatModel,
decision: isAutoApproved ? "auto_accept" : "accept",
toolName: toolCallState.toolCall.function.name,
@ -135,7 +135,7 @@ export const callToolById = createAsyncThunk<
// Capture telemetry for tool call execution outcome with duration
const duration_ms = Date.now() - startTime;
posthog.capture("gui_tool_call_outcome", {
posthog.capture("tool_call_outcome", {
model: selectedChatModel,
succeeded: !error,
toolName: toolCallState.toolCall.function.name,

View file

@ -27,7 +27,7 @@ export const cancelToolCallThunk = createAsyncThunk<
if (toolCallState) {
// Track tool call rejection
posthog.capture("gui_tool_call_decision", {
posthog.capture("tool_call_decision", {
model: selectedChatModel,
decision: "reject",
toolName: toolCallState.toolCall.function.name,

View file

@ -567,7 +567,7 @@ describe("streamResponseThunk - tool calls", () => {
// Verify telemetry events for auto-approved tool execution
// Use partial matching to allow additional fields (e.g. model) in payload
expect(mockPosthog.capture).toHaveBeenCalledWith(
"gui_tool_call_decision",
"tool_call_decision",
expect.objectContaining({
decision: "auto_accept",
toolName: "search_codebase",
@ -576,11 +576,11 @@ describe("streamResponseThunk - tool calls", () => {
);
expect(mockPosthog.capture).toHaveBeenCalledWith(
"gui_tool_call_outcome",
"tool_call_outcome",
expect.objectContaining({
succeeded: true,
toolName: "search_codebase",
errorMessage: undefined,
errorReason: undefined,
duration_ms: expect.any(Number),
}),
);
@ -2819,7 +2819,7 @@ describe("streamResponseThunk - tool calls", () => {
// Verify telemetry events for manual approval flow
// Use partial matching to allow additional fields (e.g. model) in payload
expect(mockPosthog.capture).toHaveBeenCalledWith(
"gui_tool_call_decision",
"tool_call_decision",
expect.objectContaining({
decision: "accept",
toolName: "search_codebase",
@ -2828,11 +2828,11 @@ describe("streamResponseThunk - tool calls", () => {
);
expect(mockPosthog.capture).toHaveBeenCalledWith(
"gui_tool_call_outcome",
"tool_call_outcome",
expect.objectContaining({
succeeded: true,
toolName: "search_codebase",
errorMessage: undefined,
errorReason: undefined,
duration_ms: expect.any(Number),
}),
);

View file

@ -58,9 +58,7 @@ describe("multiEditImpl", () => {
it("should throw if edits array is empty", async () => {
await expect(
multiEditImpl({ filepath: "test.txt", edits: [] }, "id", mockExtras),
).rejects.toThrow(
"edits array is required and must contain at least one edit",
);
).rejects.toThrow("edits array must contain at least one edit");
});
it("should throw if edit has invalid old_string", async () => {