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

Function exitWithNoMatchingRequestError

test/harness/replayingCapiProxy.ts:588–636  ·  view source on GitHub ↗
(
  options: PerformRequestOptions,
  testInfo: { file: string; line?: number } | undefined,
  workDir: string,
  toolResultNormalizers: ToolResultNormalizer[],
  storedData?: NormalizedData,
)

Source from the content-addressed store, hash-verified

586}
587
588async function exitWithNoMatchingRequestError(
589 options: PerformRequestOptions,
590 testInfo: { file: string; line?: number } | undefined,
591 workDir: string,
592 toolResultNormalizers: ToolResultNormalizer[],
593 storedData?: NormalizedData,
594) {
595 let diagnostics: string;
596 try {
597 const normalized = await parseAndNormalizeRequest(
598 options.body,
599 workDir,
600 toolResultNormalizers,
601 );
602 const requestMessages = normalized.conversations[0]?.messages ?? [];
603
604 let rawMessages: unknown[] = [];
605 try {
606 rawMessages =
607 (JSON.parse(options.body ?? "{}") as { messages?: unknown[] })
608 .messages ?? [];
609 } catch {
610 /* non-JSON body */
611 }
612
613 diagnostics = diagnoseMatchFailure(
614 requestMessages,
615 rawMessages,
616 storedData,
617 );
618 } catch (e) {
619 diagnostics = `(unable to parse request for diagnostics: ${e})`;
620 }
621
622 const errorMessage = `No cached response found for ${options.requestOptions.method} ${options.requestOptions.path}.\n${diagnostics}`;
623
624 // Format as GitHub Actions annotation when test location is available
625 const annotation = [
626 testInfo?.file ? `file=${testInfo.file}` : "",
627 typeof testInfo?.line === "number" ? `line=${testInfo.line}` : "",
628 ]
629 .filter(Boolean)
630 .join(",");
631 process.stderr.write(
632 `::error${annotation ? ` ${annotation}` : ""}::${errorMessage}\n`,
633 );
634
635 options.onError(new Error(errorMessage));
636}
637
638async function findSavedChatCompletionResponse(
639 storedData: NormalizedData,

Callers 1

performRequestMethod · 0.85

Calls 6

parseAndNormalizeRequestFunction · 0.85
diagnoseMatchFailureFunction · 0.85
parseMethod · 0.80
joinMethod · 0.80
writeMethod · 0.45
onErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…