MCPcopy Index your code
hub / github.com/github/copilot-sdk / findSavedChatCompletionError

Function findSavedChatCompletionError

test/harness/replayingCapiProxy.ts:675–704  ·  view source on GitHub ↗
(
  storedData: NormalizedData,
  requestBody: string | undefined,
  workDir: string,
  toolResultNormalizers: ToolResultNormalizer[],
)

Source from the content-addressed store, hash-verified

673}
674
675async function findSavedChatCompletionError(
676 storedData: NormalizedData,
677 requestBody: string | undefined,
678 workDir: string,
679 toolResultNormalizers: ToolResultNormalizer[],
680): Promise<NormalizedErrorResponse | undefined> {
681 const normalized = await parseAndNormalizeRequest(
682 requestBody,
683 workDir,
684 toolResultNormalizers,
685 );
686 const requestMessages = normalized.conversations[0]?.messages ?? [];
687 const requestModel = normalized.models[0];
688
689 for (const error of storedData.errors ?? []) {
690 if (error.model && error.model !== requestModel) {
691 continue;
692 }
693 if (
694 requestMessages.length === error.messages.length &&
695 requestMessages.every(
696 (msg, i) => JSON.stringify(msg) === JSON.stringify(error.messages[i]),
697 )
698 ) {
699 return error;
700 }
701 }
702
703 return undefined;
704}
705
706// Checks if the request matches a snapshot that has no assistant response.
707// This handles timeout test scenarios where the snapshot only records the request.

Callers 1

performRequestMethod · 0.85

Calls 1

parseAndNormalizeRequestFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…