ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / platform / agentHost / node / copilot / copilotFailureTelemetry.ts 460 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
import type { SessionEventPayload } from '@github/copilot-sdk' ;
import { getErrorCode } from '../../../../base/common/errors.js' ;
import type { URI } from '../../../../base/common/uri.js' ;
import { packErrorForTelemetry } from '../../../telemetry/common/errorTelemetry.js' ;
import type { ITelemetryService } from '../../../telemetry/common/telemetry.js' ;
import { AgentSession } from '../../common/agent.js' ;
import type { IAgentHostClientTelemetryContext } from '../../common/agentHostTelemetry.js'
getTelemetryChatSessionId
toInitiatorTelemetry
name
agentSessionId
chatSessionId
turnId
sdkSessionId
IAgentHostInitiatorTelemetry
agentSessionId
chatSessionId
turnId
sdkSessionId
normalizedCopilotApiEndpointKinds
endpoint CopilotModelCallEndpointTelemetryKind
endpoint
trimmedEndpoint endpoint
directMatch normalizedCopilotApiEndpointKinds trimmedEndpoint
directMatch
directMatch
trimmedEndpoint
parsed trimmedEndpoint
normalizedPath parsed pathname
parsed protocol parsed protocol normalizedPath
normalizedCopilotApiEndpointKinds normalizedPath
sessionUri chatUri turnId sdkSessionId clientContext IAgentHostClientTelemetryContext CopilotSessionFailureCorrelation
clientContext
agentSessionId AgentSession sessionUri
chatSessionId chatUri
turnId turnId
sdkSessionId
error CopilotClientOperationFailureKind
error
error message
error
error error
ICopilotFailureCorrelation
clientFailureId
failureKind CopilotClientOperationFailureKind
operation CopilotClientOperation
activeTurnCount
recoveryStarted
errorName
errorCode
msg
callstack
IAgentHostInitiatorClassification
clientFailureId classification purpose comment
failureKind classification purpose comment
operation classification purpose comment
agentSessionId classification purpose comment
chatSessionId classification purpose comment
turnId classification purpose comment
sdkSessionId classification purpose comment
activeTurnCount classification purpose isMeasurement comment
recoveryStarted classification purpose isMeasurement comment
errorName classification purpose comment
errorCode classification purpose comment
msg classification purpose comment
callstack classification purpose comment
owner
comment
outcome CopilotClientStartupOutcome
durationMs
attemptNumber
startupFailureCause CopilotStartupFailureCause
startupFailureResource CopilotStartupFailureResource
startupExitCode
outcome classification purpose comment
durationMs classification purpose isMeasurement comment
attemptNumber classification purpose isMeasurement comment
startupFailureCause classification purpose comment
startupFailureResource classification purpose comment
startupExitCode classification purpose isMeasurement comment
owner
comment
error Error CopilotStartupFailureCause
error
message error message
normalizedMessage message
normalizedMessage
normalizedMessage normalizedMessage
normalizedMessage normalizedMessage
normalizedMessage
message
message
message
message
message CopilotStartupFailureResource
normalizedMessage message
normalizedMessage
normalizedMessage
normalizedMessage normalizedMessage normalizedMessage
normalizedMessage
normalizedMessage
normalizedMessage
normalizedMessage
error Pick CopilotClientStartupEvent
error
startupFailureCause error
startupFailureCause
message error message
exitCodeMatch message
parsedExitCode exitCodeMatch groups exitCode exitCodeMatch groups exitCode
startupFailureCause
startupFailureResource message
startupExitCode parsedExitCode Number parsedExitCode parsedExitCode
telemetryService ITelemetryService
data Omit CopilotClientStartupEvent
error
failureDetails Pick CopilotClientStartupEvent
data outcome
failureDetails error
failureDetails startupFailureCause
failureDetails
startupFailureCause
startupFailureResource
telemetryService
data
failureDetails
telemetryService ITelemetryService
clientFailureId
failureKind CopilotClientOperationFailureKind
operation CopilotClientOperation
activeTurnCount
recoveryStarted
error
correlation ICopilotFailureCorrelation
packed error
telemetryService
clientFailureId
failureKind
operation
correlation
activeTurnCount
recoveryStarted
errorName error error name
errorCode error
msg packed msg
callstack packed callstack
clientFailureId
failureKind CopilotClientOperationFailureKind
durationMs
failedTurnCount
stopSucceeded
clientFailureId classification purpose comment
failureKind classification purpose comment
durationMs classification purpose isMeasurement comment
failedTurnCount classification purpose isMeasurement comment
stopSucceeded classification purpose isMeasurement comment
owner
comment
telemetryService ITelemetryService event CopilotClientRecoveryEvent
telemetryService event
CopilotSessionFailureCorrelation
clientFailureId
IAgentHostInitiatorClassification
clientFailureId classification purpose comment
agentSessionId classification purpose comment
chatSessionId classification purpose comment
turnId classification purpose comment
sdkSessionId classification purpose comment
owner
comment
telemetryService ITelemetryService clientFailureId correlation CopilotSessionFailureCorrelation
telemetryService
clientFailureId
correlation
CopilotSessionFailureCorrelation
sdkEventId
sdkParentEventId
sdkAgentId
errorType
errorCode
statusCode
providerCallId
serviceRequestId
eligibleForAutoSwitch
msg
callstack
IAgentHostInitiatorClassification
agentSessionId classification purpose comment
chatSessionId classification purpose comment
turnId classification purpose comment
sdkSessionId classification purpose comment
sdkEventId classification purpose comment
sdkParentEventId classification purpose comment
sdkAgentId classification purpose comment
errorType classification purpose comment
errorCode classification purpose comment
statusCode classification purpose isMeasurement comment
providerCallId classification purpose comment
serviceRequestId classification purpose comment
eligibleForAutoSwitch classification purpose isMeasurement comment
msg classification purpose comment
callstack classification purpose comment
owner
comment
telemetryService ITelemetryService event SessionEventPayload correlation CopilotSessionFailureCorrelation
telemetryService
correlation
sdkEventId event id
sdkParentEventId event parentId
sdkAgentId event agentId
errorType event data errorType
errorCode event data errorCode
statusCode event data statusCode
providerCallId event data providerCallId
serviceRequestId event data serviceRequestId
eligibleForAutoSwitch event data eligibleForAutoSwitch
msg event data message
callstack event data stack
CopilotSessionFailureCorrelation
sdkEventId
sdkParentEventId
sdkAgentId
failureKind
source
transport
apiEndpoint CopilotModelCallEndpointTelemetryKind
statusCode
durationMs
model
reasoningEffort
isAuto
isByok
rte
badRequestKind
apiCallId
providerCallId
serviceRequestId
messageCount
toolCallCount
toolResultMessageCount
namelessToolCallCount
imagePartCount
imagePartsMissingMediaType
IAgentHostInitiatorClassification
agentSessionId classification purpose comment
chatSessionId classification purpose comment
turnId classification purpose comment
sdkSessionId classification purpose comment
sdkEventId classification purpose comment
sdkParentEventId classification purpose comment
sdkAgentId classification purpose comment
failureKind classification purpose comment
source classification purpose comment
transport classification purpose comment
apiEndpoint classification purpose comment
statusCode classification purpose isMeasurement comment
durationMs classification purpose isMeasurement comment
model classification purpose comment
reasoningEffort classification purpose comment
isAuto classification purpose isMeasurement comment
isByok classification purpose isMeasurement comment
rte classification purpose isMeasurement comment
badRequestKind classification purpose comment
apiCallId classification purpose comment
providerCallId classification purpose comment
serviceRequestId classification purpose comment
messageCount classification purpose isMeasurement comment
toolCallCount classification purpose isMeasurement comment
toolResultMessageCount classification purpose isMeasurement comment
namelessToolCallCount classification purpose isMeasurement comment
imagePartCount classification purpose isMeasurement comment
imagePartsMissingMediaType classification purpose isMeasurement comment
owner
comment
telemetryService ITelemetryService event SessionEventPayload correlation CopilotSessionFailureCorrelation
fingerprint event data requestFingerprint
telemetryService
correlation
sdkEventId event id
sdkParentEventId event parentId
sdkAgentId event agentId
failureKind event data failureKind
source event data source
transport event data transport
apiEndpoint event data apiEndpoint
statusCode event data statusCode
durationMs event data durationMs
model event data isByok event data model
reasoningEffort event data reasoningEffort
isAuto event data isAuto
isByok event data isByok
rte event data rte
badRequestKind event data badRequestKind
apiCallId event data apiCallId
providerCallId event data providerCallId
serviceRequestId event data serviceRequestId
messageCount fingerprint messageCount
toolCallCount fingerprint toolCallCount
toolResultMessageCount fingerprint toolResultMessageCount
namelessToolCallCount fingerprint namelessToolCallCount
imagePartCount fingerprint imagePartCount
imagePartsMissingMediaType fingerprint imagePartsMissingMediaType
;
import
{
}
from
'../../common/agentTelemetryCorrelation.js'
;
import
{
,
type
IAgentHostInitiatorClassification
,
type
IAgentHostInitiatorTelemetry
}
from
'../agentHostTelemetryReporter.js'
;
export
type
CopilotClientOperation
=
'abort'
|
'changeAgent'
|
'changeModel'
|
'getSessionMetadata'
|
'listSessions'
|
'modelRefresh'
|
'resumeTurn'
|
'sendMessage'
;
export
type
CopilotClientOperationFailureKind
=
'clientNotConnected'
|
'connectionClosed'
|
'connectionDisposed'
|
'runtimeConnectionClosed'
;
type
CopilotClientStartupOutcome
=
'success'
|
'failure'
|
'cancelled'
;
type
CopilotStartupFailureCause
=
'nativeModuleProcedureNotFound'
|
'nativeModuleInitializationFailed'
|
'nativeModuleNotFound'
|
'permissionDenied'
|
'timeout'
|
'spawnFailed'
|
'processExitedUnexpectedly'
|
'processExited'
|
'configurationChanged'
|
'other'
;
type
CopilotStartupFailureResource
=
'runtime'
|
'cliNative'
|
'conpty'
|
'sandbox'
|
'other'
;
export
class
CopilotClientStartupConfigChangedError
extends
Error
{
constructor
(
)
{
super
(
'Copilot startup config changed while the client was starting'
)
;
this
.
=
'CopilotClientStartupConfigChangedError'
;
}
}
export
interface
ICopilotFailureCorrelation
extends
IAgentHostInitiatorTelemetry
{
readonly
?
:
string
;
readonly
?
:
string
;
readonly
?
:
string
;
readonly
?
:
string
;
}
type
CopilotSessionFailureCorrelation
=
&
{
readonly
:
string
;
readonly
:
string
;
readonly
:
string
|
undefined
;
readonly
:
string
;
}
;
export
type
CopilotModelCallEndpointTelemetryKind
=
'anthropicMessages'
|
'chatCompletions'
|
'other'
|
'responses'
|
'responsesWebSocket'
;
const
=
new
Map< string , CopilotModelCallEndpointTelemetryKind>
(
[
[
'/chat/completions'
,
'chatCompletions'
]
,
[
'/responses'
,
'responses'
]
,
[
'/v1/messages'
,
'anthropicMessages'
]
,
[
'ws:/responses'
,
'responsesWebSocket'
]
,
]
)
;
export
function
normalizeCopilotApiEndpoint
(
:
string
|
undefined
)
:
|
undefined
{
if
(
!
)
{
return
undefined
;
}
const
=
.
trim
(
)
;
const
=
.
get
(
.
toLowerCase
(
)
)
;
if
(
)
{
return
;
}
if
(
URL
.
canParse
(
)
)
{
const
=
new
URL
(
)
;
const
=
.
.
replace
(
/ \/ + $ /
,
''
)
||
'/'
;
if
(
(
.
===
'ws:'
||
.
===
'wss:'
)
&&
===
'/responses'
)
{
return
'responsesWebSocket'
;
}
return
.
get
(
.
toLowerCase
(
)
)
??
'other'
;
}
return
'other'
;
}
export
function
createCopilotFailureCorrelation
(
:
URI
,
:
URI
,
:
string
|
undefined
,
:
string
,
?
:
)
:
{
return
{
...
toInitiatorTelemetry
(
)
,
:
.
id
(
)
,
:
getTelemetryChatSessionId
(
)
,
:
||
undefined
,
,
}
;
}
export
function
classifyCopilotClientOperationFailure
(
:
unknown
)
:
|
undefined
{
if
(
!
(
instanceof
Error
)
)
{
return
undefined
;
}
switch
(
.
)
{
case
'Client not connected'
:
return
'clientNotConnected'
;
case
'Connection is closed.'
:
return
'connectionClosed'
;
case
'Connection is disposed.'
:
return
'connectionDisposed'
;
case
'The in-process runtime connection is closed.'
:
return
'runtimeConnectionClosed'
;
}
return
undefined
;
}
export
function
isRecognizedCopilotClientStartupFailure
(
:
unknown
)
:
boolean
{
return
instanceof
Error
&&
getCopilotStartupFailureCause
(
)
!==
undefined
;
}
type
CopilotClientOperationFailureEvent
=
&
{
:
string
;
:
;
:
;
:
number
;
:
boolean
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
;
:
string
|
undefined
;
}
;
type
CopilotClientOperationFailureClassification
=
&
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Identifier shared by detections and recovery telemetry for one Copilot client failure episode.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded category of Copilot client failure that was detected.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot provider operation that detected the client failure.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host session identifier, when the failing operation targeted a session.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host chat identifier, when the failing operation targeted a chat.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host turn identifier, when available.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK session identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'The number of Copilot chats with an active turn when the client failure was detected.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Whether this detection started client recovery instead of joining recovery already in progress.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The name of the client failure exception, when available.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The client failure exception or protocol error code, when available.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The client failure message. VS Code telemetry scrubs file paths and likely secrets before transmission.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The client failure stack. VS Code telemetry scrubs file paths and likely secrets before transmission.'
}
;
:
'roblourens'
;
:
'Tracks failures detected while operating an established Copilot client and whether recovery was started.'
;
}
;
type
CopilotClientStartupEvent
=
{
:
;
:
number
;
:
number
;
?
:
;
?
:
;
?
:
number
;
}
;
type
CopilotClientStartupClassification
=
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Whether the startup attempt succeeded, failed, or was cancelled during shutdown.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Wall-clock duration of the Copilot client startup attempt in milliseconds.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'One-based Copilot client startup attempt number within this Agent Host process.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded cause of a failed Copilot client startup attempt.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded Copilot CLI resource involved in a failed startup attempt.'
}
;
?
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'The Copilot CLI process exit code reported for a failed startup attempt.'
}
;
:
'roblourens'
;
:
'Tracks one terminal outcome for every Copilot client startup attempt.'
;
}
;
function
getCopilotStartupFailureCause
(
:
)
:
|
undefined
{
if
(
instanceof
CopilotClientStartupConfigChangedError
)
{
return
'configurationChanged'
;
}
const
=
.
;
const
=
.
toLowerCase
(
)
;
if
(
.
includes
(
'specified procedure could not be found'
)
)
{
return
'nativeModuleProcedureNotFound'
;
}
if
(
.
includes
(
'dynamic link library'
)
&&
.
includes
(
'initialization'
)
)
{
return
'nativeModuleInitializationFailed'
;
}
if
(
.
includes
(
'permission denied'
)
||
/ \b (?: eacces| eperm) \b /
.
test
(
)
)
{
return
'permissionDenied'
;
}
if
(
.
includes
(
'cannot find module'
)
)
{
return
'nativeModuleNotFound'
;
}
if
(
===
'Timeout waiting for CLI server to start'
)
{
return
'timeout'
;
}
if
(
.
startsWith
(
'Failed to start CLI server:'
)
)
{
return
'spawnFailed'
;
}
if
(
.
startsWith
(
'CLI server exited unexpectedly with code '
)
)
{
return
'processExitedUnexpectedly'
;
}
if
(
.
startsWith
(
'CLI server exited with code '
)
)
{
return
'processExited'
;
}
return
undefined
;
}
function
getCopilotStartupFailureResource
(
:
string
)
:
{
const
=
.
toLowerCase
(
)
;
if
(
.
includes
(
'cli-native'
)
)
{
return
'cliNative'
;
}
if
(
.
includes
(
'conpty'
)
)
{
return
'conpty'
;
}
if
(
.
includes
(
'runtime.node'
)
||
.
includes
(
'runtime.win32'
)
||
.
includes
(
'native addon "runtime"'
)
)
{
return
'runtime'
;
}
if
(
.
includes
(
'sandbox'
)
||
.
includes
(
'lxc-exec'
)
||
.
includes
(
'mxc-exec-mac'
)
||
.
includes
(
'wxc-exec.exe'
)
)
{
return
'sandbox'
;
}
return
'other'
;
}
function
getCopilotStartupFailureDetails
(
:
unknown
)
:
<
,
'startupFailureCause'
|
'startupFailureResource'
|
'startupExitCode'
>
{
if
(
!
(
instanceof
Error
)
)
{
return
{
}
;
}
const
=
getCopilotStartupFailureCause
(
)
;
if
(
!
)
{
return
{
}
;
}
const
=
.
;
const
=
/ ^ CLI server exited(?: unexpectedly) ? with code (?<exitCode > \d + ) /
.
exec
(
)
;
const
=
?.
?.
===
undefined
?
undefined
:
Number
(
.
.
)
;
return
{
,
:
getCopilotStartupFailureResource
(
)
,
:
!==
undefined
&&
.
isSafeInteger
(
)
?
:
undefined
,
}
;
}
export
function
reportCopilotClientStartup
(
:
,
:
<
,
'startupFailureCause'
|
'startupFailureResource'
|
'startupExitCode'
>
,
?
:
unknown
,
)
:
void
{
let
:
<
,
'startupFailureCause'
|
'startupFailureResource'
|
'startupExitCode'
>
=
{
}
;
if
(
.
===
'failure'
)
{
=
getCopilotStartupFailureDetails
(
)
;
if
(
!
.
)
{
=
{
:
'other'
,
:
'other'
,
}
;
}
}
.
publicLog2 < CopilotClientStartupEvent, CopilotClientStartupClassification>
(
'agentHost.copilotClientStartup'
,
{
...
,
...
,
}
)
;
}
export
function
reportCopilotClientOperationFailure
(
:
,
:
string
,
:
,
:
,
:
number
,
:
boolean
,
:
unknown
,
?
:
,
)
:
void
{
const
=
packErrorForTelemetry
(
)
;
.
publicLogError2 < CopilotClientOperationFailureEvent, CopilotClientOperationFailureClassification>
(
'agentHost.copilotClientFailure'
,
{
,
,
,
...
,
,
,
:
instanceof
Error
?
.
:
undefined
,
:
getErrorCode
(
)
,
:
.
,
:
.
,
}
)
;
}
type
CopilotClientRecoveryEvent
=
{
:
string
;
:
;
:
number
;
:
number
;
:
boolean
;
}
;
type
CopilotClientRecoveryClassification
=
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Identifier shared by detections and recovery telemetry for one Copilot client failure episode.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded category of Copilot client failure that initiated recovery.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Time in milliseconds spent recovering the failed Copilot client.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of active Agent Host turns failed during client recovery.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Whether stopping the failed Copilot client completed without throwing.'
}
;
:
'roblourens'
;
:
'Tracks the outcome of Copilot client recovery.'
;
}
;
export
function
reportCopilotClientRecovery
(
:
,
:
)
:
void
{
.
publicLog2 < CopilotClientRecoveryEvent, CopilotClientRecoveryClassification>
(
'agentHost.copilotClientRecovery'
,
)
;
}
type
CopilotClientRecoveryTurnEvent
=
&
{
:
string
;
}
;
type
CopilotClientRecoveryTurnClassification
=
&
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Identifier shared by all telemetry for one Copilot client failure episode.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host session identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host chat identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host turn failed during client recovery.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK session identifier.'
}
;
:
'roblourens'
;
:
'Correlates each turn failed during Copilot client recovery with its client failure episode.'
;
}
;
export
function
reportCopilotClientRecoveryTurn
(
:
,
:
string
,
:
)
:
void
{
.
publicLogError2 < CopilotClientRecoveryTurnEvent, CopilotClientRecoveryTurnClassification>
(
'agentHost.copilotClientRecoveryTurnFailed'
,
{
,
...
,
}
)
;
}
type
CopilotSdkSessionErrorEvent
=
&
{
:
string
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
;
:
string
|
undefined
;
:
number
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
boolean
|
undefined
;
:
string
;
:
string
|
undefined
;
}
;
type
CopilotSdkSessionErrorClassification
=
&
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host session identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host chat identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host turn identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK session identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK event identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The preceding Copilot SDK event identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK subagent identifier, when applicable.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The structured Copilot SDK session error type.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The upstream provider error code, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'The upstream HTTP status code, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The GitHub provider request identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot service request identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Whether the error can trigger an Auto model switch.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The SDK session error message. VS Code telemetry scrubs file paths and likely secrets before transmission.'
}
;
:
{
:
'CallstackOrException'
;
:
'PerformanceAndHealth'
;
:
'The SDK session error stack. VS Code telemetry scrubs file paths and likely secrets before transmission.'
}
;
:
'roblourens'
;
:
'Captures Copilot SDK session errors with Agent Host, SDK, and provider correlation identifiers.'
;
}
;
export
function
reportCopilotSdkSessionError
(
:
,
:
<
'session.error'
>
,
:
)
:
void
{
.
publicLogError2 < CopilotSdkSessionErrorEvent, CopilotSdkSessionErrorClassification>
(
'agentHost.copilotSdkSessionError'
,
{
...
,
:
.
,
:
.
??
undefined
,
:
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
}
)
;
}
type
CopilotModelCallFailureEvent
=
&
{
:
string
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
;
:
string
|
undefined
;
:
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
boolean
|
undefined
;
:
boolean
|
undefined
;
:
boolean
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
string
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
:
number
|
undefined
;
}
;
type
CopilotModelCallFailureClassification
=
&
{
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host session identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host chat identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Agent Host turn identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK session identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK event identifier.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The preceding Copilot SDK event identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot SDK subagent identifier, when applicable.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Whether the SDK model call failed at the API or transport boundary.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'Whether the model call came from the top-level agent, a subagent, or MCP sampling.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The HTTP or WebSocket transport used by the failed model call.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded API endpoint category used by the failed model call. Values are chatCompletions, responses, responsesWebSocket, anthropicMessages, or other.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'The HTTP status code, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Duration of the failed model call in milliseconds.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The provider model identifier used by the failed call.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The reasoning effort used by the failed call, when applicable.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Whether Auto selected the model for the failed call.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Whether the failed call used a bring-your-own-key provider.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'The SDK runtime RTE flag for the failed call, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The bounded HTTP 400 response category, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The model-provider completion identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The GitHub provider request identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
'The Copilot service request identifier, when available.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of messages in the failing request.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of tool calls in the failing request.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of tool-result messages in the failing request.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of tool calls with no name in the failing request.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of image parts in the failing request.'
}
;
:
{
:
'SystemMetaData'
;
:
'PerformanceAndHealth'
;
:
true
;
:
'Number of image parts missing a media type in the failing request.'
}
;
:
'roblourens'
;
:
'Captures structured Copilot SDK model-call failures. Raw model error messages remain restricted to SDK-owned telemetry and are not duplicated here.'
;
}
;
export
function
reportCopilotModelCallFailure
(
:
,
:
<
'model.call_failure'
>
,
:
)
:
void
{
const
=
.
.
;
.
publicLogError2 < CopilotModelCallFailureEvent, CopilotModelCallFailureClassification>
(
'agentHost.copilotModelCallFailure'
,
{
...
,
:
.
,
:
.
??
undefined
,
:
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
normalizeCopilotApiEndpoint
(
.
.
)
,
:
.
.
,
:
.
.
,
:
.
.
?
'byokModel'
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
.
.
,
:
?.
,
:
?.
,
:
?.
,
:
?.
,
:
?.
,
:
?.
,
}
)
;
}