Skip to content

Subagent turns appear as separate assistant messages after restoration #163

Closed

Description

@xinyi-gong

Problem

When a subagent executes (e.g. run_subagent tool call), its progress events are persisted as independent CopilotTurnData entries in the conversation JSON. When the conversation is restored from history, these subagent turns appear as separate assistant messages instead of being nested under the parent agent turn.

Root Cause

ChatView.onChatProgress() calls persistenceManager.cacheConversationProgress() for all progress events, including subagent events. updateConversationProgressInternal() creates a new CopilotTurnData for the subagent's turnId. Since subagent turnIds don't match any UserTurnData, they become orphaned copilot turns.

During restoration, restoreTurn() renders each CopilotTurnData as an independent assistant message, with no knowledge that it was a subagent execution.

Reproduction Steps

  1. Start a conversation in Agent mode
  2. Send a message that triggers subagent execution
  3. Wait for subagent to complete
  4. Open chat history, switch to another conversation, then switch back
  5. Observe: subagent tool calls appear as a separate assistant message below the parent turn
Image

Activity

  1. changed the title [-]Subagent turns persisted as independent CopilotTurnData, restored as separate assistant messages[/-] [+] Subagent turns appear as separate assistant messages after restoration[/+] on May 9, 2026
  2. added
    bug
    on May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions