refactor: 컨슈머 실패 신호 메커니즘 일원화 - #211
Merged
Merged
Conversation
questions/followup/feedback 3개 컨슈머에 각기 다른 깊이로 수기 구현돼 있던 실패 신호 메커니즘을 failure_signal.py 의 consume_with_failure_signal 하나로 통합. 파싱→멱등→전 구간 가드→FAILED 콜백(+ack)→성공 발행 실패 시 FAILED 오인 없는 DLQ→콜백 0건 경로 멱등 unmark 를 가드가 전담하고, 컨슈머는 _process(성공 payload 반환)와 _failed_payload 팩토리만 구현한다. 이로써 questions/followup 의 무방비 구간(컨텍스트 빌드·진행 이벤트·발행)이 처음 보호되고 unmark 도 3사 공통 적용. 오류 분류(classify_failure)와 errorMessage 포맷(ExcType: msg, 500자 상한)도 단일 출처화. 콜백 계약(에러 코드·필드· 라우팅)은 불변 — 기존 컨슈머 테스트 무변경 그린. 테스트 +7.
SessionErrorNotice 를 common/sse 로 이동(wire JSON 불변)하고 세션/유저 이중 채널 ERROR 발행을 SessionErrorNotifier 단일 구현으로 — Questions/Feedback 콜백 서비스의 인라인 복사본과 형제 nested record 결합 제거(화이트리스트는 성격이 달라 각 서비스 잔류). errorCode 가 null 인 FAILED 콜백이 Map.of 에서 NPE → 롤백·재시도 루프에 빠지던 기존 결함에 폴백 가드 추가. 유출 방지 테스트는 발행 전수 스캔으로 복원, notifier 단위 테스트 신규.
messaging.md §6 AI Server 절 — 3개 생성 컨슈머의 전 구간 가드·unmark 공용 모듈(failure_signal.py) 서술로 갱신.
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.
변경 사항
PR #206/#210 까지 리뷰가 반복 지적한 구조 결함 해소 — 같은 "생성 중 무기한 대기" 버그를 세 컨슈머에서 세 깊이로 고쳐 온 실패 신호 메커니즘을 단일 구현으로 통합.
AI (
ai/)messaging/consumers/failure_signal.py:consume_with_failure_signal이 파싱(실패 시 DLQ)→멱등→전 구간 가드→FAILED 콜백(+ack)→성공 발행 실패 시 FAILED 오인 없는 DLQ→콜백 0건 경로 멱등 unmark 를 전담. 오류 분류(classify_failure)·errorMessage 포맷(ExcType: msg500자 상한)도 단일 출처_process(성공 payload 반환) +_failed_payload팩토리만 구현 — questions/followup 의 무방비 구간(컨텍스트 빌드·진행 이벤트·발행)이 처음으로 보호되고 unmark 도 3사 공통 적용feedback.generate.unexpected→feedback.generate.failedCore (
backend/)SessionErrorNotice를common/sse/로 이동(wire JSON 불변) +SessionErrorNotifier가 세션/유저 이중 채널 ERROR 발행 단일 구현 — 두 콜백 서비스의 인라인 복사본·형제 nested record 결합 제거 (화이트리스트는 성격이 달라 각 서비스 잔류)Map.ofNPE → 롤백·재시도 루프에 빠지던 기존 결함에 폴백 가드 (코드 리뷰 CONFIRMED)검증
문서
docs/messaging.md§6,ai/CLAUDE.md§16(두 단락 통합)·§12(stale 규정 정정),ai_server/CLAUDE.md§2,backend/CLAUDE.md§19frontend/·infra/변경 없음후속 (기록)