fix(approval): route SSH actions through SSHProvider on manual approve

parse_operation_from_action only knew kubectl and Chinese restart phrases,
so any "ssh host '...'" action approved via Telegram fell through to
"Could not parse operation type" and reported a fake failure even though
the LLM had proposed a valid host repair.

Adds OperationType.SSH_HOST, makes the parser detect ssh prefixes (with
optional flags / user@host) before kubectl patterns, and routes the
SSH_HOST branch in approval_execution.execute_in_background through
SSHProvider with the same tool keywords decision_manager uses
(ssh_docker_prune / ssh_docker_restart / ssh_systemctl_restart /
ssh_diagnose). Unroutable SSH actions now fail loudly with a descriptive
error instead of silently breaking.

Trigger: 2026-05-02 incidents INC-20260502-D6D0B7 / E12EE4 / 557055
were approved by the user but executor reported "Could not parse" and
left the alerts pending.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Your Name
2026-05-02 11:59:50 +08:00
parent 3156ff1c69
commit 607358c4dd
5 changed files with 240 additions and 13 deletions

View File

@@ -49,6 +49,9 @@ class OperationType(str, Enum):
SCALE_DEPLOYMENT = "SCALE_DEPLOYMENT"
# 2026-04-24 ogt + Claude Sonnet 4.6: Gate 11 修復 — 唯讀查詢類型kubectl get/top/describe/logs
INVESTIGATE = "INVESTIGATE"
# 2026-05-02 ogt + Claude Sonnet 4.6: 主機 SSH 操作docker / systemctl / 診斷)
# 走 SSH MCP Provider 而非 K8s executor解 approval 後 SSH action 卡在「Could not parse」的 bug
SSH_HOST = "SSH_HOST"
# =============================================================================