Skip to content

.NET: Fix CopySessionConfig to respect SessionConfig.Streaming#4797

Open
Protocol-zero-0 wants to merge 4 commits intomicrosoft:mainfrom
Protocol-zero-0:fix/session-config-streaming
Open

.NET: Fix CopySessionConfig to respect SessionConfig.Streaming#4797
Protocol-zero-0 wants to merge 4 commits intomicrosoft:mainfrom
Protocol-zero-0:fix/session-config-streaming

Conversation

@Protocol-zero-0
Copy link

Description

CopySessionConfig() and CopyResumeSessionConfig() in GitHubCopilotAgent.cs hardcode Streaming = true, ignoring the value from SessionConfig.Streaming. This makes it impossible to disable streaming output.

Changes

  • CopySessionConfig: Changed Streaming = true to Streaming = source.Streaming
  • CopyResumeSessionConfig: Changed Streaming = true to Streaming = source?.Streaming ?? true (preserves default behavior when source is null)

Fixes #4732

Made with Cursor

Copilot AI review requested due to automatic review settings March 19, 2026 20:40
Copy link
Contributor

Copilot AI left a comment

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 bug in the .NET GitHub Copilot agent adapter where session config copying forced streaming on, preventing callers from disabling streaming output.

Changes:

  • Update CopySessionConfig() to copy Streaming from the source SessionConfig.
  • Update CopyResumeSessionConfig() to copy Streaming when provided, defaulting to true when source is null.
  • Update XML docs to reflect the new streaming behavior.

@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file appears to have been saved without the UTF-8 BOM (many repo C# files start with //, and dotnet/.editorconfig specifies charset = utf-8-bom). Please re-save/format this file to restore the BOM to match repo conventions and avoid formatting churn/tooling mismatches.

Suggested change
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.

Copilot uses AI. Check for mistakes.
DisabledSkills = source.DisabledSkills,
InfiniteSessions = source.InfiniteSessions,
Streaming = true
Streaming = source.Streaming
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests for CopySessionConfig currently only assert the default Streaming value; they don’t cover the bug fix scenario where source.Streaming is explicitly set to false. Please add/adjust tests to verify Streaming is preserved from the source (including the false case).

Copilot uses AI. Check for mistakes.
DisabledSkills = source?.DisabledSkills,
InfiniteSessions = source?.InfiniteSessions,
Streaming = true
Streaming = source?.Streaming ?? true
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests for CopyResumeSessionConfig currently assert Streaming is true but don’t validate that an explicitly disabled source.Streaming = false is carried over. Please add/adjust tests to cover both source.Streaming = false and the source is null => Streaming defaults to true behavior.

Copilot uses AI. Check for mistakes.
@Protocol-zero-0
Copy link
Author

Updated. I restored the file BOM to match the repository encoding convention, and I expanded the unit coverage so both copy helpers now verify that an explicit Streaming = false value is preserved from the source. The existing null-source test still covers the source == null => Streaming defaults to true behavior.

@Protocol-zero-0
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: CopySessionConfig() hardcodes Streaming = true, ignoring SessionConfig.Streaming value

3 participants