Skip to content

agentHost: fix empty client tool results - #320678

Merged
Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/315947-empty-tool-results
Jun 9, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/315947-empty-tool-results

Conversation

@connor4312

Copy link
Copy Markdown
Member

This ensures successful Copilot client tool calls always provide non-empty text to the SDK, using <empty /> when the tool only returns binary content or no text. Embedded resources are still forwarded unchanged so screenshots remain available to the model.

Fixes #315947

Validation:

  • npm run compile-check-ts-native
  • npm run valid-layers-check
  • env -u ELECTRON_RUN_AS_NODE ./scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts --grep "client tool calls"
  • node --experimental-strip-types build/hygiene.ts src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts
  • npm run precommit

Successful client tool calls now return a non-empty placeholder when they have no text content, while preserving embedded resources for the model.

Fixes #315947

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings June 9, 2026 21:35
@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) June 9, 2026 21:35

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 client tool results sent from the Agent Host to the Copilot SDK so that successful tool calls always include a non-empty textResultForLlm, using '<empty />' when the tool returns no text (e.g., embedded-resource-only results). This addresses scenarios like screenshot tools where the primary output is binary.

Changes:

  • Add an EMPTY_TOOL_RESULT_TEXT placeholder and apply it for successful client tool calls with empty/whitespace-only text content.
  • Preserve forwarding of embedded resources via binaryResultsForLlm while still supplying placeholder text.
  • Expand unit tests to cover both “no content at all” and “embedded-resource-only” successful tool results.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Ensures successful client tool call completions provide non-empty textResultForLlm, with '<empty />' when needed, while still forwarding embedded resources.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Adds/updates assertions to validate placeholder text behavior and embedded-resource-only result forwarding.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@connor4312
Connor Peet (connor4312) merged commit 8408349 into main Jun 9, 2026
26 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/315947-empty-tool-results branch June 9, 2026 22:06
@vs-code-engineering vs-code-engineering Bot added this to the 1.125.0 milestone Jun 9, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent Host: Agent can't see images returned by Integrated Browser screenshots tool

3 participants