Repository navigation
fix(sessions): reconstruct Copilot transcripts from GenAI spans - #10
Conversation
Copilot lists sessions from session-start logs, but those events do not map to transcript roles, so opening a listed session 404ed. Build the conversation from matching GenAI spans instead. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The change addresses the distinction between a missing session and a known session without mapped log events. The existing backend test suite passes locally. I found four cases worth addressing before merging: 1. Preserve distinct imported transcript entriesTwo separate tool results can legitimately have identical timestamps and content. For example, the Claude importer can produce results for A regression test using the actual importer returns both results on Could we preserve distinct imported entries and use message/tool-call identity when correlating duplicates across sources? 2. Include related child spans with different session identifiersCopilot can use an internal conversation ID on the session-start log while a tool span carries only the VS Code chat-session ID. The parent agent span can contain both identifiers. With that arrangement, opening the listed session currently returns the user prompt but omits the related tool call and result. The same happens when a child has valid trace/parent IDs but no session attribute. Resolving alternate identifiers and parent/child relationships would cover these cases. The current test fixture gives every span the requested conversation ID, so it does not exercise this difference. 3. Recover assistant output available on the parent agent spanCopilot also records A fixture containing both a user prompt and an assistant response on the agent span returns only the prompt. Could we use the parent output as a fallback when child chat spans do not supply the response, while avoiding duplicate messages and token counts? 4. Use the tool’s completion time for its resultTool results currently receive a timestamp one millisecond after the span starts. A five-second tool invocation therefore appears to return after one millisecond. This can also reorder results for overlapping or nested calls. Using the span’s start time plus duration would preserve the actual completion order. Validation
I recommend addressing these cases and adding regression coverage before merging. |
Resolve Copilot child spans through session aliases and parent relationships. Preserve imported records and correlate live messages by span identity. Recover parent assistant output without duplicating child replies or usage, and timestamp tool results at completion. Add regression coverage for imported tool results, session boundaries, child identifiers, parent output, repeated replies, log/span correlation, and overlapping tools.
Summary
Copilot session-start logs make a session visible in the dashboard, but do not map to transcript roles. Opening those sessions previously returned 404 even when conversation content was available on GenAI spans. The transcript API now reconstructs the conversation from spans and returns an empty transcript for a known session when no message content is available. Addresses #9.
LogRecord.eventNameasevent.nameand recognize Copilot session-ID attributes.Validation
go test ./... -timeout 60s(isolated source directories for exporter tests).go vet ./....pnpm --dir frontend build.pnpm --dir frontend test:run— 294 tests passed.