12 KiB
12 KiB
Claude Code 盤點驗證記憶(2026-05-13)
用途:接續 V1/V2 全棧盤點整改時,先看這份,避免把已修或已過期的項目重複當成阻擋。
已驗證並修補
rag_query_log.saved_call:已改為只有高信心 RAG 命中且跳過 LLM 時寫true,並補測試。ai_calls.rag_hit:logger API 原本可寫但缺回歸測試;已補set_rag_hit(True)寫入測試。- 舊
SSH_JUMP_* / SSH_TARGET_*:Python caller 已不存在;已從config.py與.env.example範例移除,執行路徑以ELEPHANT_ALPHA_JUMP_*為準。 filesystem-mcp:MCP_BASE_HOSTS與 health check 已存在;已補ops_diagnostics唯讀工具白名單,並測試read_file可通、write_file被拒。mcp_calls.status:已補ok/cache_only/timeout/rate_limited/error細分,早退結果也會帶status='error'。- Telegram
cat_callback:主 OpenClaw route 不是問題;polling bot helper 的預設cat才是潛在漏 handler。已改預設為既有 handlertrend並補測試。 - Scheduler 觀測任務:BGE-M3 embedding consistency 不一致、host health probe、AI error spike、觀測台日報與 cleanup 例外都已接
_notify_scheduler_failure()。 - AutoHeal Telegram inline:
obs_heal已用_CURRENT_USER_ID_CTX記錄實際 Telegram user,webhook request 開頭會清空 stale user context。 - 匯入檔名日期 helper:
routes/import_routes.py已改用utils.text_helpers.extract_snapshot_date_from_filename()單一來源,並用真實日期解析拒絕20261399這類不可能日期。 monthly_summary_analysis匯入已守住「刪同年月後 append」路徑,tests/test_import_service_sql_params.py會防止該月結匯入區塊退回整表if_exists='replace'。- ROI 月報 feedback 區塊:反饋趨勢查詢失敗仍不阻擋月報,但已改為 warning + stack,避免完全靜默。
- Elephant Alpha short-circuit:
log_ai_call遙測失敗仍不阻擋省成本 return,但已改為 warning + stack。 - Claude cost throttle:成本節流檢查失敗仍維持 Claude 可用,但已改為 warning + stack,避免成本保護失效無跡可查。
ai_call_loggercaller registry:registry 匯入失敗仍不阻擋 LLM 遙測,但已改為 warning + stack。- Observability route:promotion review RAG 相似查詢、PPT audit history 缺表、host health probe 寫入、MCP 24h summary 缺表等 fail-safe 區塊已改成 debug/warning log,不再完全靜默。
- 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 target;decorator token 自動抽取與 stack caller 推斷的 best-effort 失敗也已補 debug log。cache_manager.FingerprintCache與 dashboard shared cache 清理維持 fail-open / best-effort,但已補 debug log,避免 cache fingerprint 或檔案清理失敗完全沉默。
已驗證為已修或過期
- migration / ORM:
032已入庫,033host label、034embedding_signature、035business baseline、036incidents 雙欄、037action_plans guardrails 均已存在。 migrations/031權限已是644。app.py的SYSTEM_VERSION已從config.pyimport,app 內只留版本註解。- V2 提到的
app.py死 import 與scheduler.py import schedule已不成立;app.py仍使用schedule.run_pending()等呼叫。 tests/test_phase3f_cleanup_contracts.py已補 guard:V2 點名的舊 app imports 不得回來,且app.py的 activeschedule用法不可被誤刪。- V2 點名的 3 個 silent failure 點位已不是
except: pass:OpenClaw 趨勢圖暫存檔清理與 Notification public_url 讀取失敗都會記 log,並由tests/test_phase3f_cleanup_contracts.py守住。 - Cron 盲區清單多數已補
_notify_scheduler_failure();ROI 月報已避開 09:00 改 09:05,AI smoke 已是 09:10。 - V2 指出的 9 個 cron 盲區已補回歸守門:8 個
run_scheduler.pywrapper 必須呼叫_notify_scheduler_failure(),scheduler.py::run_promo_event_task必須呼叫notify_failure()。 - 09:00 排程衝突已有回歸守門:
daily_report=09:00、roi_monthly_report=09:05、ai_smoke_daily_summary=09:10必須保持錯開。 - AutoHeal inline host transition 告警已有 DB transition dedup 守門:
run_host_health_probe()只在健康狀態翻轉且 1h 內沒有同方向 transition 時推送。 - CD migration 全範圍冪等已有回歸守門:
.gitea/workflows/cd.yaml必須維持 024-099 pattern、sort | uniq與for m in $V5_MIGRATIONSapply loop。 - CD Observability production smoke 已補 timeout 守門:
quick_review.sh --observability-smoke必須帶--timeout 12。 - 0-byte
database/momo*.db迷惑檔已不存在;真實 SQLite 僅在data/momo_database.db。 .gitignore已涵蓋.claude/worktrees/、.tmp_*、MOMO Pro/、uploads/screenshots。cache_service.py已成為cache_manager.py的相容 shim,_SALES_CACHE_TTL單一來源有測試鎖住。aiops-core/requirements.txt已不存在,aiops-core/README.md已標記此目錄只保留歷史 stub,不應安裝或部署。- V2 提到的「死依賴」不可整批刪:
beautifulsoup4用於多個 crawler、google-api-python-client用於 Google Drive、google-generativeai用於 Gemini paths、python-pptx用於 PPT generator、matplotlib用於 Telegram/圖表/PPT。 tests/test_requirements_pinning.py已鎖住上述被 V2 誤列的 runtime dependencies:套件需留在requirements.txt,且至少一個 runtime import 證據仍存在。paramiko已確認沒有 runtime import;ADR-013 現行實作改以utils/ssh_helper.py組 CLIssh,因此已從requirements.txt移除並補測試防止依賴殘影回來。pgvectorPython package 與matplotlib-inline已確認不是 runtime 依賴:pgvector 走 PostgreSQL extension + 本地 SQLAlchemyVectortype,Jupyter inline backend 不屬 production path;兩者已從requirements.txt移除並補測試。tests/test_pg_sync.py已改為 opt-in integration test:預設不再連 localhost PostgreSQL 或建立/刪除測試表,需RUN_PG_SYNC_INTEGRATION=1且提供POSTGRES_PASSWORD才執行。services/pg_sync_service.py是顯式 opt-in legacy CLI,不是生產自動同步路徑;tests/test_pg_sync_contract.py已守住預設 OFF 與 runtime paths 不自動 import。qwen3:14b不是未使用 Ollama 模型:OpenClaw QA、NemoTron dispatch 與 LLM model router 仍有現役路徑;tests/test_qwen3_runtime_usage.py已守住,不能只因體積大就三主機移除。- Telegram
momo:eig:<event_id>callback 已在routes/openclaw_bot_routes.py與services/telegram_bot_service.py實作並有 webhook 測試覆蓋,不是未實作缺口。 - Telegram
date_*/goal_*不是死 callback handler:按鈕先送await:*進入輸入等待狀態,使用者下一則文字才由 pending action 消費;tests/test_openclaw_bot_menu_keyboards.py與tests/test_openclaw_bot_routes_webhook.py已覆蓋。 services/ai_automation_smoke_service.py不是死 service:run_scheduler.py每日 09:10 掛run_ai_smoke_daily_summary_task(),該 task 會呼叫send_smoke_daily_summary();tests/test_ai_automation_smoke_service.py與tests/test_ai_automation_metrics.py已覆蓋。mcp_calls.statusCHECK 已接受ok/error/timeout/rate_limited/cache_only,與services/mcp_router.py的細分狀態一致。- DB migration / ORM 覆蓋已有
tests/test_migration_metadata_coverage.py守門,Base.metadata.tables - migrations CREATE TABLE必須為空;tests/test_ai_observability_models.py也鎖住 v5 observability ORM stub。 - V2 BLOCKED migration 守門已補:
031-037必須存在且 group/world-readable,database/momo.db/momo_data.db/momo_database.db迷惑檔不得回來。 host_health_probes.chk_host_label_029不一致已有 migration 033 修補並補測試:必須重建 CHECK,且接受GCP-SSD、GCP-SSD-2、111 備援與兩個 110 Nginx proxy runtime labels。rag_query_log/learning_episodes缺embedding_signature已由 migration 034、ORM 欄位、RAG/learning 寫入路徑與 migration metadata 測試覆蓋。incidents雙欄相容與action_planssource/status guardrails 已在 migration 036/037、migration metadata 測試與tests/test_auto_heal_safety.py覆蓋。services/agent_actions.py不是死碼:services/event_router.py透過SAFE_ACTIONSregistry 動態執行 ADR-012 L2 actions,tests/test_agent_actions.py與tests/test_event_router.py已覆蓋並通過。
不可盲動
services/agent_actions.py不能只看靜態 caller 清理;已確認它是SAFE_ACTIONS動態 dispatch 入口,未來改動必須同步更新 registry 與 EventRouter 測試。logo_circle.svg/logo_navbar.svg/logo_transparent.png不能只因 runtimerg無引用就刪;設計文件仍規劃品牌頁、登入頁、錯誤頁使用。- 多個永遠 OFF feature flag 屬產品/上線策略決策,不應在清債時直接全部改 ON 或刪除。
ai_calls.rag_hit不等同rag_query_log.saved_call:跳過 LLM 的 RAG 命中應記在rag_query_log.saved_call;有實際 LLM 呼叫且 caller 明確用了 RAG context 時才適合標ai_calls.rag_hit。
本輪已推 commits
36d0e5d標記 RAG 命中節省 LLM 呼叫20cab6e補上 RAG hit logger 回歸測試6817f64移除舊 SSH jump 設定殘影44eb369補上 MCP filesystem 唯讀白名單2068a37修正 Telegram 分類按鈕預設 callbackbdb74b1告警 BGE embedding 一致性異常d15b221細分 MCP 呼叫遙測狀態34db2db修正 scheduler 合成告警 trace5785a58補齊 scheduler 觀測任務失敗告警a335ab5修正 AutoHeal Telegram 觸發者審計d7ae243清空 Telegram webhook 使用者上下文ba8510e補齊 MCP 早退狀態317ff1b共用匯入檔名日期解析c300e49記錄 ROI 月報反饋區塊失敗f49413e記錄 EA short-circuit 遙測失敗0a75d11記錄 Claude 成本節流檢查失敗5625032記錄 AI caller registry 匯入失敗0bc6f18更新 Claude 盤點修補記憶3cb091f記錄 Observability fail-safe 區塊失敗e29529f校正 Observability 修補記憶 hash4e6e9bf綁定自動匯入日期查詢參數47c59fd更新自動匯入修補記憶ae79cdd記錄依賴盤點驗證結果2b1174a移出誤入的本地變更adfcccf補齊盤點修補 commit 清單4256a04記錄 Telegram 與 MCP 缺口驗證5285abe記錄 DB migration 覆蓋守門f9d3da5記錄 AutoHeal DB guardrail 驗證7e92850記錄 Agent Actions 動態入口驗證89c400d補上 OpenClaw best-effort 區塊紀錄ec5a22d記錄 Telegram pending action 驗證f44c429補強 AI logger best-effort 診斷8a36856補強 Telegram callback 診斷5b52af9補強 cache best-effort 診斷497c376記錄 AI smoke service 入口驗證b22cbb2守住 scheduler 失敗告警覆蓋8026b93守住 scheduler 早晨排程錯開eb6886e同步 scheduler 排程摘要b24241f守住 migration blocker 修補6c86839守住盤點誤判依賴2e2b775守住 V2 import 清理狀態58ba95b守住月結匯入 append 路徑4079f1c守住 CD migration 全範圍執行81aa424守住 Observability smoke timeoutdc99bab移出誤入的本地變更546c63f守住 V2 silent failure 修補c165081守住 host label migration 對齊4921275守住 RAG embedding signature migration035b88c守住 AutoHeal migration guardrails5b6b35f守住 AutoHeal inline 告警去重749eace移除未使用 Paramiko 依賴3c65034移除未使用 runtime 依賴