移除 AI logger 未用 stack 推斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
OoO
2026-05-13 11:54:16 +08:00
parent 49c576bc4f
commit 1aeb4a4b8e
2 changed files with 1 additions and 17 deletions

View File

@@ -22,7 +22,7 @@
- Google Drive import`services/import_service.py` 的日期 `IN (...)` 刪除/驗證查詢已改為 SQLAlchemy bind params不再把 DataFrame 日期值拼進 SQL 字串。
- OpenClaw Bot中文字型下載、趨勢同期 DB 查詢、匯入格式業績預覽解析等 best-effort 區塊已補 debug/exception/warnings避免真正錯誤完全無跡可查。
- Telegram polling bot舊 callback 正規化失敗、空 `momo:eig:` event_id 回覆失敗仍保持 fail-safe但已補 debug log。
- `ai_call_logger._write_to_db` 不是死函數:它是 `_async_write()` 的 daemon thread targetdecorator token 自動抽取與 stack caller 推斷的 best-effort 失敗也已補 debug log
- `ai_call_logger._write_to_db` 不是死函數:它是 `_async_write()` 的 daemon thread target`infer_caller_from_stack()` 確認無 caller 後已移除
- `cache_manager.FingerprintCache` 與 dashboard shared cache 清理維持 fail-open / best-effort但已補 debug log避免 cache fingerprint 或檔案清理失敗完全沉默。
## 已驗證為已修或過期

View File

@@ -24,7 +24,6 @@ services/ai_call_logger.py
from __future__ import annotations
import hashlib
import inspect
import logging
import os
import threading
@@ -438,18 +437,3 @@ def _safe_meta_json(meta: Dict[str, Any]) -> str:
except Exception as e:
logger.warning("[AICallLogger] meta json dump failed: %s", e)
return '{}'
# ─────────────────────────────────────────────────────────────────────────────
# 工具caller 自動推斷caller 沒給時用)
# ─────────────────────────────────────────────────────────────────────────────
def infer_caller_from_stack(default: str = 'unknown') -> str:
"""從 inspect.stack() 推斷 caller取上 1 層的 module 名末段)。"""
try:
frame = inspect.stack()[2]
module = inspect.getmodule(frame.frame)
if module and module.__name__:
return module.__name__.split('.')[-1][:64]
except Exception:
logger.debug("[AICallLogger] infer caller from stack failed", exc_info=True)
return default