Commit Graph

14 Commits

Author SHA1 Message Date
OG T
578bf3bc7c docs: enforce traditional chinese documentation 2026-05-06 14:07:02 +08:00
OG T
e4bc3ec0ee docs(hard-rules): Prompt-Model 同步鐵律 — LLM Schema Drift 禁令
血的教訓 (2026-04-17): SuggestedAction enum prompt/model 不同步
→ NemoTron 輸出 investigate → Pydantic 爆炸 → 全系統 fallback 待分析

新增強制鐵律:
- 修改 prompts.py 必須同步更新 models/ai.py
- 接收 LLM JSON 的 Model 必須有 validator + fallback
- 禁止靜默死亡(必須 log 具體失敗欄位)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 21:48:50 +08:00
OG T
bb7441ec8a docs: 更新 CLAUDE.md + HARD_RULES.md v2.0 + LOGBOOK (2026-04-16)
- HARD_RULES.md v2.0: 新增 Self-Loop Workflow、Circuit Breaker Exception、State & Flow Validation
- CLAUDE.md: 補充 §4 必讀Memory 表格
- LOGBOOK: 記錄 AIOps E2E 修復進度

2026-04-16 Claude Sonnet 4.6 Asia/Taipei

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 01:20:16 +08:00
OG T
db9e304a14 feat(adr-080): Phase 0 防護欄建立 — AI 自主化飛輪啟動
- docs/superpowers/specs/2026-04-15-MASTER-ai-autonomous-flywheel-v2.md
  (1456 行,§0-§8 全填完:42-cell 戰術矩陣、7 Phase 計畫、7 ADR 摘要、
   15 KPI、21 Feature Flags、10 風險場景)

- docs/adr/ADR-080-ai-autonomy-flywheel-overview.md
  (7 Phase 結構 + 4 北極星 + 7 架構師 Review Gates + Phase 退出條件)

- apps/api/src/core/feature_flags.py
  (AIOpsFeatureFlags: P1~P6 總開關全 False + 15 細粒度子開關
   is_phase_enabled() / is_sub_flag_enabled() + bool cast 安全)

- apps/api/src/jobs/__init__.py + baseline_snapshot.py
  (Phase 0 基線快照 Job:MCP calls / Playbook confidence / general 比例
   / learning loop rate / auto_repair — 寫入 aiops:baseline:latest)

- apps/api/tests/test_feature_flags.py  (21 tests — 全綠)

- docs/HARD_RULES.md → v1.9
  (新增 Phase 退出條件鐵律:禁止未過 exit conditions 宣告 Phase 完成)

- CLAUDE.md 防失憶閘門 1:強制讀 MASTER §0 Session Resume Protocol

Gate 0 Pass — 21/21 tests green

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 12:44:53 +08:00
OG T
ce945fe89e rule(cost): 🔴🔴🔴 費用變更強制審批 — HARD_RULES v1.8 + CLAUDE.md
統帥指示 2026-04-03:
所有涉及費用產生的變更必須停下來等統帥明確批准後才可執行

新增:
- HARD_RULES.md v1.8: Cost Change Approval 章節
  - 定義涉費變更範圍
  - 強制流程: 識別→停→說明→等批准→執行
  - 今日違規教訓記錄
- CLAUDE.md 任務前必讀新增費用變更條目

Memory 已同步:
- feedback_cost_change_approval.md (新建)
- feedback_constitution_v2.md 第五章
- MEMORY.md 索引最高鐵律區

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:36:47 +08:00
OG T
73e8f8ab77 feat(ai): Phase 24-A+B1 — AI Provider Registry + 絞殺者包裝 (ADR-052)
Some checks failed
E2E Health Check / e2e-health (push) Successful in 16s
CD Pipeline / build-and-deploy (push) Has been cancelled
Brain Layer 雙軌 Registry 架構:
- 新建 src/services/ai_providers/ 目錄 (interfaces + 4 providers)
  - OllamaProvider (local, rca/chat/code_review)
  - GeminiProvider (cloud, rca/chat)
  - ClaudeProvider (cloud, rca/chat/code_review)
  - OpenClawNemoProvider (cloud, rca — 委派 188→NIM)
- 擴展 ai_router.py 加入:
  - AIProviderRegistry (動態註冊/啟停)
  - AIRouterExecutor (Cache + 閘門 CB/RL/Sem + 執行)
- openclaw.py 絞殺者包裝: USE_AI_ROUTER=true 走新路徑
- config.py + ConfigMap 加入 USE_AI_ROUTER=false (安全預設)
- ADR-052 正式文件 (14 項決策 D1-D14)
- HARD_RULES v1.7 加入 AI Router 規範

