docs(skills): Add Chinese action parsing lesson to Skill 03
Record the 2026-03-23 incident where Y button failed because LLM generated Chinese action strings that couldn't be parsed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -197,6 +197,44 @@ def validate_namespace(command: str) -> bool:
|
||||
|
||||
---
|
||||
|
||||
## 🚨 中文 Action 解析 (2026-03-23 教訓)
|
||||
|
||||
> **事故**: Y 按鈕執行後顯示「錯誤」,因為 LLM 生成中文建議,`parse_operation_from_action()` 無法解析
|
||||
|
||||
### 根因
|
||||
|
||||
```json
|
||||
{"event": "background_execution_skip", "reason": "Could not parse operation type from action"}
|
||||
{"action": "擴展 awoooi-api-deployment 副本數 + 啟用 HPA"}
|
||||
{"action": "重新啟動 postgres-primary-0 服務"}
|
||||
```
|
||||
|
||||
### 支援的中文模式
|
||||
|
||||
| 中文關鍵字 | 操作類型 | 備註 |
|
||||
|-----------|---------|------|
|
||||
| 擴展...副本數 | SCALE_DEPLOYMENT | 自動移除 `-deployment` 後綴 |
|
||||
| 重新啟動 | RESTART_DEPLOYMENT | 不需要「服務」後綴 |
|
||||
| StatefulSet Pod (xxx-0) | DELETE_POD | 自動識別 `-N` 格式 |
|
||||
|
||||
### 驗證指令
|
||||
|
||||
```bash
|
||||
# 查看目前支援的解析模式
|
||||
grep -n "chinese" apps/api/src/api/v1/approvals.py
|
||||
|
||||
# 檢查 Action 解析函數
|
||||
grep -A 5 "def parse_operation_from_action" apps/api/src/api/v1/approvals.py
|
||||
```
|
||||
|
||||
### 教訓
|
||||
|
||||
1. **LLM 輸出不可預測**: 生成的建議可能是中文、英文或混合
|
||||
2. **後綴可能錯誤**: LLM 常加 `-deployment` 後綴,需自動清理
|
||||
3. **資源類型識別**: `xxx-0` 是 StatefulSet Pod,應使用 DELETE_POD 而非 RESTART_DEPLOYMENT
|
||||
|
||||
---
|
||||
|
||||
## 參考文檔
|
||||
|
||||
- `apps/api/src/services/incident_engine.py`: 聚合引擎
|
||||
|
||||
Reference in New Issue
Block a user