fix(nanoclaude): PYTHONUNBUFFERED + pre-route trace prints

worker 로그 stdout 미출력 해결 + pre-route 분기 추적용 trace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-13 13:55:43 +09:00
parent 1ea66530af
commit a632607aa8
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -19,6 +19,8 @@ COPY infra/ ./infra/
# Ensure infra has its own dependencies (pydantic, asyncssh already in requirements)
# Python path: /app is WORKDIR, so "from infra.core..." and "from tools..." both work
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /app/data
EXPOSE 8100
+3
View File
@@ -254,9 +254,11 @@ async def run(job: Job) -> None:
# --- 사전 라우팅 (키워드 기반, EXAONE 스킵) ---
pre = _pre_route(job.message)
classify_latency = 0
print(f"[TRACE] Job {job.id} pre_route result: {pre}", flush=True)
if pre:
classification = pre
print(f"[TRACE] Job {job.id} PRE-ROUTED: {pre.get('tool','')}.{pre.get('operation','')}", flush=True)
logger.info("Job %s pre-routed: %s.%s", job.id, pre.get("tool", ""), pre.get("operation", pre.get("action", "")))
else:
# --- EXAONE 분류기 호출 ---
@@ -289,6 +291,7 @@ async def run(job: Job) -> None:
response_text = classification.get("response", "")
route_prompt = classification.get("prompt", "")
print(f"[TRACE] Job {job.id} final action='{action}' classification={classification}", flush=True)
logger.info("Job %s classified as '%s'", job.id, action)
# 대화 기록: 사용자 메시지