Skip to content

fix: improve user prompt handling by ignoring non-text content and adding fallback options#324426

Merged
DonJayamanne merged 1 commit into
mainfrom
don/convinced-hedgehog
Jul 6, 2026
Merged

fix: improve user prompt handling by ignoring non-text content and adding fallback options#324426
DonJayamanne merged 1 commit into
mainfrom
don/convinced-hedgehog

Conversation

@DonJayamanne

Copy link
Copy Markdown
Contributor

Fixes #323696

Copilot AI review requested due to automatic review settings July 6, 2026 04:32
@DonJayamanne DonJayamanne self-assigned this Jul 6, 2026
@DonJayamanne DonJayamanne marked this pull request as ready for review July 6, 2026 04:33
@DonJayamanne DonJayamanne enabled auto-merge (squash) July 6, 2026 04:34

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

Fixes a Copilot CLI Agent failure where generateUserPrompt would throw when the rendered prompt included non-text parts (e.g. image content), by extracting only text parts and providing safe fallback behavior so agent sessions don’t abort (Issue #323696).

Changes:

  • Update generateUserPrompt to ignore non-text content and return concatenated text from rendered user messages.
  • Add fallback behavior to use the override prompt or original request.prompt when rendered user text is empty.
  • Expand unit tests to cover mixed content and fallback scenarios.
Show a summary per file
File Description
extensions/copilot/src/extension/prompts/node/agent/test/copilotCLIPrompt.spec.ts Updates tests to validate ignoring non-text content and exercising fallback prompt behavior.
extensions/copilot/src/extension/prompts/node/agent/copilotCLIPrompt.tsx Adjusts prompt extraction logic to ignore non-text parts and avoid throwing on unexpected prompt structures.

Review details

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

@DonJayamanne DonJayamanne disabled auto-merge July 6, 2026 04:52
@DonJayamanne DonJayamanne enabled auto-merge (squash) July 6, 2026 04:52
@DonJayamanne DonJayamanne merged commit bbefcbd into main Jul 6, 2026
30 checks passed
@DonJayamanne DonJayamanne deleted the don/convinced-hedgehog branch July 6, 2026 04:53
@vs-code-engineering vs-code-engineering Bot added this to the 1.128.0 milestone Jul 6, 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.

[CopilotCLISession] Unexpected generated prompt structure.

3 participants