fix: docs_manager 세션 기록 크래시 방지

- record_session을 try/except로 감싸서 실패해도 봇 지속
- mkdir 안전장치 추가 (에이전트가 docs/ 삭제할 수 있음)
- em-dash → ASCII dash 변경
This commit is contained in:
2026-03-06 23:42:06 +09:00
parent a408bb32fe
commit fcd3ebfd41

View File

@@ -68,12 +68,14 @@ class DocsManager:
def record_session(self, request: str, summary: dict, plan: dict = None) -> str: def record_session(self, request: str, summary: dict, plan: dict = None) -> str:
"""작업 세션을 기록.""" """작업 세션을 기록."""
try:
self.sessions_path.mkdir(parents=True, exist_ok=True)
now = datetime.now() now = datetime.now()
filename = f"{now.strftime('%Y-%m-%d_%H%M%S')}.md" filename = f"{now.strftime('%Y-%m-%d_%H%M%S')}.md"
filepath = self.sessions_path / filename filepath = self.sessions_path / filename
lines = [ lines = [
f"# 작업 기록 {now.strftime('%Y-%m-%d %H:%M')}", f"# 작업 기록 - {now.strftime('%Y-%m-%d %H:%M')}",
"", "",
f"## 요청", f"## 요청",
f"{request}", f"{request}",
@@ -98,7 +100,7 @@ class DocsManager:
if changes: if changes:
lines.append("## 변경 파일") lines.append("## 변경 파일")
for c in changes: for c in changes:
lines.append(f"- `{c.get('file', '?')}` {c.get('description', '')}") lines.append(f"- `{c.get('file', '?')}` - {c.get('description', '')}")
lines.append("") lines.append("")
warnings = summary.get("warnings", []) warnings = summary.get("warnings", [])
@@ -111,6 +113,9 @@ class DocsManager:
filepath.write_text("\n".join(lines), encoding="utf-8") filepath.write_text("\n".join(lines), encoding="utf-8")
logger.info(f"세션 기록: {filepath}") logger.info(f"세션 기록: {filepath}")
return str(filepath) return str(filepath)
except Exception as e:
logger.warning(f"세션 기록 실패 (무시): {e}")
return ""
def append_changelog(self, entry: str): def append_changelog(self, entry: str):
"""Changelog에 항목 추가.""" """Changelog에 항목 추가."""