185
186
const aiChunks = this._params.aiChunks ?? [];
188
>
const aiCharCount = useChunked ? aiChunks.reduce((sum, c) => sum + c.length, 0) : 0;
189
>
const scores = didFileGetDeleted
190
? { fourGram: 0, noRevert: 0 }
191
: useChunked
192
? computeChunkedEditSurvival(this._params.beforeText, this._params.afterText, aiChunks, currentText)
193
: computeWholeFileEditSurvival(this._params.beforeText, this._params.afterText, currentText);
195
>
// Sub-channel URIs (e.g. `ahp-chat:` for the default chat or
196
>
// subagent chats) encode the parent session URI; resolve them
197
>
// back so provider/id reflect the underlying harness rather than
198
>
// the chat scheme. See telemetry gap #6 in #8209.
199
>
const sessionUri = isAhpChatChannel(this._params.sessionUri) ? parseRequiredSessionUriFromChatUri(this._params.sessionUri) : this._params.sessionUri;
200
>
this._telemetryService.publicLog2<IEditSurvivalTelemetryEvent, IEditSurvivalTelemetryClassification>(
201
>
'agentHost.trackEditSurvival',
202
>
{
203
>
provider: AgentSession.provider(sessionUri) ?? 'unknown',
204
>
modelId: this._params.modelId ?? '',
205
>
toolName: this._params.toolName ?? '',
206
>
agentSessionId: AgentSession.id(sessionUri),
207
>
turnId: this._params.turnId,
208
>
toolCallId: this._params.toolCallId,
209
>
fileExtension: extname(this._params.filePath),
210
>
survivalRateFourGram: scores.fourGram,
211
>
survivalRateNoRevert: scores.noRevert,
212
>
scoringMode: useChunked ? 'chunked' : 'whole-file',
213
>
aiChunkCount: aiChunks.length,
214
>
aiCharCount,
215
>
timeDelayMs,
216
>
didFileGetDeleted: didFileGetDeleted ? 1 : 0,
217
>
isCreate: this._params.isCreate ? 1 : 0,
218
>
beforeTextLength: this._params.beforeText.length,
219
>
afterTextLength: this._params.afterText.length,
220
>
currentTextLength: didFileGetDeleted ? 0 : currentText.length,
221
>
},
222
>
);
223
>
224
>
if (didFileGetDeleted) {
225
// Once the file is gone all further samples would report
226
// the same; stop early.