I Let GitHub Copilot CLI Read a Failed AI-Agent Trace—Here’s What It Found A developer demonstrated that GitHub Copilot CLI can diagnose AI-agent failures from structured execution traces, using the AgentInspect MCP server to analyze a controlled TypeScript fixture. The experiment revealed a subtle bug where a formatter used the wrong optional field, causing a generic 'not enough project context' response despite successful retrieval. I use GitHub Copilot CLI for practical development work: understanding unfamiliar code, reviewing changes, generating tests, and debugging from the terminal. After writing my beginner’s guide to GitHub Copilot CLI https://dev.to/raajaryan/github-copilot-cli-for-beginners-2026-guide-real-use-cases-setup-prompting-workflow-tips-33gd , I wanted to test a harder question: Can a coding assistant diagnose an AI-agent failure from structured execution evidence instead of a wall of logs? This matters to me as a full-stack developer working with Next.js, TypeScript, MERN applications, and AI features across the broader TheCampusCoders ecosystem. A coding assistant can read source code, but an agent failure often depends on the path taken at runtime: which tool ran, what happened between retrieval and generation, and whether a technically successful run produced the expected behavior. For this experiment, I connected AgentInspect https://github.com/rajudandigam/agent-inspect to GitHub Copilot CLI through AgentInspect’s read-only MCP server. I used a controlled, keyless TypeScript fixture so that the same failure could be reproduced without an API key or a nondeterministic model response. Disclosure:I tested AgentInspect independently for the workflow described here. The maintainer reviewed the commands for technical accuracy; the conclusions are my own. @agent-inspect/mcp-server was inPreviewwhen I ran this experiment. The fixture represents a small project-help agent—the kind of assistant that could answer setup questions about a Next.js or MERN repository. Its path was simple: The retriever returned this shape: type RetrievedChunk = { id: string; text?: string; content?: string; }; But the formatter used the wrong optional field: function formatContext chunks: RetrievedChunk { return chunks .map chunk = chunk.content ?? "" // Bug: the data is in text .join "\n\n" ; } TypeScript did not reject this because content was permitted by the loose integration type. Retrieval succeeded, the formatter did not throw, and the answer step still ran. The visible symptom was only a generic “not enough project context” response. This was exactly the kind of bug I wanted to test. There was no dramatic stack trace pointing to one bad line. I tested with Node.js 20 or newer and pinned both AgentInspect packages to the published 6.17.4 baseline: npm install agent-inspect@6.17.4 npm install --save-dev @agent-inspect/mcp-server@6.17.4 I wrapped the workflow with inspectRun and named the important boundaries with step : js import { inspectRun, observeOutcome, step, } from "agent-inspect"; await inspectRun "project-help-agent-broken", async = { const chunks = await step.tool "retrieve project docs", retrieveProjectDocs, ; const context = await step "format context", = formatContext chunks , { type: "logic", metadata: { returnedField: "text", mapperField: "content", retrievedChunkCount: chunks.length, }, }, ; await step "validate context", async = { await observeOutcome "context available", { expectation: "At least one retrieved chunk contributes usable context", status: context.trim .length 0 ? "passed" : "failed", method: "custom", actual: { retrievedChunkCount: chunks.length, usableCharacterCount: context.trim .length, }, } ; }, { type: "logic", metadata: { retrievedChunkCount: chunks.length, usableCharacterCount: context.trim .length, }, }, ; return step.llm "deterministic-demo-model", = generateAnswer context , ; }, { traceDir: ".agent-inspect", silent: true, metadata: { scenario: "field-mapping-regression" }, }, ; Two details are important here. First, step.llm labels a boundary; it does not call a provider by itself. My fixture used a deterministic function so the experiment focused on the debugging loop rather than model variance. Second, I recorded counts and field names—not raw project documents, prompts, or answers. AgentInspect uses metadata-only capture by default, but metadata is still data, so I kept it bounded and non-sensitive. I ran the fixture, listed the latest trace, and inspected its report: npx agent-inspect list --dir .agent-inspect npx agent-inspect report