|
| 1 | +# Visual Studio Copilot Trace Format |
| 2 | + |
| 3 | +Visual Studio Copilot trace data is not the same format as VS Code Copilot chat |
| 4 | +sessions. |
| 5 | + |
| 6 | +VS Code Copilot stores app-level chat session documents. Visual Studio Copilot |
| 7 | +stores OpenTelemetry-style trace JSONL, where each JSONL line is a trace |
| 8 | +envelope containing spans. |
| 9 | + |
| 10 | +## VS Code Copilot Format |
| 11 | + |
| 12 | +VS Code Copilot session files are usually found under paths like: |
| 13 | + |
| 14 | +```text |
| 15 | +workspaceStorage/<hash>/chatSessions/<uuid>.json |
| 16 | +workspaceStorage/<hash>/chatSessions/<uuid>.jsonl |
| 17 | +globalStorage/emptyWindowChatSessions/<uuid>.json |
| 18 | +globalStorage/transferredChatSessions/<uuid>.json |
| 19 | +``` |
| 20 | + |
| 21 | +The top-level shape is a chat session object: |
| 22 | + |
| 23 | +- Session ID is usually `sessionId`. |
| 24 | +- Turns are stored in `requests[]`. |
| 25 | +- User prompts are stored in `requests[].message.text`. |
| 26 | +- Assistant and tool output are stored in `requests[].response[]`. |
| 27 | +- One file generally represents one chat session. |
| 28 | + |
| 29 | +Sanitized shape: |
| 30 | + |
| 31 | +```json |
| 32 | +{ |
| 33 | + "version": 3, |
| 34 | + "sessionId": "<uuid>", |
| 35 | + "creationDate": 1781293600000, |
| 36 | + "lastMessageDate": 1781293610000, |
| 37 | + "requests": [ |
| 38 | + { |
| 39 | + "requestId": "<uuid>", |
| 40 | + "message": { |
| 41 | + "text": "<user prompt>" |
| 42 | + }, |
| 43 | + "response": [ |
| 44 | + { |
| 45 | + "kind": "textEditGroup", |
| 46 | + "value": "<assistant-or-tool-output>" |
| 47 | + } |
| 48 | + ], |
| 49 | + "modelId": "<model>", |
| 50 | + "timestamp": 1781293600000 |
| 51 | + } |
| 52 | + ] |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +## Visual Studio Copilot Format |
| 57 | + |
| 58 | +Visual Studio Copilot trace files are usually found under: |
| 59 | + |
| 60 | +```text |
| 61 | +%LOCALAPPDATA%\Temp\VSGitHubCopilotLogs\traces\*_VSGitHubCopilot_traces.jsonl |
| 62 | +``` |
| 63 | + |
| 64 | +Each line is an OpenTelemetry JSON envelope: |
| 65 | + |
| 66 | +- `resourceSpans[]` |
| 67 | +- `scopeSpans[]` |
| 68 | +- `spans[]` |
| 69 | +- `attributes[]` |
| 70 | + |
| 71 | +Session data is reconstructed from span attributes: |
| 72 | + |
| 73 | +- Conversation ID is `gen_ai.conversation.id`. |
| 74 | +- Chat input is `gen_ai.input.messages`. |
| 75 | +- Chat output is `gen_ai.output.messages`. |
| 76 | +- Tool calls use `gen_ai.tool.name`, `gen_ai.tool.call.id`, and |
| 77 | + `gen_ai.tool.call.arguments`. |
| 78 | +- Tool results use `gen_ai.tool.call.result`. |
| 79 | +- Token usage uses `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. |
| 80 | +- Multiple trace files can contain spans for the same conversation, so the |
| 81 | + parser stitches them together by `gen_ai.conversation.id`. |
| 82 | + |
| 83 | +## Sanitized Visual Studio Examples |
| 84 | + |
| 85 | +These examples preserve the structure of real Visual Studio Copilot trace JSONL |
| 86 | +spans while redacting prompts, paths, commands, patches, IDs, and results. |
| 87 | + |
| 88 | +### Chat Span |
| 89 | + |
| 90 | +```json |
| 91 | +{ |
| 92 | + "sourceFile": "20260615T234102_b45c44b2_VSGitHubCopilot_traces.jsonl", |
| 93 | + "traceId": "<trace-id>", |
| 94 | + "spanId": "<span-id>", |
| 95 | + "name": "chat gpt-5.5", |
| 96 | + "startTimeUnixNano": "<unix-nano>", |
| 97 | + "endTimeUnixNano": "<unix-nano>", |
| 98 | + "attributes": { |
| 99 | + "virtual_parent.genai": "905ec1a433bff543", |
| 100 | + "gen_ai.provider.name": "github", |
| 101 | + "gen_ai.request.model": "<model>", |
| 102 | + "gen_ai.response.model": "<model>", |
| 103 | + "gen_ai.response.id": "<redacted>", |
| 104 | + "gen_ai.response.finish_reasons": "", |
| 105 | + "gen_ai.usage.input_tokens": "94179", |
| 106 | + "gen_ai.usage.output_tokens": "218", |
| 107 | + "gen_ai.conversation.id": "<uuid-or-call-id>", |
| 108 | + "copilot_chat.client_id": "Microsoft.VisualStudio.Conversations.Chat.HelpWindow", |
| 109 | + "copilot_chat.root_request_id": "<uuid-or-call-id>", |
| 110 | + "server.address": "api.githubcopilot.com", |
| 111 | + "gen_ai.tool.definitions": "<redacted>", |
| 112 | + "gen_ai.input.messages": "[{\"role\":\"user\",\"parts\":[{\"type\":\"text\",\"content\":\"<user prompt>\"}]}]", |
| 113 | + "gen_ai.output.messages": "[{\"role\":\"assistant\",\"parts\":[{\"type\":\"tool_call\",\"id\":\"<call-id>\",\"name\":\"<tool-name>\",\"arguments\":\"<json-encoded-arguments>\"},{\"type\":\"text\",\"content\":\"<assistant text>\"}]}]", |
| 114 | + "gen_ai.operation.name": "chat" |
| 115 | + } |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +### Tool Execution Span |
| 120 | + |
| 121 | +```json |
| 122 | +{ |
| 123 | + "sourceFile": "20260615T234059_b45c44b2_VSGitHubCopilot_traces.jsonl", |
| 124 | + "traceId": "<trace-id>", |
| 125 | + "spanId": "<span-id>", |
| 126 | + "name": "execute_tool get_file", |
| 127 | + "startTimeUnixNano": "<unix-nano>", |
| 128 | + "endTimeUnixNano": "<unix-nano>", |
| 129 | + "attributes": { |
| 130 | + "virtual_parent.genai": "26401e75c1171a63", |
| 131 | + "gen_ai.conversation.id": "<uuid-or-call-id>", |
| 132 | + "gen_ai.tool.call.result": "{\"Value\":\"<tool result>\"}", |
| 133 | + "gen_ai.provider.name": "other", |
| 134 | + "gen_ai.tool.name": "get_file", |
| 135 | + "gen_ai.tool.call.id": "<uuid-or-call-id>", |
| 136 | + "gen_ai.tool.type": "extension", |
| 137 | + "gen_ai.tool.description": "<redacted>", |
| 138 | + "gen_ai.tool.call.arguments": "{\"filename\":\"<path>\",\"command\":\"<command>\",\"patch\":\"<patch>\"}", |
| 139 | + "gen_ai.operation.name": "execute_tool" |
| 140 | + } |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +### Invoke-Agent Span |
| 145 | + |
| 146 | +```json |
| 147 | +{ |
| 148 | + "sourceFile": "20260615T234059_b45c44b2_VSGitHubCopilot_traces.jsonl", |
| 149 | + "traceId": "<trace-id>", |
| 150 | + "spanId": "<span-id>", |
| 151 | + "name": "invoke_agent GitHub Copilot", |
| 152 | + "startTimeUnixNano": "<unix-nano>", |
| 153 | + "endTimeUnixNano": "<unix-nano>", |
| 154 | + "attributes": { |
| 155 | + "gen_ai.provider.name": "other", |
| 156 | + "gen_ai.agent.name": "GitHub Copilot", |
| 157 | + "gen_ai.conversation.id": "<uuid-or-call-id>", |
| 158 | + "gen_ai.request.model": "<model>", |
| 159 | + "copilot_chat.turn_count": "1", |
| 160 | + "copilot_chat.client_id": "Microsoft.VisualStudio.Conversations.Chat.HelpWindow", |
| 161 | + "copilot_chat.entry_point": "Microsoft.VisualStudio.Copilot.AgentModeResponder", |
| 162 | + "copilot_chat.mode": "Agent", |
| 163 | + "copilot_chat.initiator_type": "User", |
| 164 | + "copilot_chat.root_request_id": "<uuid-or-call-id>", |
| 165 | + "gen_ai.operation.name": "invoke_agent" |
| 166 | + } |
| 167 | +} |
| 168 | +``` |
| 169 | + |
| 170 | +## Parser Implications |
| 171 | + |
| 172 | +The Visual Studio parser treats the trace data as telemetry that must be |
| 173 | +reconstructed into a transcript: |
| 174 | + |
| 175 | +- It groups spans by `gen_ai.conversation.id`. |
| 176 | +- It reads user turns from the stringified `gen_ai.input.messages` payload. |
| 177 | +- It reads assistant text and tool-call proposals from the stringified |
| 178 | + `gen_ai.output.messages` payload. |
| 179 | +- It reads executed tool calls and tool results from separate `execute_tool` |
| 180 | + spans. |
| 181 | +- It de-duplicates repeated prompt snapshots and duplicate chat/execute tool |
| 182 | + records for the same tool call ID. |
| 183 | +- It stitches sibling trace files because a single conversation can be split |
| 184 | + across multiple `*_VSGitHubCopilot_traces.jsonl` files. |
0 commit comments