Skip to content

Support Agent Host session attachments with Copilot CLI events.jsonl#323773

Merged
anthonykim1 merged 12 commits into
mainfrom
anthonykim1/attachmentSessionJune30
Jul 2, 2026
Merged

Support Agent Host session attachments with Copilot CLI events.jsonl#323773
anthonykim1 merged 12 commits into
mainfrom
anthonykim1/attachmentSessionJune30

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Part of: #315193

  • Scope Agent Host session-reference attachments to Copilot CLI sessions that resolve to a host-local events.jsonl.
  • Keep the visible Sessions chip by converting supported sessionReference variables into a small Simple attachment with replay metadata.
  • Attach the full Copilot CLI trajectory as a hidden Resource attachment pointing at events.jsonl, instead of packing transcript text into Simple.modelRepresentation.
  • Filter the Agent Host Sessions... picker to only show attachable Copilot CLI sessions when the current chat is Agent Host-backed.
  • Preserve normal/local/EH harness #session: completion behavior; this PR does not change non-Agent-Host session attachment behavior.
  • Keep hidden trajectory resources out of replay UI so reload/resume restores only the visible session chip.

Supported session matrix:

Referenced session Example URI Has events.jsonl path? This PR behavior
EH Copilot CLI copilotcli:/<id> Yes Attach visible session chip + hidden trajectory file
Local Agent Host Copilot CLI agent-host-copilotcli:/<id> Yes Attach visible session chip + hidden trajectory file
Remote Agent Host Copilot CLI remote-<authority>-copilotcli:/<id> Yes, when connection/home resolves Attach visible session chip + hidden trajectory file
Non-Copilot-CLI Agent Host sessions provider-specific AH URI No shared events.jsonl contract Not supported by this PR
Claude / local / other chat sessions provider-specific URI No shared events.jsonl contract Not shown in Agent Host attach picker and not converted as model context

Inspirations from:

  • Copilot CLI session URI to events.jsonl resolution comes from buildHostLocalEventsPath.
  • Existing Agent Host Copilot attachment forwarding maps Simple.modelRepresentation to a text/plain SDK blob and Resource attachments to SDK file/directory attachments in _toSdkAttachment.
  • Replay behavior restores visible simple attachments and skips hidden trajectory resources in messageAttachmentToVariableEntry.

Copilot AI review requested due to automatic review settings June 30, 2026 19:47
@anthonykim1 anthonykim1 self-assigned this Jun 30, 2026
@anthonykim1 anthonykim1 added this to the 1.128.0 milestone Jun 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables attaching session references for the agent-host Copilot flow by round-tripping session-reference variables through agent-host “simple” attachments, and enriching those attachments with referenced session transcript content when available.

Changes:

  • Add a session-reference attachment format (displayKind + metadata) and restoration helper.
  • Update agent-host variable→attachment conversion to hydrate referenced session transcripts via IChatSessionsService, with a debug-events fallback via IChatDebugService.
  • Expand session picker filtering to include agent-host Copilot sessions and add targeted tests for restore/convert paths.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts Adds tests for restoring session-reference attachments and for converting sessionReference variables into agent-host simple attachments (including transcript hydration scenarios).
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts Restores session-reference variable entries from simple attachments during state→variable reconstruction.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionReferenceAttachment.ts New helper module defining the session-reference attachment shape, metadata, transcript rendering helpers, and restoration logic.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Hydrates and serializes session-reference variables into attachments, including transcript embedding from session history or debug events.
src/vs/workbench/contrib/chat/browser/actions/chatContext.ts Includes AgentHostCopilot in the session provider filter for the session reference picker.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread src/vs/workbench/contrib/chat/browser/actions/chatContext.ts
@anthonykim1 anthonykim1 changed the title Support session reference attachment for agent host copilot Support Agent Host session attachments with Copilot CLI events.jsonl Jul 2, 2026
@anthonykim1 anthonykim1 marked this pull request as ready for review July 2, 2026 06:46
@anthonykim1 anthonykim1 merged commit 10341f2 into main Jul 2, 2026
29 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/attachmentSessionJune30 branch July 2, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants