Skip to content

agentHost: restore history using user turn boundaries#323284

Merged
roblourens merged 2 commits into
mainfrom
agents/async-subagents-issue-investigation
Jun 28, 2026
Merged

agentHost: restore history using user turn boundaries#323284
roblourens merged 2 commits into
mainfrom
agents/async-subagents-issue-investigation

Conversation

@roblourens

@roblourens roblourens commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

  • reconstruct Copilot SDK history using real top-level user messages as chat turn boundaries
  • keep markdown, tool calls, and multiple model rounds in one restored response
  • preserve completion and cancellation state for terminal empty messages, task completion, aborts, and subagent activity

Testing

  • npm run typecheck-client
  • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/mapSessionEvents.test.ts
  • npm run valid-layers-check
  • npm run precommit
  • replayed the production mapper across 1,859 captured local session histories; 15 pre-existing malformed base64 attachment histories were the only failures

Fixes #323283.

(Written by Copilot)

Skip non-renderable assistant events during session replay so they do not terminate the current turn and split restored responses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 27, 2026 18:50

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

This PR fixes Copilot session history replay so that empty/non-renderable assistant.message SDK events do not create unintended turn boundaries during reconstruction, preventing restored transcripts from splitting a single interaction into multiple chat responses.

Changes:

  • Skip assistant.message events that have no content, no reasoning text, and no tool requests during mapSessionEvents history replay.
  • Add a regression test covering an empty assistant event occurring between model rounds, ensuring subsequent markdown/tool output stays in the same reconstructed turn.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/mapSessionEvents.ts Ignores non-renderable empty assistant messages to avoid prematurely finalizing a parent turn during history replay.
src/vs/platform/agentHost/test/node/mapSessionEvents.test.ts Adds regression coverage to ensure empty assistant events don’t split one interaction into multiple restored turns.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

Use real top-level user messages as restored chat turn boundaries so multiple model rounds remain one response. Preserve completion and cancellation state for terminal empty messages, task completion, aborts, and subagent activity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens roblourens changed the title agentHost: ignore empty assistant history events agentHost: restore history using user turn boundaries Jun 28, 2026
@roblourens roblourens requested a review from Copilot June 28, 2026 02:10

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.

Review details

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

@roblourens roblourens marked this pull request as ready for review June 28, 2026 03:57
@roblourens roblourens enabled auto-merge (squash) June 28, 2026 03:58
@roblourens roblourens merged commit f0b9006 into main Jun 28, 2026
30 checks passed
@roblourens roblourens deleted the agents/async-subagents-issue-investigation branch June 28, 2026 04:54
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 28, 2026
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.

Copilot session restore splits one interaction into multiple chat responses

3 participants