같은 탭 대화 전환 중에도 AX Agent 실행이 계속되도록 수정
- 실행 시작 대화를 탭별로 추적해 같은 탭에서 다른 대화로 이동하거나 새 대화를 시작해도 원래 대화에 이벤트와 완료 결과를 저장하도록 정리함 - 탭 복귀 시 진행 중인 대화를 다시 로드하고 백그라운드 실행 저장이 현재 선택 대화 ID를 덮어쓰지 않도록 세션/저장 경로를 보강함 - ChatSessionStateService와 AxAgentExecutionEngine 회귀 테스트를 추가하고 README.md, docs/DEVELOPMENT.md 이력을 갱신함 - 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\verify_conversation_background_resume\ -p:IntermediateOutputPath=obj\verify_conversation_background_resume\ (경고 0, 오류 0) - 검증: dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter ChatSessionStateServiceTests|AxAgentExecutionEngineTests -p:OutputPath=bin\verify_conversation_background_resume_tests\ -p:IntermediateOutputPath=obj\verify_conversation_background_resume_tests\ (통과 39)
This commit is contained in:
@@ -85,8 +85,9 @@ public partial class ChatWindow
|
||||
var session = _appState.ChatSession;
|
||||
if (session != null)
|
||||
{
|
||||
var targetConversation = GetStreamingConversation(eventTab);
|
||||
var result = _chatEngine.AppendExecutionEvent(
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt);
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt, targetConversation);
|
||||
// 방어: 결과 대화가 빈 대화로 교체되는 것을 방지
|
||||
// EnsureCurrentConversation이 기존 대화 대신 새 빈 대화를 생성하는 경우 발생
|
||||
var resultConv = result.CurrentConversation;
|
||||
@@ -126,8 +127,9 @@ public partial class ChatWindow
|
||||
if (session != null)
|
||||
{
|
||||
var summary = string.IsNullOrWhiteSpace(evt.Summary) ? "작업 완료" : evt.Summary;
|
||||
var targetConversation = GetStreamingConversation(eventTab);
|
||||
var result = _chatEngine.AppendAgentRun(
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt, "completed", summary);
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt, "completed", summary, targetConversation);
|
||||
// 방어: Complete 이벤트에서도 대화 교체 보호
|
||||
var completeMsgCount = result.CurrentConversation?.Messages?.Count ?? 0;
|
||||
var existingMsgCount = _currentConversation?.Messages?.Count ?? 0;
|
||||
@@ -160,8 +162,9 @@ public partial class ChatWindow
|
||||
if (session != null)
|
||||
{
|
||||
var summary = string.IsNullOrWhiteSpace(evt.Summary) ? "에이전트 실행 실패" : evt.Summary;
|
||||
var targetConversation = GetStreamingConversation(eventTab);
|
||||
var result = _chatEngine.AppendAgentRun(
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt, "failed", summary);
|
||||
session, _storage, _currentConversation, activeTab, eventTab, evt, "failed", summary, targetConversation);
|
||||
_currentConversation = result.CurrentConversation;
|
||||
pendingPersist = result.UpdatedConversation;
|
||||
}
|
||||
@@ -185,7 +188,12 @@ public partial class ChatWindow
|
||||
{
|
||||
_storage.Save(pendingPersist);
|
||||
var rememberTab = pendingPersist.Tab ?? "Cowork";
|
||||
_appState.ChatSession?.RememberConversation(rememberTab, pendingPersist.Id);
|
||||
var session = _appState.ChatSession;
|
||||
if (session?.CurrentConversation != null
|
||||
&& string.Equals(session.CurrentConversation.Id, pendingPersist.Id, StringComparison.Ordinal))
|
||||
{
|
||||
session.RememberConversation(rememberTab, pendingPersist.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user