AI 내부 예외 문자열이 SSE 로 브라우저까지 나가던 문제 - #194
Merged
Merged
Conversation
AI 서버는 질문 생성 실패 시 `error_message=str(exc)` 를 콜백에 담는다. Core 의 publishErrorEvent 가 이 값을 SessionErrorNotice 에 그대로 넣어 세션·유저 SSE 채널로 발행했다 — 즉 사용자의 브라우저까지 전달된다. `str(exc)` 에 들어올 수 있는 것: - LLM 게이트웨이 주소(llm_base_url, 사내 게이트웨이) — 연결 오류 메시지 - 업스트림 오류 본문의 조직 식별자·모델명·쿼터 상세 - 파싱 실패 시 모델 원문 게다가 프론트엔드는 errorCode·errorMessage·retriable 중 무엇도 읽지 않는다. 소비자도 없이 내부 정보만 나가고 있었다. 원문은 이미 같은 메서드 위 log.warn 이 서버에 남긴다. 클라이언트로는 우리가 정의한 코드에서 만든 안내 문구만 보낸다. errorCode 도 결국 AI 가 채우는 문자열이라 화이트리스트로 값 범위를 묶었다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
문제
AI 서버는 질문 생성 실패 시 콜백에
error_message=str(exc)를 담는다 (questions_consumer.py).Core 의
QuestionsCallbackService.publishErrorEvent가 이 값을 그대로SessionErrorNotice에 넣어 세션·유저 SSE 채널 양쪽으로 발행했다. RealTime 이 이를 브라우저로 흘린다.str(exc)에 실제로 들어올 수 있는 것:APIConnectionErrorllm_base_url= 사내 LLM 게이트웨이 주소APIStatusError(429/400)게다가 프론트엔드는 이 필드들을 하나도 읽지 않는다.
interviewEventAction이ERROR를rollback-optimistic으로만 처리하고 payload 는 버린다. 소비자도 없이 내부 정보만 브라우저로 나가고 있었다.수정
publishErrorEvent가 클라이언트로는 우리가 정의한 코드에서 만든 문구만 보낸다.SessionErrorNotice.errorMessage→message로 이름 변경 (내부 원문이 아니라 사용자 문구라는 걸 타입에서 드러냄)ERROR_MESSAGES화이트리스트:GENERATION_FAILED/GENERATION_SCHEMA_INVALID→ 한국어 안내errorCode도 화이트리스트를 태운다 — errorCode 역시 AI 가 채우는 문자열이라, 언젠가 예외 속성에서 끌어다 쓰게 되면 같은 경로로 샌다. 모르는 코드는GENERATION_FAILED로 접는다log.warn이 이미errorCode·retriable·errorMessage를 서버 로그에 남긴다. 디버깅 정보는 그대로 유지된다테스트
QuestionsCallbackServiceTest2 케이스 추가:apply_followupFailedWithoutPlaceholder_doesNotLeakInternalErrorMessage— 게이트웨이 주소·조직 식별자·Errno가 발행된RealtimeNotifyEvent어디에도 없음apply_followupFailedWithUnknownErrorCode_fallsBackToKnownCode— 모르는 errorCode 에 담긴 문자열이 새어 나가지 않음수정 전 코드에서 정확히 이 2개만 실패하는 것을 확인했다 (25 tests completed, 2 failed). 수정 후 백엔드 전체 스위트 통과.
프론트 영향
없다. 프론트가 이 필드들을 읽지 않으므로
errorMessage→message리네임은 화면에 영향이 없다. (SSE payload 는 OpenAPI 스펙 대상이 아니라 타입 재생성도 불필요.)