뉴스 표에 나온 인물을 묻는 후속 질문은 검색 강제(isNewsEntityFollowUp) — 직전 답이 뉴스 표이고 물은 이름이 그 표에 있을 때만. '무라카미 류 누구지?'에 Haiku가 기억으로 답해 데뷔작 제목을 지어내고 무관한 JSA를 끌어옴. 인물 질문 전체는 안 건드림(사용자 결정)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kimandClaude Opus 5.5 committed 2026-10-23 18:14:20 +09:00
1 parent 51bc4f4a2c
commit 613648096e
4 files changed
+46 -1

No files matched your search

+1
View File
@@ -14,6 +14,7 @@
export const SYNTHETIC_ACKS: ReadonlySet<string> = new Set([
'Got it — checking now.',
'Got it — let me verify that first.',
'Got it — let me look that up.',
'Understood.',
'Understood. Acting immediately.',
'Let me check that now.',
+10 -1
View File
@@ -13,6 +13,7 @@ import {
isLiveDataRequest,
isFactualInfoRequest,
isFactualThreadFollowUp,
isNewsEntityFollowUp,
confirmsUserGuessWithoutGrounding,
looksLikeUnverifiedSpecClaim,
isExemptFromVerification,
@@ -920,6 +921,7 @@ async function handleChat(
// wasted first generation — see the AUTO-RECOVER fallback below) so the model calls the
// tool on round 0 instead of burning a full generation on a fabricated answer that then
// gets discarded and retried.
const newsEntityFollowUp = isNewsEntityFollowUp(message, String([...history].reverse().find(h => h.role !== 'user')?.content || ''));
if (isLiveDataRequest(message)) {
// "뉴스" alone means general current-events news — it must not get resolved into
// whatever topic happens to be freshest in the conversation history (observed: a bare
@@ -967,6 +969,13 @@ async function handleChat(
// 주제어가 앞 턴에 있고 이번 턴엔 명사구만 남은 후속 질문("올라마 클라우드 모델은?")도 같은
// 리마인더를 받아야 한다 — 대화가 깊어질수록 모델이 기억으로 답하기 쉬워지는데, 정작 그때
// 게이트는 메시지가 짧아 아무것도 못 본다(2026-09-04 소설-모델 스레드가 그렇게 3턴 갔다).
} else if (newsEntityFollowUp) {
console.log('[v2] NEWS ENTITY FOLLOW-UP: 뉴스 표에 나온 인물 질문 → 검색 강제');
messages.push({ role: 'assistant', content: 'Got it — let me look that up.' });
messages.push({
role: 'user',
content: 'Reminder: this asks about someone from the news you just listed. Call web_search on the name first (add 약력/프로필) and answer from the results — works, career, dates and other details must come from what the search returned, not from memory.',
});
} else if (isFactualInfoRequest(message)
|| isFactualThreadFollowUp(message, String([...history].reverse().find(h => h.role === 'user')?.content || ''))) {
messages.push({ role: 'assistant', content: 'Got it — let me verify that first.' });
@@ -1529,7 +1538,7 @@ async function handleChat(
// after tool results come back.
const forceToolChoice = round === 0
&& !toolsDisabledForRestOfTurn
&& (isLiveDataRequest(message) || isFactualInfoRequest(message))
&& (isLiveDataRequest(message) || isFactualInfoRequest(message) || newsEntityFollowUp)
&& getModelProfileForceToolChoice(effectiveModel || getModelForRole('executor'));
// Always use streaming so text tokens appear in real-time. The streaming
// handler collects tool_calls from chunks and returns them in the final
+21
View File
@@ -213,6 +213,27 @@ export function isFactualThreadFollowUp(message: string, previousUserMessage: st
return /[??]$/.test(m) || /(까|나요|니|냐|지|는가|은가|어때|얼마|몇|뭐|무엇|어디|언제|누구|왜|어떻게)\s*[??]?$/.test(m);
}
/**
* 방금 뉴스 표에 나온 인물을 묻는 후속 질문("무라카미 류 누구지?").
*
* 2026-10-23 실측: 일본 뉴스 표의 "무라카미 류 별세" 다음 턴에 Haiku가 검색 없이 기억으로 답하면서
* 데뷔작 제목을 지어내고(『한 조각의 푸른 하늘』) 무관한 『공동경비구역 JSA』까지 그의 작품처럼 꺼냈다.
* 인물 질문 전체를 검색으로 돌리면 매 턴 느려지므로, 직전 답이 뉴스 표이고 물은 이름이 그 표에
* 실제로 있을 때만 잡는다(사용자 결정).
*/
export function isNewsEntityFollowUp(message: string, previousAssistant: string): boolean {
const m = String(message || '').trim();
const prev = String(previousAssistant || '');
if (!m || m.length > 40) return false;
if (!/\|\s*제목\s*\|/.test(prev)) return false;
const WHO = /(누구|누군|어떤\s*사람|뭐\s*하는\s*사람|who\s+(is|was|are))/i;
if (!WHO.test(m)) return false;
const names = m.replace(/[??!.,]/g, ' ').split(/\s+/)
.map(t => t.replace(/(이란|란|씨는|씨가|씨|님은|님|은|는|이|가)$/, ''))
.filter(t => t.length >= 2 && !WHO.test(t) && !/^(어떤|사람|뭐하는|그|이|저)$/.test(t));
return names.some(t => prev.includes(t));
}
// Output-side counterpart to isFactualInfoRequest()/isLiveDataRequest(): those only catch
// predictable INPUT phrasings ("스펙", "비교", "몇 세대"), and casual paraphrases slip through
// unmatched ("초당 몇 토큰 나올까?", "이거 어떨까?") — a model answering those confidently from
+14
View File
@@ -16,6 +16,7 @@
import { test, describe } from 'node:test';
import assert from 'node:assert/strict';
import {
isNewsEntityFollowUp,
looksLikeUnverifiedSpecClaim,
isExemptFromVerification,
isFactualInfoRequest,
@@ -557,3 +558,16 @@ describe('isActionPromiseNoTool — 되묻기는 약속이 아니다', () => {
assert.equal(isActionPromiseNoTool('정확한 정보가 필요하므로 검색해 드리겠습니다.'), true);
});
});
describe('isNewsEntityFollowUp', () => {
const newsTable = '| 제목 | 요약 | 출처 |\n|---|---|---|\n| 소설가 무라카미 류 별세 | 작가 무라카미 류(村上龍)가 사망했으며… | Yahoo!ニュース |\n| 서울고법, 오세훈 서울시장 무죄 선고 | … | Yahoo!ニュース |';
test('뉴스 표에 나온 이름을 누구냐고 물으면 잡는다', () => {
assert.equal(isNewsEntityFollowUp('무라카미 류 누구지?', newsTable), true);
assert.equal(isNewsEntityFollowUp('오세훈은 어떤 사람이야?', newsTable), true);
});
test('표에 없는 이름, 뉴스 표가 아닌 직전 답, 인물 질문이 아닌 말은 놓아 둔다', () => {
assert.equal(isNewsEntityFollowUp('하루키는 누구지?', newsTable), false);
assert.equal(isNewsEntityFollowUp('무라카미 류 누구지?', '무라카미 류는 소설가입니다.'), false);
assert.equal(isNewsEntityFollowUp('무라카미 류 작품 뭐 있어?', newsTable), false);
});
});