Compare commits

...

1 Commits

Author SHA1 Message Date
abeatrix 9be0365399 fix(telemetry): prevent property shifting in workspace context tracking
Wrap workspace context properties in a dedicated object instead of
conditionally spreading them. This ensures that when workspaceContext
is not provided, the structure remains consistent and subsequent
properties like isNativeToolCall maintain their correct positions in
the telemetry payload.

Previously, the conditional spread operator could cause property
misalignment when workspaceContext was undefined, leading to
isNativeToolCall value being assigned to the wrong property.
2025-11-26 15:38:38 -08:00
+20 -13
View File
@@ -885,12 +885,14 @@ export class TelemetryService {
provider: string,
autoApproved: boolean,
success: boolean,
workspaceContext?: {
isMultiRootEnabled: boolean
usedWorkspaceHint: boolean
resolvedToNonPrimary: boolean
resolutionMethod: "hint" | "primary_fallback" | "path_detection"
},
workspaceContext:
| {
isMultiRootEnabled: boolean
usedWorkspaceHint: boolean
resolvedToNonPrimary: boolean
resolutionMethod: "hint" | "primary_fallback" | "path_detection"
}
| undefined = undefined,
isNativeToolCall = false,
) {
this.capture({
@@ -902,13 +904,18 @@ export class TelemetryService {
success,
modelId,
provider,
// Workspace context (optional)
...(workspaceContext && {
workspace_multi_root_enabled: workspaceContext.isMultiRootEnabled,
workspace_hint_used: workspaceContext.usedWorkspaceHint,
workspace_resolved_non_primary: workspaceContext.resolvedToNonPrimary,
workspace_resolution_method: workspaceContext.resolutionMethod,
}),
// Workspace context (optional) - set to undefined if not provided
// else the properties will not be included, and the value for isNativeToolCall will be shifted.
workspaceContext: {
...(workspaceContext
? {
workspace_multi_root_enabled: workspaceContext.isMultiRootEnabled,
workspace_hint_used: workspaceContext.usedWorkspaceHint,
workspace_resolved_non_primary: workspaceContext.resolvedToNonPrimary,
workspace_resolution_method: workspaceContext.resolutionMethod,
}
: undefined),
},
isNativeToolCall,
},
})