Fix leaked Copilot CLI system notifications#321831
Conversation
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]>
cba2977 to
c5b8c1c
Compare
There was a problem hiding this comment.
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.notificationcontent 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
…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]>
|
Preparing review... |
2 similar comments
|
Preparing review... |
|
Preparing review... |
bd82623 to
72bfdb7
Compare
|
@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]>
Resolved in ffcf8e3. Merged |

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