Skip to content

Fix leaked Copilot CLI system notifications#321831

Open
meganrogge wants to merge 4 commits into
mainfrom
meganrogge/voice-mode-fixes
Open

Fix leaked Copilot CLI system notifications#321831
meganrogge wants to merge 4 commits into
mainfrom
meganrogge/voice-mode-fixes

Conversation

@meganrogge

@meganrogge meganrogge commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes leaked internal <system_notification> blocks showing in Copilot CLI chat for Agent Sessions.

This change strips notification tags from real system notification events and removes notification blocks from streamed assistant markdown, including when tags are split across deltas. It also adds regression coverage for the leaked background-agent completion transcript shape.

Fixes #321832
Fixes #321632

Copilot AI review requested due to automatic review settings June 17, 2026 20:03
@meganrogge meganrogge self-assigned this Jun 17, 2026
Strip system notification tags from notification content and remove notification blocks from streamed markdown so internal agent completion messages do not render in chat.

Co-authored-by: Copilot <[email protected]>
@meganrogge meganrogge force-pushed the meganrogge/voice-mode-fixes branch from cba2977 to c5b8c1c Compare June 17, 2026 20:04
@meganrogge meganrogge requested a review from anthonykim1 June 17, 2026 20:05
@meganrogge meganrogge added this to the 1.126.0 milestone Jun 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

This PR aims to prevent internal <system_notification> markup from surfacing in Copilot CLI chat output for Agent Sessions by cleaning notification event content and stripping notification blocks from assistant markdown (including streaming delta scenarios). It also includes several UI/behavior changes in the Agents Voice floating window/widget.

Changes:

  • Sanitize Copilot SDK system.notification content and strip <system_notification>…</system_notification> blocks from assistant markdown (full messages + streaming deltas).
  • Add regression tests covering multi-block background-agent completion notifications and tag-splitting across streamed deltas.
  • Update Agents Voice widget/window behavior (default sizing, resize-on-style-load, target-session clearing, mic error coloring, and a new voice bar component).
Show a summary per file
File Description
src/vs/workbench/contrib/agentsVoice/common/agentsVoice.ts Updates default Agents Voice window height constant.
src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.ts Adds/adjusts a compact voice bar with speaking/listening indicator and stop control.
src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.ts Updates mic button coloring logic to reflect error state.
src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.ts Adjusts aux window lifecycle (resize after styles load, clear target session on close/unload, mitigate resize position drift).
src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts Integrates the voice bar and tweaks status text behavior in error state.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Adds tests ensuring system-notification markup is removed from notifications and streamed assistant deltas.
src/vs/platform/agentHost/node/copilot/copilotSystemNotification.ts Introduces helpers to clean notification content and strip notification blocks.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Applies notification stripping to streamed markdown deltas and full assistant messages.

Copilot's findings

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

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts
Comment thread src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Outdated
…m, trim whitespace check

- Replace global _pendingMarkdownSystemNotificationPrefix and
  _isInMarkdownSystemNotification with a per-scope Map keyed by
  parentToolCallId to prevent interleaved subagent streams from
  leaking notification state into each other.
- Use .trim() when checking stripped content emptiness to avoid
  emitting blank chat parts from whitespace-only residue.

Co-authored-by: Copilot <[email protected]>
@meganrogge meganrogge marked this pull request as draft June 17, 2026 21:50
@anthonykim1

Copy link
Copy Markdown
Contributor

(latest insiders)
It's been hard for me to repro, wondering if we should still merge to stay defensive as much as possible
hardRepro

@sreePoojithaKalluru

Copy link
Copy Markdown

Preparing review...

2 similar comments
@sreePoojithaKalluru

Copy link
Copy Markdown

Preparing review...

@sreePoojithaKalluru

Copy link
Copy Markdown

Preparing review...

@meganrogge meganrogge force-pushed the meganrogge/voice-mode-fixes branch from bd82623 to 72bfdb7 Compare June 18, 2026 19:44
@meganrogge meganrogge removed this from the 1.126.0 milestone Jun 19, 2026
@meganrogge meganrogge marked this pull request as ready for review June 22, 2026 14:39
@meganrogge meganrogge added this to the 1.127.0 milestone Jun 22, 2026
@meganrogge

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

…-fixes

# Conflicts:
#	src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts

Co-authored-by: meganrogge <[email protected]>

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in ffcf8e3. Merged origin/main which had refactored markdownPartIds/reasoningPartIds into CopilotTurn — I moved markdownNotificationState into CopilotTurn as well, so the per-scope streaming notification stripping state is now scoped per turn (and cleaned up automatically on turn transitions rather than manually).

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.

Chat: system notification XML tags rendered raw in conversation Copilot CLI chat shows raw system notification tags

5 participants