AX Agent 실행 후처리 경로를 공통화
Some checks failed
Release Gate / gate (push) Has been cancelled

- ResetStreamingUiState, FinalizeConversationTurn, FinalizeQueuedDraft를 추가해 전송과 재생성의 완료 후 UI/상태 정리를 같은 경로로 통합함

- 대화 저장, 목록 갱신, 대기열 완료/실패 반영, 다음 작업 시작 흐름을 helper 기준으로 다시 묶음

- 검증: dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\\verify\\ -p:IntermediateOutputPath=obj\\verify\\ 경고 0 / 오류 0
This commit is contained in:
2026-04-05 12:32:12 +09:00
parent 31a8b979c7
commit 8921f5da0f
3 changed files with 71 additions and 72 deletions

View File

@@ -8440,23 +8440,7 @@ public partial class ChatWindow : Window
_llm.ClearRouteOverride();
UpdateModelLabel();
}
_cursorTimer.Stop();
_elapsedTimer.Stop();
_typingTimer.Stop();
HideStickyProgress(); // 에이전트 프로그레스 바 + 타이머 정리
StopRainbowGlow(); // 레인보우 글로우 종료
_activeStreamText = null;
_elapsedLabel = null;
_cachedStreamContent = "";
_isStreaming = false;
BtnSend.IsEnabled = true;
BtnStop.Visibility = Visibility.Collapsed;
BtnSend.Visibility = Visibility.Visible;
_streamCts?.Dispose();
_streamCts = null;
_streamRunTab = null;
SetStatusIdle();
ResetStreamingUiState();
}
lock (_convLock)
@@ -8467,38 +8451,8 @@ public partial class ChatWindow : Window
conv = _currentConversation!;
}
lock (_convLock)
_currentConversation = conv;
RenderMessages(preserveViewport: true);
AutoScrollIfNeeded();
try { _storage.Save(conv); } catch (Exception ex) { Services.LogService.Debug($"대화 저장 실패: {ex.Message}"); }
ChatSession?.RememberConversation(originTab, conv.Id);
SyncTabConversationIdsFromSession();
RefreshConversationList();
if (!string.IsNullOrWhiteSpace(queuedDraftId))
{
lock (_convLock)
{
var session = ChatSession;
if (session != null)
{
if (draftSucceeded)
_draftQueueProcessor.Complete(session, originTab, queuedDraftId, _storage, _appState.TaskRuns);
else
_draftQueueProcessor.HandleFailure(session, originTab, queuedDraftId, draftFailure, draftCancelled, 3, _storage, _appState.TaskRuns);
_currentConversation = session.CurrentConversation ?? _currentConversation;
}
if (string.Equals(_runningDraftId, queuedDraftId, StringComparison.OrdinalIgnoreCase))
_runningDraftId = null;
}
}
RefreshDraftQueueUi();
if (!draftCancelled && !string.IsNullOrWhiteSpace(queuedDraftId) && string.Equals(originTab, _activeTab, StringComparison.OrdinalIgnoreCase))
_ = Dispatcher.BeginInvoke(new Action(() => StartNextQueuedDraftIfAny()), DispatcherPriority.Background);
FinalizeConversationTurn(originTab, conv);
FinalizeQueuedDraft(originTab, queuedDraftId, draftSucceeded, draftCancelled, draftFailure);
}
private async Task<string> RunAgentLoopAsync(
@@ -8577,6 +8531,67 @@ public partial class ChatWindow : Window
images);
}
private void ResetStreamingUiState()
{
_cursorTimer.Stop();
_elapsedTimer.Stop();
_typingTimer.Stop();
HideStickyProgress();
StopRainbowGlow();
_activeStreamText = null;
_elapsedLabel = null;
_cachedStreamContent = "";
_isStreaming = false;
BtnSend.IsEnabled = true;
BtnStop.Visibility = Visibility.Collapsed;
BtnSend.Visibility = Visibility.Visible;
_streamCts?.Dispose();
_streamCts = null;
_streamRunTab = null;
SetStatusIdle();
}
private void FinalizeConversationTurn(string rememberTab, ChatConversation conversation)
{
lock (_convLock)
_currentConversation = conversation;
RenderMessages(preserveViewport: true);
AutoScrollIfNeeded();
try { _storage.Save(conversation); } catch (Exception ex) { Services.LogService.Debug($"대화 저장 실패: {ex.Message}"); }
ChatSession?.RememberConversation(rememberTab, conversation.Id);
SyncTabConversationIdsFromSession();
RefreshConversationList();
}
private void FinalizeQueuedDraft(string originTab, string? queuedDraftId, bool draftSucceeded, bool draftCancelled, string? draftFailure)
{
if (string.IsNullOrWhiteSpace(queuedDraftId))
return;
lock (_convLock)
{
var session = ChatSession;
if (session != null)
{
if (draftSucceeded)
_draftQueueProcessor.Complete(session, originTab, queuedDraftId, _storage, _appState.TaskRuns);
else
_draftQueueProcessor.HandleFailure(session, originTab, queuedDraftId, draftFailure, draftCancelled, 3, _storage, _appState.TaskRuns);
_currentConversation = session.CurrentConversation ?? _currentConversation;
}
if (string.Equals(_runningDraftId, queuedDraftId, StringComparison.OrdinalIgnoreCase))
_runningDraftId = null;
}
RefreshDraftQueueUi();
if (!draftCancelled && string.Equals(originTab, _activeTab, StringComparison.OrdinalIgnoreCase))
_ = Dispatcher.BeginInvoke(new Action(() => StartNextQueuedDraftIfAny()), DispatcherPriority.Background);
}
// ─── 코워크 에이전트 지원 ────────────────────────────────────────────
private string BuildCoworkSystemPrompt()
@@ -10996,22 +11011,7 @@ public partial class ChatWindow : Window
}
finally
{
_cursorTimer.Stop();
_elapsedTimer.Stop();
_typingTimer.Stop();
HideStickyProgress(); // 에이전트 프로그레스 바 + 타이머 정리
StopRainbowGlow(); // 레인보우 글로우 종료
_activeStreamText = null;
_elapsedLabel = null;
_cachedStreamContent = "";
_isStreaming = false;
BtnSend.IsEnabled = true;
BtnStop.Visibility = Visibility.Collapsed;
BtnSend.Visibility = Visibility.Visible;
_streamCts?.Dispose();
_streamCts = null;
_streamRunTab = null;
SetStatusIdle();
ResetStreamingUiState();
}
lock (_convLock)
@@ -11021,13 +11021,7 @@ public partial class ChatWindow : Window
_currentConversation = session?.CurrentConversation ?? conv;
conv = _currentConversation!;
}
RenderMessages(preserveViewport: true);
AutoScrollIfNeeded();
try { _storage.Save(conv); } catch (Exception ex) { Services.LogService.Debug($"대화 저장 실패: {ex.Message}"); }
ChatSession?.RememberConversation(conv.Tab ?? _activeTab, conv.Id);
SyncTabConversationIdsFromSession();
RefreshConversationList();
FinalizeConversationTurn(conv.Tab ?? _activeTab, conv);
}
/// <summary>채팅 본문 폭을 세 탭에서 동일한 기준으로 맞춥니다.</summary>