에이전트 루프 진단과 문서 golden 회귀를 마감한다
- AgentLoopService의 컨텍스트 압축 완료 메시지와 query-view 요약 문자열 조립을 AgentLoopDiagnosticsFormatter로 분리해 루프 본체의 책임을 더 줄였다. - ChatStorageService 로드 경로에서 legacy .axchat의 누락된 tool_result preview를 synthetic preview로 즉시 복원하도록 보강했다. - HTML/DOCX golden 회귀와 legacy 저장 경로 회귀 테스트를 추가해 PPTX/XLSX에 이어 문서 품질 고정 범위를 확대했다. - 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\verify_loop_storage_golden\ -p:IntermediateOutputPath=obj\verify_loop_storage_golden\ (경고 0, 오류 0) - 검증: dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter AgentLoopDiagnosticsFormatterTests|ChatStorageServiceTests|HtmlSkillGoldenReportTests|DocxSkillGoldenDocumentTests|AgentMessageInvariantHelperTests|PptxSkillGoldenDeckTests|ExcelSkillGoldenWorkbookTests -p:OutputPath=bin\verify_loop_storage_golden_tests\ -p:IntermediateOutputPath=obj\verify_loop_storage_golden_tests\ (통과 10)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using AxCopilot.Services.Agent;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace AxCopilot.Tests.Services;
|
||||
|
||||
public class AgentLoopDiagnosticsFormatterTests
|
||||
{
|
||||
[Fact]
|
||||
public void BuildCompactionCompleteMessage_ShouldIncludeStageSummaryAndSavedTokens()
|
||||
{
|
||||
var result = new ContextCompactionResult
|
||||
{
|
||||
BeforeTokens = 18_400,
|
||||
AfterTokens = 7_900,
|
||||
};
|
||||
result.AppliedStages.Add("tool-result");
|
||||
result.AppliedStages.Add("session-memory");
|
||||
|
||||
var message = AgentLoopDiagnosticsFormatter.BuildCompactionCompleteMessage(result);
|
||||
|
||||
message.Should().Be("컨텍스트 압축 완료 — tool-result -> session-memory · 10.3K tokens 절감");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildQueryViewSummary_ShouldIncludeWindowAndPreviewReuseMetrics()
|
||||
{
|
||||
var result = new AgentQueryContextWindowResult
|
||||
{
|
||||
Messages = new(),
|
||||
SourceMessageCount = 34,
|
||||
ViewMessageCount = 12,
|
||||
WindowStartIndex = 21,
|
||||
BoundaryApplied = true,
|
||||
ToolPairExpanded = true,
|
||||
PreservedToolPairCount = 2,
|
||||
TruncatedToolResultCount = 3,
|
||||
ReusedToolResultPreviewCount = 4,
|
||||
TokensBeforeBudget = 8_600,
|
||||
TokensAfterBudget = 6_100,
|
||||
};
|
||||
|
||||
var summary = AgentLoopDiagnosticsFormatter.BuildQueryViewSummary(result);
|
||||
|
||||
summary.Should().Be("query-view 34->12, start=21, pairs=2, tool_result_budget=3, tool_result_preview_reuse=4, tokens 8600->6100");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user