Skip to content

Revert "Revert "Debug Panel: oTel data source support and Import/export (#299256)""#300477

Merged
vijayupadya merged 2 commits intomainfrom
revert-300381-sandy081/immediate-flea
Mar 10, 2026
Merged

Revert "Revert "Debug Panel: oTel data source support and Import/export (#299256)""#300477
vijayupadya merged 2 commits intomainfrom
revert-300381-sandy081/immediate-flea

Conversation

@vijayupadya
Copy link
Contributor

Reverts #300381

Copilot AI review requested due to automatic review settings March 10, 2026 16:32
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

⚠️ API Proposal Version Change Detected

The following proposed API files have version changes: vscode.proposed.chatDebug.d.ts

API proposal version changes should only be used when maintaining compatibility is not possible. Consider keeping the version as is and maintaining backward compatibility.

Any version changes must be adopted by the consuming extensions before the next insiders for the extension to work.


If the version change is required, comment /api-proposal-change-required to unblock this check and acknowledge that you will update any critical consuming extensions (Copilot Chat).

@vijayupadya vijayupadya marked this pull request as ready for review March 10, 2026 16:34
@vijayupadya vijayupadya enabled auto-merge (squash) March 10, 2026 16:34
@vijayupadya
Copy link
Contributor Author

/api-proposal-change-required

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>;

/**
/**
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
/**

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +46
/** 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>();
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
evt.inputTokens = dto.inputTokens;
evt.outputTokens = dto.outputTokens;
evt.totalTokens = dto.totalTokens;
evt.durationInMillis = dto.durationInMillis;
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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).

Suggested change
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];
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +178 to +188
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);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
// ensuring correct ordering and no stale duplicates.
// Navigation from new openEditor() options is handled by
// setOptions → _applyNavigationOptions (fires after this).
this.showView(this.viewState);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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();

Copilot uses AI. Check for mistakes.
@vijayupadya
Copy link
Contributor Author

/api-proposal-change-required

@vijayupadya
Copy link
Contributor Author

⚠️ API Proposal Version Change Detected

The following proposed API files have version changes: vscode.proposed.chatDebug.d.ts

API proposal version changes should only be used when maintaining compatibility is not possible. Consider keeping the version as is and maintaining backward compatibility.

Any version changes must be adopted by the consuming extensions before the next insiders for the extension to work.

If the version change is required, comment /api-proposal-change-required to unblock this check and acknowledge that you will update any critical consuming extensions (Copilot Chat).

/api-proposal-change-required

mjbvz added a commit to mjbvz/vscode that referenced this pull request Mar 10, 2026
@vijayupadya vijayupadya merged commit 34bfd71 into main Mar 10, 2026
19 of 20 checks passed
@vijayupadya vijayupadya deleted the revert-300381-sandy081/immediate-flea branch March 10, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants