fix(phase22): 修復 Telegram 對話三個 Bug (ADR-044)
All checks were successful
E2E Health Check / e2e-health (push) Successful in 18s

P0: security_interceptor.py 新增 intercept_telegram() 方法
- 修復 _handle_chat_message 的 AttributeError (致命 Bug)
- 白名單驗證,不需要 Nonce (對話訊息 vs 按鈕回調)

P1: nvidia_provider.py chat() 新增 use_json_mode 參數
- 對話場景預設 False (自然語言回應)
- RCA/分析場景傳入 True (結構化 JSON 輸出)
- openclaw.py RCA 呼叫加上 use_json_mode=True

P2: K8s ConfigMap 啟用 TELEGRAM_ENABLE_POLLING=true
- K8s AWOOOI API 接管 @tsenyangbot Long Polling
- OpenClaw (188) 停止 Telegram,改為純 REST 服務

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-31 21:53:09 +08:00
parent 589f2fc4c7
commit cc6b18e3bc
4 changed files with 29 additions and 5 deletions

View File

@@ -270,6 +270,25 @@ class TelegramSecurityInterceptor:
return is_allowed
async def intercept_telegram(self, user_id: int) -> None:
"""
攔截 Telegram 文字訊息 (ADR-044 Phase 22)
用於 _handle_chat_message 的白名單驗證。
與 verify_callback 不同,純文字訊息不需要 Nonce 防重放。
Args:
user_id: Telegram user ID
Raises:
UserNotWhitelistedError: user_id 不在白名單內
"""
# 2026-03-31 ogt: Phase 22 修復 - 補齊對話訊息的安全攔截方法
if not self.is_whitelisted(user_id):
raise UserNotWhitelistedError(
f"User {user_id} is not in the chat whitelist"
)
async def verify_callback(
self,
user_id: int,