Skip to content

Stream output for SDK built-in shell tool in agent host Copilot#326291

Draft
anthonykim1 wants to merge 2 commits into
microsoft:mainfrom
anthonykim1:anthonykim1/streamBuiltInShellTool
Draft

Stream output for SDK built-in shell tool in agent host Copilot#326291
anthonykim1 wants to merge 2 commits into
microsoft:mainfrom
anthonykim1:anthonykim1/streamBuiltInShellTool

Conversation

@anthonykim1

Copy link
Copy Markdown
Contributor

Resolves: #324825
Part of: #323399

  • Forward cumulative tool.execution_partial_result output from Copilot SDK bash and powershell calls into the running Agent Host tool call.
  • Refresh the inline terminal preview as output arrives instead of waiting for command completion.
  • Limit partial-result updates to tracked shell calls, ignoring untracked and non-shell tool output.
  • Preserve existing non-text tool content while replacing the previous text snapshot with the latest cumulative output.
  • Keep the existing AHP terminal resource and terminal/data path unchanged, documenting the future move to an output-only AHP terminal when the protocol and SDK expose the required capabilities.
  • Add coverage for cumulative output snapshots, untracked calls, and non-shell calls.

Inspirations from:

@anthonykim1 anthonykim1 self-assigned this Jul 17, 2026
Copilot AI review requested due to automatic review settings July 17, 2026 06:15
@anthonykim1 anthonykim1 added this to the 1.130.0 milestone Jul 17, 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

Streams Copilot SDK shell output into running Agent Host terminal previews.

Changes:

  • Emits partial shell output through ChatToolCallContentChanged.
  • Ignores untracked and non-shell partial results.
  • Adds coverage for streaming and filtering behavior.
Show a summary per file
File Description
copilotAgentSession.ts Forwards partial shell output to active tool calls.
copilotAgentSession.test.ts Tests partial-result handling and filtering.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

toolCallId: e.data.toolCallId,
content: [
...tracked.content.filter(content => content.type !== ToolResultContentType.Text),
{ type: ToolResultContentType.Text, text: e.data.partialOutput },
turnId: this._turnId,
toolCallId: e.data.toolCallId,
content: [
...tracked.content.filter(content => content.type !== ToolResultContentType.Text),

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.

Would ideally want something like: ToolResultContentType.TerminalOutput or TerminalStreaming, etc. not Text.

@anthonykim1 anthonykim1 Jul 17, 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.

Perhaps I should need to revisit ToolResultContentType in ahp. Maybe add a new type like TerminalProgress / CommandProgress , TerminalSnapShot , or evolve the TerminalComplete after changing name.. and then adding status: 'running' | completed, etc

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.

Allow streaming of command output

3 participants