Agent Debug Logs resolves Agent Host ID instead of Copilot SDK conversation ID
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes
### Summary
For Copilot Agent Host sessions, **Agent Debug Logs can show only the VS Code-side `Instructions Discovery` and `Hook Discovery` rows even though the underlying Copilot SDK session has a complete `events.jsonl` journal. The panel resolves the event journal using the Agent Host session ID, but the SDK persists that logical chat under a different SDK conversation ID.
### Environment
- VS Code `1.135.0` (`08d4889f9ec4a1685d257b9b95de036c8e1ce1e5`)
- macOS arm64
- Copilot running as the local Agent Host `copilotcli` provider (`agent-host-copilotcli`)
- `"chat.agentHost.agentDebugLog.enabled": true`
### Reproduction
1. Start a new VS Code Copilot Agent Host session (the SDK-backed Copilot / `agent-host-copilotcli` harness).
2. Send a request that produces normal model and/or tool activity.
3. Open **Agent Debug Logs** for that session.
### Actual result
The Logs view contains only the initial client-side customization-discovery events, for example:
```text
Instructions Discovery
Hook Discovery
```
There are no user-message, LLM, tool-call, tool-result, or agent-response events, and the panel does not show an error.
### Expected result
The panel should resolve the backing Copilot SDK conversation and render the event stream from its `events.jsonl`, including model and tool events.
### Investigation / suspected root cause
This was verified without exposing the contents of any prompts or tool payloads:
- The Agent Debug Logs breadcrumb identified the logical Agent Host session as `agent-host-copilotcli:/`.
- The VS Code per-session metadata at `agentSessionData//session.db` stored a **different** SDK conversation ID in `defaultChatProviderData`.
- The SDK event journal existed at `~/.copilot/session-state//events.jsonl`; it contained 821 ordered events at the time of inspection and referenced the Agent Host session.
- No `~/.copilot/session-state//events.jsonl` existed.
The debug provider appears to derive the journal location directly from the URI path via `getCopilotCliSessionRawId(sessionResource)` and then reads:
```text
~/.copilot/session-state//events.jsonl
```
When that file is absent, `AgentHostChatDebugContribution._provideChatDebugLog` returns `undefined`, so only events emitted independently by the VS Code client remain visible.
However, the Agent Host Copilot implementation already distinguishes the logical host session from its backing SDK conversation (`sdkConversationId`). The debug-log path resolution needs the same mapping instead of assuming that the host-session URI ID is the SDK conversation ID.
Relevant code:
- `src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.ts`
- `src/vs/workbench/contrib/chat/browser/copilotCliEventsUri.ts`
- `src/vs/platform/agentHost/node/copilot/copilotAgent.ts`
### Suggested fix
Resolve the backing SDK conversation ID for the active Agent Host chat/session first, then load `events.jsonl` from that SDK session directory. Ideally, make this an Agent Host/provider API rather than duplicating local filesystem and ID-resolution assumptions in the debug-panel provider. The same resolution should work for local, adopted/migrated, multi-chat, and remote Agent Host sessions.
### Impact
This makes Agent Debug Logs, `#debugEventsSnapshot`, and `/troubleshoot` largely unusable for affected VS Code-hosted Copilot sessions, while the exact same Copilot SDK/CLI session has a complete journal on disk.
Contributor guide
Assessment
This issue has not been assessed yet.