Skip to content

Support session reference attachment for agent host copilot#323773

Draft
anthonykim1 wants to merge 5 commits into
mainfrom
anthonykim1/attachmentSessionJune30
Draft

Support session reference attachment for agent host copilot#323773
anthonykim1 wants to merge 5 commits into
mainfrom
anthonykim1/attachmentSessionJune30

Conversation

@anthonykim1

@anthonykim1 anthonykim1 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Part of: #315193 (comment)

  • Include Agent Host Copilot sessions in session-reference attachment picker and #session: completions.
  • Convert sessionReference variables into Agent Host Simple attachments instead of dropping them.
  • Add session-reference attachment metadata so replay/resume restores the Sessions chip as kind: 'sessionReference'.
  • Include bounded referenced-session transcript text in the attachment modelRepresentation when available, with debug-event fallback for sessions whose transcript is exposed that way.
  • Reuse the shared Agent Host utility-context character budget when truncating attached session transcript text.
  • Add focused coverage for outgoing conversion, replay restore, transcript hydration, debug fallback, and malformed session-reference values.

Inspirations from:

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
@IWorkspaceTrustRequestService private readonly _workspaceTrustRequestService: IWorkspaceTrustRequestService,
@IChatResponseFileChangesService private readonly _chatResponseFileChangesService: IChatResponseFileChangesService,
@IChatSessionsService private readonly _chatSessionsService: IChatSessionsService,
@IChatDebugService private readonly _chatDebugService: IChatDebugService,

@anthonykim1 anthonykim1 Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@roblourens @connor4312 Copilot is having me add ChatDebugService to cover the scenario:

  • Type some message and send + get response from session A
  • Try to attach session from session A in session B.
  • In ideal scenario, it would know the content, but without this fallback to ChatDebugService way, this "relatively fresh session" scenario leads to:
Image

I don't really feel great adding both ChatSessionService and ChatDebugService, but it seems like ChatSessionService alone in the above scenario is not sufficient.

Could I get some wisdom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants