fix: 사진 요청이 AUTO-RECOVER 재프롬프트 루프를 타던 문제
앞 커밋(2537b04)에 이어진 후속. papa "눈향나무 사진" 재현 로그:
SKIP: duplicate search_images / AUTO-RECOVER (2/2) "live-data query answered
without a grounding tool call" / LOOP WARN: search_images x3
원인: 모델이 사진 대신 눈향나무 설명 프로즈를 냈는데 그 안의 "5cm·30cm·500년"이
looksLikeUnverifiedSpecClaim에 걸려 unverifiedSpecClaim→liveDataRequest가 참이 됨.
search_images는 GROUNDING_TOOL_PATTERN에 없어(citable text 아님) hasGroundingToolCall
false → 재프롬프트 → gemma가 search_images 반복 호출.
수정: decideAutoRecover 앞에 사진 요청 + search_images 호출 시 재시도 안 함 단락.
이미지 누락은 appendDroppedSearchImages가 복구하므로 재프롬프트가 고칠 게 없음.
대조군 테스트로 unverifiedSpecClaim 가드 자체는 유지 확인. 474 통과.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HdchNLTHsyYahp2PVQjoym
This commit is contained in:
1 parent
2537b04c7a
commit
e658f6a634
2 files changed
+26
No files matched your search
@@ -86,6 +86,19 @@ export function decideAutoRecover(input: AutoRecoverInput): AutoRecoverDecision
|
||||
const message = String(input.message || '');
|
||||
const content = String(input.content || '');
|
||||
|
||||
// A photo/image request is grounded by search_images — which is deliberately NOT in
|
||||
// GROUNDING_TOOL_PATTERN (it returns image markdown, not citable text, and the EMPTY-GROUNDING
|
||||
// check would misfire on it). Without this short-circuit, isFactualInfoRequest matches
|
||||
// "눈향나무 … 사진" and AUTO-RECOVER re-prompts a turn that already did the right thing, so
|
||||
// gemma loops calling search_images 3× and dumps prose (2026-09-03 live log). If search_images
|
||||
// ran, the images are recoverable from the tool result (appendDroppedSearchImages) even when
|
||||
// the model drops them — there is nothing for a re-prompt to fix.
|
||||
const isPhotoRequest = /사진|이미지|그림|짤|\bphotos?\b|\bimages?\b|\bpicture/i.test(message)
|
||||
&& /찾아|보여|검색|줘|보고\s*싶|골라|구해|\bsearch\b|\bfind\b|\bshow\b/i.test(message);
|
||||
if (isPhotoRequest && input.calledToolNames.some(n => String(n) === 'search_images')) {
|
||||
return { shouldRetry: false, kind: 'search', reason: '' };
|
||||
}
|
||||
|
||||
const looksLikeReasoning = content.length > 300
|
||||
&& (/\b(let me|I need to|I should|the user|first,|wait,|hmm|the rules say)\b/i.test(content));
|
||||
const queryNeedsTools = /\b(search|find|look up|latest|news|info|open|browse|navigate|visit|click|type|fill|what happened|desktop|screen|window|vscode|vs code|codex|clipboard)\b/i.test(message)
|
||||
|
||||
@@ -108,6 +108,19 @@ describe('AUTO-RECOVER — 재생성을 낭비하지 않아야 하는 경우', (
|
||||
assert.equal(recover('2번은 어때?', 'VRAM은 32GB입니다.').shouldRetry, true);
|
||||
});
|
||||
|
||||
// [2026-09-03] "눈향나무 사진 찾아줘" → search_images 정상 호출했는데 isFactualInfoRequest가
|
||||
// 매칭돼 AUTO-RECOVER가 재프롬프트 → gemma가 search_images를 3번 호출하며 루프. search_images가
|
||||
// 근거이고, 이미지 누락은 appendDroppedSearchImages가 복구하므로 재시도할 게 없다.
|
||||
test('사진 요청 + search_images 호출이면 재시도하지 않는다', () => {
|
||||
// 실제 로그: 모델이 사진 대신 눈향나무 설명 프로즈를 냈고, 그 안의 "5cm·30cm·500년"이
|
||||
// looksLikeUnverifiedSpecClaim에 걸려 unverifiedSpecClaim→liveDataRequest로 재프롬프트됐다.
|
||||
const specyProse = '눈향나무는 연간 약 5cm 자라며 최대 높이 30cm, 수령은 500년에 달합니다. 가격은 3만원 선입니다.';
|
||||
assert.equal(recover('눈향나무 Juniperus chinensis var. sargentii 사진 찾아줘', specyProse, ['search_images'], ['search_images']).shouldRetry, false);
|
||||
assert.equal(recover('강아지 사진 보여줘', specyProse, ['search_images'], ['search_images']).shouldRetry, false);
|
||||
// 대조군: 같은 프로즈여도 search_images를 안 불렀으면 여전히 재시도(가드가 통째로 꺼지면 안 됨)
|
||||
assert.equal(recover('눈향나무 사진 찾아줘', specyProse, ['coder_list_files'], ['search_images', 'web_search']).shouldRetry, true);
|
||||
});
|
||||
|
||||
// [2026-08-10] nhc_active_storms/eonet_events가 GROUNDING_TOOL_PATTERN에 없어서, NHC 원본
|
||||
// 수치로만 답한 태풍 턴은 hPa·m/s·북위가 전부 매칭되는데도 "근거 도구 미호출"로 취급됐다.
|
||||
test('NHC/EONET로 근거를 댄 태풍 답변은 재시도하지 않는다', () => {
|
||||
|
||||
Reference in new issue
Block a user