세션 평가·라이브코치·교수자 분석 라운드 마감 + 문서 정리 + 코드품질 리팩터

- 누적 작업트리 커밋: 회기 평가 복구·durable 저장, 라이브 코치 이력/근거, 교수자 학생분석, 음성 비언어 메타, PII 마스킹, 운영 티켓/헬스 등
- 문서: 완료 기록 docs/archive/ 냉동 보관, docs/ 단일 인덱스(docs/README.md)+통합 TODO(docs/TODO.md)로 정리
- 리팩터(행위 보존): Stage enum SSOT(taxonomy 소유·state_machine re-export), store recent/masked_turns 중복 제거, speaker_ko_label 단일 헬퍼, _list_sessions N+1 제거(state/turns 배치 + 턴평가 하이드레이션 배치)
- 검증: 백엔드 pytest 352 passed, _list_sessions E2E chromium-single-run 2 passed
This commit is contained in:
Yun Chan 2026-07-02 02:50:36 +09:00
parent 7c41c3ce79
commit 778e8526d4
108 changed files with 6457 additions and 455 deletions

View file

@ -50,6 +50,25 @@ EvalHook = Callable[["TurnContext", str], Awaitable[Optional[dict]]]
LlmAuditHook = Callable[[dict[str, Any]], Awaitable[None]]
def turn_evaluation_error_payload(ctx: "TurnContext", error: BaseException | str) -> dict[str, Any]:
"""Represent a non-fatal fast-loop evaluator failure without hiding it."""
st = ctx.state_after or ctx.state_before
if isinstance(error, BaseException):
# Exception messages can contain raw learner/provider text. Keep review-facing
# evidence to the exception type; detailed trace stays in server logs.
detail = type(error).__name__
else:
detail = str(error).strip() or "unknown turn evaluation error"
masked = guardrail.mask_pii(detail).text_masked.strip() or "unknown turn evaluation error"
return {
"loop": "fast",
"turn_seq": st.turn_seq,
"stage": st.stage.value,
"appropriateness": "neutral",
"error": masked,
}
@dataclass(slots=True)
class TurnContext:
"""한 턴 파이프라인을 관통하는 컨텍스트(가드레일/상태/페르소나 산출 집약)."""
@ -248,8 +267,9 @@ async def run_turn_generate(
if eval_hook is not None:
try:
evaluation = await eval_hook(ctx, reply)
except Exception:
evaluation = None # 평가 실패가 상담 루프를 막지 않게(비치명적)
except Exception as exc:
# 평가 실패는 상담 루프를 막지 않되, 리뷰/대시보드에서 조용히 사라지지 않게 남긴다.
evaluation = turn_evaluation_error_payload(ctx, exc)
return TurnResult(
turn_seq=st.turn_seq,