Revert "Revert "Debug Panel: oTel data source support and Import/export (#299256)""#300477
Revert "Revert "Debug Panel: oTel data source support and Import/export (#299256)""#300477vijayupadya merged 2 commits intomainfrom
Conversation
|
|
/api-proposal-change-required |
There was a problem hiding this comment.
Pull request overview
This PR (despite the “revert” title/description) re-introduces and extends the Chat Debug proposed API and workbench integration to support exporting/importing agent debug logs, along with several UX improvements in the debug panel.
Changes:
- Add proposed API surface for exporting/importing chat debug logs (and bump the proposal version).
- Implement export/import plumbing across main thread ↔ extension host, and add UI actions to trigger export/import from the Agent Debug Panel.
- Improve debug panel rendering (log ordering/refresh scheduling, session titles, flow graph labels).
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.chatDebug.d.ts | Bumps proposal version and adds proposed API types/methods for debug log export/import. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Updates the chatDebug proposal version to match the d.ts bump. |
| src/vs/workbench/contrib/chat/common/chatDebugService.ts | Extends IChatDebugService/provider interfaces with export/import + imported session metadata helpers. |
| src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.ts | Implements export/import, core-vs-provider event detection, and imported session tracking. |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds RPC methods for export/import. |
| src/vs/workbench/api/common/extHostChatDebug.ts | Implements ext host RPC handlers and DTO→API event deserialization for export options. |
| src/vs/workbench/api/browser/mainThreadChatDebug.ts | Implements main thread provider wiring for export/import, passing core events + session title. |
| src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.ts | Adds “Export/Import Agent Debug Log…” actions and file dialog integration. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.ts | Adjusts editor visibility handling and auto-navigation when a new session is created. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.ts | Maintains chronological ordering via binary insertion and batches refreshes with a scheduler. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.ts | Refines session title selection for local vs imported sessions. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.ts | Avoids duplicating subagent description in subgraph headers. |
| src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.ts | Improves subagent labeling and event label/sublabel behavior. |
| resolveEvent(eventId: string): Promise<IChatDebugResolvedEventContent | undefined>; | ||
|
|
||
| /** | ||
| /** |
There was a problem hiding this comment.
The JSDoc for the new export/import methods has an extra opening /** which will break the comment formatting (and can confuse doc tooling). Remove the stray opening so there is a single well-formed JSDoc block for exportLog.
| /** |
| /** Session URIs created via import, allowed through the invokeProviders guard. */ | ||
| private readonly _importedSessions = new ResourceMap<boolean>(); | ||
|
|
||
| /** Human-readable titles for imported sessions. */ | ||
| private readonly _importedSessionTitles = new ResourceMap<string>(); |
There was a problem hiding this comment.
Imported sessions/titles are tracked in _importedSessions/_importedSessionTitles, but these maps are never cleared (not in clear(), endSession(), or dispose()). Over time this can grow without bound in long-running windows. Consider deleting entries for a session in endSession() (and/or clearing both maps in clear()/dispose()) when an imported session is no longer needed.
| evt.inputTokens = dto.inputTokens; | ||
| evt.outputTokens = dto.outputTokens; | ||
| evt.totalTokens = dto.totalTokens; | ||
| evt.durationInMillis = dto.durationInMillis; |
There was a problem hiding this comment.
_deserializeEvent drops requestName (and any other model-turn metadata present on the DTO) when reconstructing ChatDebugModelTurnEvent. As a result, extensions exporting core events via coreEvents won’t receive requestName even though it’s serialized on the main thread. Preserve the DTO fields on the reconstructed event (and add the corresponding properties to the event type if needed).
| evt.durationInMillis = dto.durationInMillis; | |
| evt.durationInMillis = dto.durationInMillis; | |
| // Preserve any additional model-turn metadata present on the DTO (for example, requestName) | |
| for (const key in dto as any) { | |
| if (!(key in (evt as any))) { | |
| (evt as any)[key] = (dto as any)[key]; | |
| } | |
| } |
| const result = await fileDialogService.showOpenDialog({ | ||
| defaultUri, | ||
| canSelectFiles: true, | ||
| filters: debugLogFilters | ||
| }); | ||
| if (!result) { | ||
| return; | ||
| } | ||
|
|
||
| const content = await fileService.readFile(result[0]); | ||
| const sessionUri = await chatDebugService.importLog(content.value.buffer); |
There was a problem hiding this comment.
showOpenDialog can return an empty array (not just undefined). The current check only guards undefined, but then result[0] is used unconditionally. Please also guard result.length > 0 before reading result[0] to avoid an out-of-bounds access.
| // ensuring correct ordering and no stale duplicates. | ||
| // Navigation from new openEditor() options is handled by | ||
| // setOptions → _applyNavigationOptions (fires after this). | ||
| this.showView(this.viewState); |
There was a problem hiding this comment.
setEditorVisible(false) no longer stops the active session pipeline (endActiveSession()), even though endActiveSession’s comment says it’s called when the editor becomes hidden. This can leave provider streaming running while the panel is hidden and makes the comment inaccurate. Either re-introduce cancelling on hide (if that’s still desired) or update the comment/ensure background work is acceptable.
| this.showView(this.viewState); | |
| this.showView(this.viewState); | |
| } else { | |
| // When the editor is hidden, end the active session so any ongoing | |
| // provider pipelines/streaming are cancelled. | |
| this.endActiveSession(); |
|
/api-proposal-change-required |
|
Needed to unblock microsoft#300477
Reverts #300381