fix(bridge): treat crush tool_use finish as intermediate, not turn failure - #935
fix(bridge): treat crush tool_use finish as intermediate, not turn failure#935jinon86 wants to merge 1 commit into
Conversation
…ilure crush maps the provider's tool_calls finish to reason="tool_use" on every assistant message that ends with tool calls, with empty message/details (AddFinish(reason, "", "")). _FINISH_OK never contained it, so every tool-using turn fell into the error branch and surfaced the bare reason string: "Processing failed: tool_use" (bangtong 2026-08-04 — pure-text turns passed, e.g. canary5b, while any real task failed). The finish is an intermediate step boundary: the agent loop runs the tools and calls the model again, and permission denials already arrive as end_turn (crush maps StopTurn). Ignore it and keep collecting; the turn still completes on end_turn/stop, errors on unknown reasons, and interrupts on cancel. Regression tests: tool_use ignored + collection continues to end_turn, unknown reason still fails with detail, cancel still interrupts. Full bridge suite: 2222 passed (1 pre-existing env-dependent failure in test_config_voice_provider, reproduces on clean main). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
종결 — main에 이미 반영됨(상위집합), 리베이스하면 오히려 회귀충돌 해소를 시도하기 전에 main 현황을 대조한 결과, 이 PR의 수정은 #942(squash 동작은 동일
다만 이 PR에는 회귀가 남아 있습니다이 PR은
즉 OpenAI 계열 프로바이더에서는 테스트도 main이 상위집합이 PR이 추가하는
를 이미 갖고 있어, 이 PR의 테스트 파일이 추가로 잡는 회귀가 없습니다. 판단살릴 고유 가치가 없고 리베이스는 회귀를 들여옵니다. not planned로 종결합니다. 근본 증상(bangtong 2026-08-04 "Processing failed: tool_use")은 #943으로 해결된 상태입니다. |
증상
방통(VPS3) crush 레인에서 k3가 도구를 부르는 턴이 전부
❌ Processing failed: tool_use로 실패 (duration.jsonl success=false 연속). 순수 텍스트 답변 턴(canary5b)만 성공했습니다.근본 원인 (소스 레벨 확정)
crush는 모델이 도구 호출로 끝내는 모든 중간 어시스턴트 메시지에 finish part
reason="tool_use"를 붙입니다 (fantasy.FinishReasonToolCalls → message.FinishReasonToolUse, 게다가AddFinish(reason, "", "")로 message/details는 빈 문자열).브릿지
_complete_turn의_FINISH_OK는{"end_turn","stop","stop_sequence","length","tool_calls"}— crush의 실제 어휘"tool_use"가 없어 else 분기로 떨어지고,detail = message or details or reason이 빈 문자열 둘을 지나 reason 그대로 →ErrorEvent(message="tool_use")→ 사용자에게Processing failed: tool_use.※
permissions deny question(#934)으로는 못 고치는 이유가 이것 — 트리거는 특정 도구가 아니라 도구 사용 자체입니다. #934는 비대화형 경로 강화로는 유효하나 본 건의 수정이 아닙니다.수정
_FINISH_INTERMEDIATE = {"tool_use"}를 추가하고_complete_turn에서 즉시 return — 중간 경계에서는 턴을 끝내지도 실패시키지도 않고 수집을 계속합니다. 권한 거부는 crush가 StopTurn → end_turn으로 변환해 주므로 기존 완료 경로가 그대로 동작합니다.검증
🤖 Generated with Claude Code