fix(telegram): respect C-Suite decision - OpenClaw is sole brain
架構修正 2026-03-23 (遵循 C-Suite 決議): - 鐵律: .188 為唯一大腦,禁止腦分裂 - OpenClaw (192.168.0.188) = 唯一 Telegram Gateway - AWOOOI API (K8s) = Web API + Sensor,不做 Polling - TELEGRAM_ENABLE_POLLING 預設 False Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -235,6 +235,14 @@ class Settings(BaseSettings):
|
||||
default="",
|
||||
description="Telegram user IDs allowed to sign approvals (comma-separated or JSON array)",
|
||||
)
|
||||
# 2026-03-23 架構修正 (遵循 C-Suite 決議)
|
||||
# 鐵律: .188 為唯一大腦,禁止腦分裂
|
||||
# OpenClaw (192.168.0.188) = 唯一 Telegram Gateway
|
||||
# AWOOOI API (K8s) = Web API + Sensor,不做 Polling
|
||||
TELEGRAM_ENABLE_POLLING: bool = Field(
|
||||
default=False,
|
||||
description="Telegram Polling (False: OpenClaw handles it; True: only if OpenClaw unavailable)",
|
||||
)
|
||||
|
||||
def get_tg_user_whitelist(self) -> list[int]:
|
||||
"""Parse comma-separated or JSON array user IDs to list[int]"""
|
||||
|
||||
@@ -103,10 +103,17 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
publisher = await get_publisher()
|
||||
logger.info("sse_publisher_initialized")
|
||||
|
||||
# Phase 5: 啟動 Telegram Long Polling (內網修復)
|
||||
# 統帥鐵律: 內網環境無法接收 Webhook,必須主動輪詢
|
||||
# Phase 5: Telegram Gateway 初始化
|
||||
# 2026-03-23 架構修正: AWOOOI API 不做 Long Polling
|
||||
# 原因: 同一個 Bot Token 只能有一個 Long Polling 實例
|
||||
# OpenClaw (192.168.0.188) 是唯一的 Polling 實例
|
||||
# AWOOOI API 只負責發送訊息,不接收
|
||||
telegram_gw = get_telegram_gateway()
|
||||
await telegram_gw.start_long_polling()
|
||||
if settings.TELEGRAM_ENABLE_POLLING:
|
||||
await telegram_gw.start_long_polling()
|
||||
logger.info("telegram_long_polling_started")
|
||||
else:
|
||||
logger.info("telegram_polling_disabled", reason="OpenClaw 是唯一 Polling 實例")
|
||||
|
||||
# Phase 6.1: 啟動 Signal Worker (Redis Streams Consumer)
|
||||
# 統帥鐵律: Event Bus 解耦告警接收與處理
|
||||
|
||||
Reference in New Issue
Block a user