Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ private ResumeSessionConfig CreateResumeConfig()
}

/// <summary>
/// Copies all supported properties from a source <see cref="SessionConfig"/> into a new instance
/// with <see cref="SessionConfig.Streaming"/> set to <c>true</c>.
/// Copies all supported properties from a source <see cref="SessionConfig"/> into a new instance,
/// preserving the <see cref="SessionConfig.Streaming"/> value from <paramref name="source"/> when set.
/// When <paramref name="source"/> has no explicit <see cref="SessionConfig.Streaming"/> value, streaming defaults to <c>true</c>.
/// </summary>
internal static SessionConfig CopySessionConfig(SessionConfig source)
{
Expand All @@ -298,13 +299,14 @@ internal static SessionConfig CopySessionConfig(SessionConfig source)
SkillDirectories = source.SkillDirectories,
DisabledSkills = source.DisabledSkills,
InfiniteSessions = source.InfiniteSessions,
Streaming = true
Streaming = source.Streaming ?? true
};
}

/// <summary>
/// Copies all supported properties from a source <see cref="SessionConfig"/> into a new
/// <see cref="ResumeSessionConfig"/> with <see cref="ResumeSessionConfig.Streaming"/> set to <c>true</c>.
/// <see cref="ResumeSessionConfig"/>, preserving the <see cref="SessionConfig.Streaming"/> value
/// from <paramref name="source"/>. When <paramref name="source"/> is <c>null</c>, streaming defaults to <c>true</c>.
/// </summary>
internal static ResumeSessionConfig CopyResumeSessionConfig(SessionConfig? source)
{
Expand All @@ -327,7 +329,7 @@ internal static ResumeSessionConfig CopyResumeSessionConfig(SessionConfig? sourc
SkillDirectories = source?.SkillDirectories,
DisabledSkills = source?.DisabledSkills,
InfiniteSessions = source?.InfiniteSessions,
Streaming = true
Streaming = source?.Streaming ?? true
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void CopySessionConfig_CopiesAllProperties()
OnUserInputRequest = userInputHandler,
McpServers = mcpServers,
DisabledSkills = ["skill1"],
Streaming = true,
};

// Act
Expand Down Expand Up @@ -180,6 +181,7 @@ public void CopyResumeSessionConfig_CopiesAllProperties()
OnUserInputRequest = userInputHandler,
McpServers = mcpServers,
DisabledSkills = ["skill1"],
Streaming = true,
};

// Act
Expand Down Expand Up @@ -222,6 +224,40 @@ public void CopyResumeSessionConfig_WithNullSource_ReturnsDefaults()
Assert.True(result.Streaming);
}

[Fact]
public void CopySessionConfig_WithStreamingFalse_PreservesStreamingFalse()
{
// Arrange — caller explicitly disables streaming (issue #4732)
var source = new SessionConfig
{
Streaming = false,
SystemMessage = new SystemMessageConfig { Mode = SystemMessageMode.Append, Content = "You are a helpful assistant." },
};

// Act
SessionConfig result = GitHubCopilotAgent.CopySessionConfig(source);

// Assert
Assert.False(result.Streaming);
}

[Fact]
public void CopyResumeSessionConfig_WithStreamingFalse_PreservesStreamingFalse()
{
// Arrange — caller explicitly disables streaming (issue #4732)
var source = new SessionConfig
{
Streaming = false,
SystemMessage = new SystemMessageConfig { Mode = SystemMessageMode.Append, Content = "You are a helpful assistant." },
};

// Act
ResumeSessionConfig result = GitHubCopilotAgent.CopyResumeSessionConfig(source);

// Assert
Assert.False(result.Streaming);
}

[Fact]
public void ConvertToAgentResponseUpdate_AssistantMessageEvent_DoesNotEmitTextContent()
{
Expand Down