From a632607aa8b6a427a8dcfb0c9cce25c50a0d3894 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Mon, 13 Apr 2026 13:55:43 +0900 Subject: [PATCH] fix(nanoclaude): PYTHONUNBUFFERED + pre-route trace prints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit worker 로그 stdout 미출력 해결 + pre-route 분기 추적용 trace. Co-Authored-By: Claude Opus 4.6 (1M context) --- nanoclaude/Dockerfile | 2 ++ nanoclaude/services/worker.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/nanoclaude/Dockerfile b/nanoclaude/Dockerfile index dbb8192..ef7c52f 100644 --- a/nanoclaude/Dockerfile +++ b/nanoclaude/Dockerfile @@ -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 diff --git a/nanoclaude/services/worker.py b/nanoclaude/services/worker.py index 1b32e51..e3c155b 100644 --- a/nanoclaude/services/worker.py +++ b/nanoclaude/services/worker.py @@ -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) # 대화 기록: 사용자 메시지