安全: USE_AI_ROUTER=false 預設不啟用,需手動開啟觀察
回滾: kubectl set env deployment/awoooi-api USE_AI_ROUTER=false

2026-04-02 ogt: Phase 24 首批實作

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 13:16:09 +08:00
OG T
9145faf24b docs: 前端內網 IP 禁令 - RCA + Hard Rule v1.6
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
E2E Health Check / e2e-health (push) Has been cancelled
事故: 2026-03-30 瀏覽器區域網路權限對話框
根因: CD 用 http://192.168.0.125:32334 建置 NEXT_PUBLIC_API_URL

已更新:
- CLAUDE.md: 新增 🔴🔴🔴 前端內網 IP 禁令章節
- HARD_RULES.md: v1.6 新增 Frontend Internal IP 規則
- LOGBOOK.md: RCA 事故回顧

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-30 01:28:38 +08:00
OG T
604e38cf07 docs: Phase 14 紅區治理 + Skills 01/03 更新
- CLAUDE.md: 紅區治理章節
- Skills 01/03: 版本更新
- ADR/Architecture: 標準化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 09:55:47 +08:00
OG T
2a2dac865a feat(api): 統一使用台北時區 UTC+8 (禁止 UTC)
- 新增 src/utils/timezone.py 時區工具函式
- 修改 11 個後端檔案,全部改用 now_taipei()
- 更新 HARD_RULES.md 加入時區鐵律章節
- 更新 Skills 02/04 加入時區禁令

🔴 HARD RULE: 禁止 datetime.utcnow() / datetime.now(UTC)
 正確做法: from src.utils.timezone import now_taipei

Memory: feedback_timezone_taipei.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-25 09:08:34 +08:00
OG T
7bd4cf30e3 fix(i18n): Add missing translations for agent, metrics, and language strategy
New translations:
- agent.state, agent.idle, agent.patrolling, etc.
- metrics.title, metrics.rps, metrics.errorRate, etc.

Updated docs:
- HARD_RULES.md: Added language strategy table
- Skills 01: Added language selection standards
- LOGBOOK.md: Updated progress

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-24 16:22:44 +08:00
OG T
9bff46a1b0 feat: integrate Sentry + fix CI/CD issues
Sentry Integration (補強 SignOz):
- Add @sentry/nextjs for frontend error tracking + session replay
- Add sentry-sdk[fastapi] for backend error tracking
- Create sentry.client/server/edge.config.ts
- Integrate with next.config.js + instrumentation.ts
- Add Sentry exception capture in FastAPI error handler
- Create deployment scripts for Self-Hosted @ 192.168.0.110

CI/CD Fixes:
- Fix F821 Undefined name 'Field' in incidents.py
- Add NEXT_PUBLIC_API_URL env var to CI build step
- Add build-arg to Docker build verification

E2E Test Improvements:
- Fix strict mode violations in dashboard-acceptance tests
- Add timeout increase for Phase 4 demo tests
- Make tests more resilient to UI variations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-24 15:19:52 +08:00
OG T
ec7e45d538 fix(api): 修復 Incident-Approval 狀態同步 BUG
🔴 P0 核心功能修復:

問題: 審核後頁面重整,Y/n 按鈕重複出現
根因: resolve_incident_after_approval 在 Redis 缺失時靜默跳過

修復:
1. proposal_service.py - 處理 Redis 缺失情況
2. approvals.py - 添加詳細日誌追蹤
3. 設定 resolved_at 時間戳

防禦性增強:
- 日誌記錄 metadata 內容
- 記錄 resolve 成功/失敗狀態
- 警告無 incident_id 的情況

長期規範:
- 新增 feedback_incident_approval_sync.md 記憶
- 更新 HARD_RULES.md API 路徑規範

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-24 10:39:22 +08:00
OG T
6e644d4fd0 docs: 禁止 Mock 測試規則整合至 HARD_RULES + CLAUDE.md
統帥鐵律 (2026-03-24):
- HARD_RULES.md 新增 No Mock Testing 章節
- CLAUDE.md 新增測試主題引用
- Skill 05 新增禁止 Mock 詳細規範
- LOGBOOK.md 更新當前狀態

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-24 10:28:46 +08:00
OG T
00d94ca71c docs: CLAUDE.md 引用 HARD_RULES.md (禁止爆滿)
結構:
- CLAUDE.md: 精簡索引,只放引用連結
- docs/HARD_RULES.md: 詳細規則

這是早就溝通好的做法,不應該忘記。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-23 23:32:35 +08:00