fix(alerts): correct telegram execution truth
This commit is contained in:
@@ -8377,9 +8377,7 @@ class TelegramGateway:
|
||||
if action == "approve":
|
||||
status_emoji = "✅"
|
||||
status_text = f"<b>已批准</b> by {_html.escape(username)}"
|
||||
# 2026-04-14 Claude Sonnet 4.6: 原「等待執行」誤導(實際沒有 gate 會卡住路徑)
|
||||
# 批准後一律顯示「執行中」,真實結果由 _push_execution_result_to_alert reply 補上
|
||||
suffix = "⚡ 執行中..."
|
||||
suffix = "⚡ 執行中..." if execution_triggered else "已簽核,等待更多簽核"
|
||||
else:
|
||||
status_emoji = "❌"
|
||||
status_text = f"<b>已拒絕</b> by {_html.escape(username)}"
|
||||
@@ -8495,7 +8493,7 @@ class TelegramGateway:
|
||||
# 2026-04-22 Claude Sonnet 4.6: 只有真正轉為 APPROVED 才發「執行中...」
|
||||
# 非 PENDING 狀態下 sign_approval early-return → approval 是舊 record
|
||||
# 此時不應發「執行中...」,應告知用戶告警已處理過
|
||||
if approval.status == ApprovalStatus.APPROVED:
|
||||
if approval.status == ApprovalStatus.APPROVED and execution_triggered:
|
||||
# 2026-04-09 Claude Sonnet 4.6: 回應 Telegram — 更新訊息狀態 + answer callback
|
||||
await self._notify_approval_result(
|
||||
message_id=message_id,
|
||||
@@ -8520,7 +8518,7 @@ class TelegramGateway:
|
||||
# 原本 gate 用 execution_triggered,race condition 時失效(樂觀鎖失敗)
|
||||
# 改用 approval.status == APPROVED(與 REST API 路徑 approvals.py:360 對齊)
|
||||
# 用 Redis lock exec:{approval_id} 防重入(REST + Telegram 同時簽核)
|
||||
if approval.status == ApprovalStatus.APPROVED:
|
||||
if approval.status == ApprovalStatus.APPROVED and execution_triggered:
|
||||
import asyncio
|
||||
|
||||
from src.core.redis_client import get_redis
|
||||
|
||||
Reference in New Issue
Block a user