preview 상태 고정과 no-LSP 언어 fallback 마감
목적: - 긴 세션, compact, query view 생성 시점에도 tool_result preview 축약 상태를 더 안정적으로 유지합니다. - 격리 환경에서 로컬 LSP 서버가 없더라도 코드 탭이 언어별 정적 분석 힌트를 계속 제공하도록 마감합니다. - 설정/프롬프트/로드맵 문서까지 현재 구현 상태와 일치시키고 남은 고도화 범위를 정리합니다. 핵심 수정: - AgentQueryContextBuilder와 ContextCondenser가 query/compact 진입 전에 누락된 tool_result preview를 먼저 복원하도록 정리했습니다. - AgentToolResultBudget는 sourceMessages가 없는 호출에서도 현재 window의 tool_use_id preview를 재사용하도록 보강했습니다. - CodeLanguageCatalog에 언어별 manifest/build/test/lint fallback 힌트를 추가하고, LspTool은 LSP 서버 미가동 시 정적 fallback 안내를 반환하도록 변경했습니다. - SettingsViewModel, SettingsWindow, ChatWindow.SystemPromptBuilder에 Fallback 분석 설명과 LSP 미사용 시 대체 분석 지침을 반영했습니다. - AgentQueryContextBuilderTests를 새로 추가하고 AgentToolResultBudgetTests, CodeLanguageCatalogTests를 확장했습니다. - README.md, docs/DEVELOPMENT.md, docs/AGENT_ROADMAP.md, docs/NEXT_ROADMAP.md를 2026-04-15 08:32 (KST) 기준으로 갱신했습니다. 검증: - dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify_loop_lang_finish\\ -p:IntermediateOutputPath=obj\\verify_loop_lang_finish\\ - dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter "AgentToolResultBudgetTests|AgentQueryContextBuilderTests|CodeLanguageCatalogTests|ContextCondenserTests" -p:OutputPath=bin\\verify_loop_lang_finish_tests\\ -p:IntermediateOutputPath=obj\\verify_loop_lang_finish_tests\\ (통과 20)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using AxCopilot.Models;
|
||||
using AxCopilot.Services.Agent;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace AxCopilot.Tests.Services;
|
||||
|
||||
public class AgentQueryContextBuilderTests
|
||||
{
|
||||
[Fact]
|
||||
public void Build_ShouldPopulateMissingToolResultPreviewBeforeCreatingQueryView()
|
||||
{
|
||||
var longContent = new string('Z', 1800);
|
||||
var sourceMessages = new List<ChatMessage>
|
||||
{
|
||||
new()
|
||||
{
|
||||
MsgId = "tool-source-1",
|
||||
Role = "user",
|
||||
Content = $$"""{"type":"tool_result","tool_use_id":"call-view","tool_name":"file_read","content":"{{longContent}}"}""",
|
||||
QueryPreviewContent = """{"type":"tool_result","tool_use_id":"call-view","tool_name":"file_read","content":"preview-view"}"""
|
||||
},
|
||||
new()
|
||||
{
|
||||
MsgId = "tool-source-2",
|
||||
Role = "user",
|
||||
Content = $$"""{"type":"tool_result","tool_use_id":"call-view","tool_name":"file_read","content":"{{longContent}}"}"""
|
||||
},
|
||||
new()
|
||||
{
|
||||
MsgId = "tail-1",
|
||||
Role = "assistant",
|
||||
Content = "recent tail"
|
||||
}
|
||||
};
|
||||
|
||||
var result = AgentQueryContextBuilder.Build(sourceMessages);
|
||||
|
||||
sourceMessages[1].QueryPreviewContent.Should().Be(sourceMessages[0].QueryPreviewContent);
|
||||
result.Messages[1].QueryPreviewContent.Should().Be(sourceMessages[0].QueryPreviewContent);
|
||||
}
|
||||
}
|
||||
@@ -98,4 +98,37 @@ public class AgentToolResultBudgetTests
|
||||
result.ReusedPreviewCount.Should().Be(1);
|
||||
queryView[0].Content.Should().Be(sourceMessages[0].QueryPreviewContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Apply_ShouldReusePreviewWithinSameWindow_WhenSourceMessagesAreOmitted()
|
||||
{
|
||||
var longContent = new string('C', 1600);
|
||||
var queryView = new List<ChatMessage>
|
||||
{
|
||||
new()
|
||||
{
|
||||
MsgId = "tool-1",
|
||||
Role = "user",
|
||||
Content = $$"""{"type":"tool_result","tool_use_id":"call-inline","tool_name":"file_read","content":"{{longContent}}"}""",
|
||||
QueryPreviewContent = """{"type":"tool_result","tool_use_id":"call-inline","tool_name":"file_read","content":"preview-inline"}"""
|
||||
},
|
||||
new()
|
||||
{
|
||||
MsgId = "tool-2",
|
||||
Role = "user",
|
||||
Content = $$"""{"type":"tool_result","tool_use_id":"call-inline","tool_name":"file_read","content":"{{longContent}}"}"""
|
||||
},
|
||||
new()
|
||||
{
|
||||
MsgId = "tail-1",
|
||||
Role = "assistant",
|
||||
Content = "recent tail"
|
||||
}
|
||||
};
|
||||
|
||||
var result = AgentToolResultBudget.Apply(queryView, protectedRecentNonSystemMessages: 1);
|
||||
|
||||
result.ReusedPreviewCount.Should().BeGreaterThan(0);
|
||||
queryView[1].QueryPreviewContent.Should().Be(queryView[0].QueryPreviewContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,15 @@ public class CodeLanguageCatalogTests
|
||||
CodeLanguageCatalog.BuildQuickSelectSupportDescription().Should().Contain("JavaScript / Vue");
|
||||
CodeLanguageCatalog.BuildQuickSelectSupportDescription().Should().NotContain("Go");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildFallbackSummary_ShouldExposeManifestAndBuildHints()
|
||||
{
|
||||
var summary = CodeLanguageCatalog.BuildFallbackSummary("sample.go");
|
||||
|
||||
summary.Should().Contain("정적 fallback 분석: Go");
|
||||
summary.Should().Contain("go.mod");
|
||||
summary.Should().Contain("go build ./...");
|
||||
summary.Should().Contain("go test ./...");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user