3590
3591
this._register(wrapper.onSessionError(e => {
3592
>
this._logService.error(`[Copilot:${sessionId}] Session error: ${e.data.errorType} - ${e.data.message}`);
copilotAgentSession.ts
3593
>
// Prefer the structured SDK fields (the Copilot CLI classifies its own
3594
>
// CAPI errors); fall back to decoding a forwarded marker from the message.
3595
>
const meta = tryBuildChatErrorMetaFromFields(e.data) ?? tryBuildChatErrorMeta(e.data.message);
3596
>
this._emitAction({
3597
>
type: ActionType.ChatError,
3598
>
turnId: this._turnId,
3599
>
duration: this._currentTurn?.duration ?? 0,
3600
>
error: {
3601
>
errorType: e.data.errorType,
3602
>
message: stripProxyErrorMarker(e.data.message),
3603
>
stack: e.data.stack,
3604
>
...(meta ? { _meta: meta } : {}),
3605
>
},
3606
>
});
3607
}));
3608