AX Agent 진행 이력 파편 메시지 정제 및 렌더링 안정화

- 스트리밍 TextDelta와 Thinking summary에 공통 정제기를 적용해 1, [, file_read] 같은 저품질 파편 문구가 이벤트와 카드에 쌓이지 않도록 개선

- V2 라이브 진행 카드와 이력 렌더링에서 정제된 thinking summary만 표시하고 low-signal 조각은 숨기며 process feed는 안전한 기본 문구로 폴백

- AgentProgressSummarySanitizerTests와 AgentLoopResponseClassificationServiceTests를 추가/확장하고 dotnet build 경고 0 오류 0, 지정 테스트 22건 통과를 확인
This commit is contained in:
2026-04-15 12:51:53 +09:00
parent 5e40204e80
commit f3a31e97b1
10 changed files with 208 additions and 17 deletions

View File

@@ -39,4 +39,27 @@ public class AgentLoopResponseClassificationServiceTests
result.TextParts.Should().HaveCount(2);
result.NextConsecutiveNoToolResponses.Should().Be(2);
}
[Fact]
public void BuildThinkingSummary_ShouldDropTranscriptArtifacts()
{
var blocks = new List<ContentBlock>
{
new()
{
Type = "text",
Text = """
[이전 도구 호출: file_read]
1.
file_read]
.
"""
},
new() { Type = "tool_use", ToolName = "file_read", ToolId = "tool-1" }
};
var result = AgentLoopResponseClassificationService.Classify(blocks, consecutiveNoToolResponses: 0);
result.BuildThinkingSummary().Should().Be("실제 수정 범위를 다시 확인합니다.");
}
}

View File

@@ -0,0 +1,47 @@
using AxCopilot.Services.Agent;
using FluentAssertions;
using Xunit;
namespace AxCopilot.Tests.Services;
public class AgentProgressSummarySanitizerTests
{
[Theory]
[InlineData("1")]
[InlineData("1.")]
[InlineData("[")]
[InlineData("[O/")]
[InlineData("file_read]")]
public void NormalizeThinkingSummary_ShouldDropLowSignalFragments(string fragment)
{
AgentProgressSummarySanitizer.NormalizeThinkingSummary(fragment).Should().BeEmpty();
}
[Fact]
public void NormalizeThinkingSummary_ShouldStripPreviousToolCallTranscriptHints()
{
var summary = """
[이전 도구 호출: file_read]
1. time-clock.html .
""";
var normalized = AgentProgressSummarySanitizer.NormalizeThinkingSummary(summary);
normalized.Should().Be("time-clock.html 파일을 새로 생성했습니다.");
}
[Fact]
public void NormalizeThinkingSummary_ShouldTrimAndClampMeaningfulText()
{
var summary = """
1.
2. HTML .
""";
var normalized = AgentProgressSummarySanitizer.NormalizeThinkingSummary(summary, maxLength: 20);
normalized.Should().StartWith("현재 디렉터리 확인 중 필요한");
normalized.Should().EndWith("…");
}
}