fix: v2.2.202 — 기업모드 Intent Alignment 가 일반 채팅 컨텍스트 무시하던 버그

증상: 일반 채팅에서 프로젝트·요구사항을 충분히 논의한 뒤 기업모드 전환 후
후속 작업을 요청하면 "추가 정보 필요 — 맥락/목표/기준/형식" 화면이 떠
사용자에게 *방금 말한 내용을 다시 묻는* 느낌을 줌.

원인:
- Intent Classifier 는 prior chat 컨텍스트(previousBrief/Tail) 받음 → follow-up
  분기 정확
- Intent Alignment (clarification 화면 만드는 분석기) 는 IntentAnalysisInput
  인터페이스에 chat history 필드가 없음 → 오직 현재 사용자 메시지만 봄
- 결과: 모드 전환 직후 첫 라운드 분석기는 사용자가 이전에 일반 채팅에서 한
  모든 설명을 못 봄 → context 빈칸 → openQuestions 에 "맥락은?" 추가

Fix:
- IntentAnalysisInput 에 priorChatSummary?: string 필드 추가
- 시스템 프롬프트에 *모드 전환 시 context 우선 추출* 규칙 추가 — 일반 채팅에서
  명시된 항목은 추측이 아니라 명시된 사실로 취급
- _buildUserMessage() 가 [모드 전환 직전 일반 채팅 요약] 블록을 user message
  상단에 주입
- sidebarProvider.ts 호출 지점에서 this._agent.getHistory() → 최근 10 turn
  (!internal) 추출 → "role: content" 한 줄씩, content 200자 cap
- 후속 라운드 (previousContract 있음) 면 history 중복 첨부 안 함 — 이미 contract
  에 흡수됨

효과: 일반 채팅 → 기업모드 전환 시 분석기가 prior chat 의 context/goal/criteria
를 직접 추출. redundant "맥락/목표/기준/형식 다시 말해 주세요" 질문 사라짐.
첫 라운드부터 confidence=high 가능 → 바로 본 작업 진행.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 11:24:34 +09:00
parent 7bec20620a
commit c27cd823a9
13 changed files with 98 additions and 25 deletions
+20
View File
@@ -1890,6 +1890,25 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
// Pixel Office: 분석 시작 표시 (LLM 콜 직전).
try { this.pixelOfficeOnAlignmentStart(opts.userPrompt); } catch { /* noop */ }
// 모드 전환 직전 일반 채팅 요약 — Intent Alignment 가 *이미 논의된 맥락* 을
// 재질문하지 않도록. 후속 라운드(previousContract 있음) 면 chatHistory 가
// 이미 contract 에 흡수됐으므로 중복 첨부 안 함.
let priorChatSummary: string | undefined;
if (!opts.previousContract) {
try {
const history = this._agent.getHistory();
const visible = history.filter((m) => !m.internal && (m.role === 'user' || m.role === 'assistant'));
// 마지막 N=10 턴, content 200자 cap — 토큰 폭주 방지.
const recent = visible.slice(-10);
if (recent.length > 0) {
priorChatSummary = recent
.map((m) => `${m.role}: ${String(m.content || '').replace(/\s+/g, ' ').trim().slice(0, 200)}`)
.join('\n');
}
} catch { /* history 못 가져와도 alignment 자체는 동작 */ }
}
const analysis = await analyzeIntent(
new AIService(),
{
@@ -1898,6 +1917,7 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn
previousContract: opts.previousContract,
activePipelineName: activePipeline?.name,
availableRoleCategories: extractActiveRoleCategories(state),
priorChatSummary,
},
// 분류기와 같은 작은 모델을 재사용 — 이 단계도 빠르고 가벼워야 함.
{ model: cfg.companyIntentClassifierModel || cfg.defaultModel },