22 KiB
22 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;infer_caller_from_stack()確認無 caller 後已移除。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_*、tmp_*.png、MOMO Pro/、root/uploads/screenshots 與MOMO Prouploads/screenshots,並由tests/test_gitignore_contracts.py守住。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已守住,不能只因體積大就三主機移除。- Ollama host env 已加白名單護欄:
OLLAMA_HOST*/EMBEDDING_HOST只接受 GCP-A、GCP-B、111 或 110 proxy,誤設 188/localhost 會回到核准主機。 - Hermes intent 與批量 analyst 已從單次
resolve_ollama_host()+ rawrequests.post('/api/generate')改為OllamaService.generate(),同一請求會依序 retry GCP-A → GCP-B → 111,並保留HERMES_KEEP_ALIVE與實際 provider 回寫測試。 - NemoTron qwen3 dispatch 的
/api/chattool-calling 路徑已補同一請求三主機 retry:host 失敗會mark_unhealthy()後再 resolve 下一台,GCP-A 失敗可在同次 dispatch 接 GCP-B/111,三台都失敗才 fallback NIM。 - PPT vision、PPT 文案 final fallback 與 MCP 離線 final fallback 已改走
OllamaService.generate();OllamaService.generate()支援options、keep_alive與 visionimages,特殊/api/generate路徑同樣取得三主機 retry。 - OpenClaw QA / daily Hermes template / NemoTron qwen3 的 flag 文件與測試已對齊 Ollama-first 預設 ON;顯式
false才是 Gemini/NIM legacy 緊急退路。OpenClaw QA 已移除單一OPENCLAW_QA_OLLAMA_HOST主機覆寫,_call_qwen3_qa()改走OllamaService的 GCP-A → GCP-B → 111 retry 並回寫實際 provider。 - Code Review pipeline 已對齊 Ollama-first:
_hermes_scan()與_openclaw_assess()都先走OllamaService的 GCP-A → GCP-B → 111 retry;Gemini 僅在 Ollama(與可選 Claude)失敗後以code_review_openclaw_geminicaller 記錄備援,不再以code_review_openclaw直接 Gemini-first。 - Telegram 圖片商品辨識已對齊 Ollama-first:
routes/openclaw_bot_routes.py會先用OPENCLAW_IMAGE_VISION_MODEL透過OllamaServiceretry GCP-A → GCP-B → 111;Gemini 只以openclaw_bot_image_geminicaller 作為圖片辨識備援。 .env.example已補齊 Python runtime 實際讀取的環境變數,tests/test_phase3f_cleanup_contracts.py::test_env_example_documents_runtime_os_env_keys會掃app.py/config.py/scheduler.py/run_scheduler.py/routes/services/utils的os.getenv()/os.environ.get();只允許PYTEST_CURRENT_TEST與MOMO_ALLOW_INSECURE_CONFIG_FOR_TESTS兩個測試內部 key 不進範例。docker-compose*.yml使用的${VAR}也已納入.env.example契約,包含 MCP compose 的TAVILY_API_KEY、EXA_API_KEY、MCP_POSTGRES_PASSWORD、FIRECRAWL_AUTH_KEY,以及 image tag / Grafana / pgAdmin / Metabase / Grist 變數;test_env_example_documents_docker_compose_variables會守住。- Market Intel
seed_writer_cli_statusroute 已補 API 層回歸:即使execute=true且環境有MARKET_INTEL_SEED_WRITE_APPROVAL,API 仍不得回吐 token /approval_token_hint/ 固定 token 文案,且不得 ready 或寫入;tests/test_market_intel_skeleton.py::test_seed_writer_cli_status_route_never_leaks_approval_token會守住。 - Docker 主 compose 的
momo-app/scheduler/telegram-bot已有mem_limit與healthcheck,並由tests/test_docker_compose_runtime_mounts.py守住;V2 提到的 nginx / nginx-monitor / metabase / grist healthcheck 缺口需先看 profiles,這些服務分別被鎖在local-dev、deprecated、bi,不是 default production path。 - MCP compose 安全邊界已有
tests/test_mcp_compose_contracts.py:postgres/omnisearch/firecrawl healthcheck、Firecrawl/Playwright/Redis/filesystem memory guardrails、filesystem-mcp read-only mount 與不接 docker socket 都會被測試守住。 _navbar.html已移除 V1 點名的--momo-legacy-accent與舊 hex#d96f52/#a95846/#9f4f3e,改用--momo-nav-accent*接--momo-page-accent*warm tokens;tests/test_frontend_v2_assets.py::test_legacy_navbar_uses_warm_token_accent_aliases會守住。routes/price_comparison_routes.py的 MOMO crawler TODO 已接到既有services.momo_crawler.search_momo_products();未手動上傳 MOMO 商品時會自動抓 MOMO,再交給比價服務。- 未引用的根層
templates/list.htmlPhase 4 placeholder 已刪除,真實缺貨清單 route 使用vendor_stockout_list_v2.html(或ui=legacy時的vendor_stockout/list.html);tests/test_phase3f_cleanup_contracts.py會防止根層 placeholder 回來。 - AI 觀測台 V3 排版規範已補強:
scripts/check_responsive_overflow.js會把視覺 overflow offenders 視為失敗,並允許表格/圖表在.obs-table-shell、.obs-chart-frame等局部容器內滾動;observability-system.css/web/static/css/observability-system.css已同步新增 bounded table/chart/mobile containment,CSS mirror 與quick_review.sh --observability-qa --skip-production均通過。 - app.py/BP 路由雙寫已完成收斂:active
@app.route為 0,USE_MODULAR_ROUTES與舊 routes registry shim 已不存在;tests/test_phase3f_cleanup_contracts.py::test_app_py_stays_blueprint_only_for_routes會防止 route decorator 回到app.py。 app.py開頭的歷史「重開機後請依序執行」TODO banner 已移除;入口治理以AGENTS.md/CONSTITUTION.md/ ADR / memory 索引為準,tests/test_phase3f_cleanup_contracts.py::test_app_py_does_not_start_with_stale_restart_todo_banner會防止 stale 操作清單回流。docs/guides/devops_handbook.md已移除活躍手冊中的舊 K8s command 區塊,並把 app 操作改為 Gunicorn HUP 熱重載、Docker Compose 精準 force-recreate、momo-appservice build;tests/test_phase3f_cleanup_contracts.py::test_devops_handbook_uses_current_docker_runtime_commands會防止kubectl、docker restart momo-pro-system與錯誤 compose service name 回流。/cicdlegacy dashboard 已停用舊叢集副作用:rollback 會回 410,restart_podsaction 會被拒絕,diagnosis 不再 SSH 執行叢集探測;tests/test_cicd_legacy_cluster_disabled.py會防止kubectl/ rollout command 回到routes/cicd_routes.py。- AI 觀測台 badge/chip 對比規範已補強:
.momo-observability-mode內的 badge、pill 與 nested surface 會改走亮底、8px radius、無負字距、可換行且不再殘留低對比 legacy dark-hero 樣式;CSS mirror、quick_review.sh --observability-ui、quick_review.sh --observability-qa --skip-production均通過。 - AI 觀測台 rendered visual contract 已入庫:
scripts/check_observability_visual_contract.sh會用 Playwright 檢查 10 頁 × desktop/tablet/mobile 的 title typography、surface radius/background、chip contrast、hero height 與水平 overflow;V10.116 main 版 local server 驗證 30 項 PASS。測未部署變更時必須帶 localhost--base-url,打 production fail 可能只是正式站尚未部署該版。 - V10.117 已把 AI 觀測台背景語彙收斂為 tokenized dot-matrix:合約會要求 hero/signal/panel surface 的 computed
background-image是radial-gradient,並拒絕 legacylinear-gradient/background-image: none回流;終端 dot-matrix layer 必須留在 CSS 檔尾以贏過舊 neutralizer。 /observability/host_health在 SQLite local QA 下已略過host_health_probespersistence,避免 BIGINT autoincrement drift 造成 warning;正式 Postgres session 仍維持 probe history 寫入,tests/test_admin_observability_routes.py::test_host_health_skips_probe_persistence_on_sqlite會守住。- 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已鎖住 L2SAFE_ACTIONS與 L3OPS_ACTIONS邊界,防止 HITL ops 動作誤進自動白名單。
不可盲動
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 依賴
後續補推 commits(3c65034 之後)
2ac751f補齊盤點修補 commit 清單6c236eb快取當日業績頁面內容0d68f3e快取商品看板比價總覽c306fb6隔離 PG sync 整合測試8099bb6守住 qwen3 現役模型路徑49c576b標定 PG sync 為 opt-in 工具1aeb4a4移除 AI logger 未用 stack 推斷d02b712標明 cache service 相容角色72daa53快取業績分析頁面資料8b5a4a3接上 MOMO 自動比價爬蟲5942e39守住本機產物忽略規則ce20892限制 Ollama host 只能走核准節點6313fdd對齊 Ollama-first flag 語義d6e8a4f忽略本地截圖暫存檔0c9f927啟用 Market Intel seed writer CLI gate2130c4f守住 AI provider Ollama-firstb65a319固化 Ollama 三主機路由紅線0380d4c接上 responsive overflow quick review86fc9c9避免商品看板冷快取阻塞ec93d09收緊模組化治理掃描範圍b2ab03f入庫 responsive overflow guard 腳本5ee7fd9忽略未確認設計審計 dumpf8b9b1a共用業績分析頁面快取d384c35快取業績分析頁面 contextd8c7f6f快取當日業績頁面 context2f67e16共用當日業績頁面快取ab612cb補 OpenClaw 選單複核報告c78bb1d記錄 Market Intel 正式端只讀複核9ec7713補 AiderHeal 靜默失敗診斷28c9555修正挑品 Agent SQLite fallbackc227bb4補競品 Feeder 搜尋詞 fallback 診斷dd8ccdf共用業績分析引導頁快取e8497d0補業績分析引導頁快取測試f4883b4保留 PPT Vision 主機標記失敗診斷bff8c49補 Code Review 失敗通知診斷0bdb993補 OpenClaw 報表資料解析診斷25e0570補齊 AI runtime 環境範例2b2233d補齊 OpenClaw 與 DeepSeek 環境範例acef0fa守住 runtime 環境變數文件契約ae1895f守住 compose 環境變數文件契約73bbc45更新 Claude 盤點驗證記憶490336a守住 Market Intel seed token 不外洩dc6fc69守住核心容器資源與健康檢查7766e35守住 MCP compose 安全邊界621c9f2守住 optional compose profile 邊界353295a移除舊 Navbar accent 色票殘影ca97840守住 Agent Actions 動態白名單邊界ba140f1移除未引用缺貨清單佔位模板9af9592修正 AI 觀測台 V3 排版規範a305b26記錄觀測台 V3 排版守門830661b守住 app.py 不再新增路由c50180f補齊 AI 觀測台 badge 對比規範b7ba54a更新 ADR-017 模組化現況b6e6573收斂觀測台手機字體與視覺契約c10e6a4記錄觀測台視覺契約守門5a21e23略過 SQLite host probe 寫入f947469融合觀測台點陣視覺語彙60b73e1固定觀測台點陣層覆蓋順序