Skip to content

ai-review: cắt chi phí (PR + staging/prod), dùng lại verdict, fail-open có cảnh báo - #5

Merged
meocong merged 2 commits into
mainfrom
feat/ai-review-qwen-cost
Nov 17, 2026
Merged

meocong merged 2 commits into
mainfrom
feat/ai-review-qwen-cost

Conversation

@meocong

@meocong meocong commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Sau vụ getnexai trả 402 từ 26/10 (gate fail-open im lặng → mọi review đều PASS).

Chưa merge: cần đổi secret OPENAI_BASE_URL/OPENAI_API_KEY ở 17 repo sang endpoint mới + alias model ai-review trước.

Thay đổi: xem commit message. Không phải sửa workflow ở repo app nào — caller giữ nguyên.

Test: python3 -m unittest discover -s .github/scripts (14 test) + chạy script local với LLM giả: tag-only PASS, blocker FAIL exit 1, LLM chết → warning + exit 0.

…HA/PR, fail-open có cảnh báo

- Tách logic sang .github/scripts/ai_review.py (repo public → job tự checkout), hết bẫy
  biểu thức GHA literal trong run-block; thêm unit test + workflow ci (actionlint + test).
- Bước decide: push develop/feature, workflow_dispatch → job SUCCESS nhưng không gọi LLM
  (skip ở step để không kéo build-develop skip theo).
- Push staging/prod: SHA đã có comment review hoặc thuộc PR đã merge đã review → dùng lại.
- Profile deploy: commit chỉ đổi tag image (cùng repo) → PASS không gọi LLM.
- Context: git diff -W (nguyên hàm) thay full file, cap 45KB; bỏ docs/md/locale/snapshot.
- Output có severity + confidence; verdict tính bằng code (FAIL ⇔ blocker ≥ 0.8).
- 1 comment/PR sửa tại chỗ; marker ẩn để khử trùng.
- LLM lỗi → ::warning + comment KHÔNG CHẠY ĐƯỢC thay vì PASS im lặng.
- Model mặc định 'ai-review' (alias phía gateway), tắt thinking qua llm_extra_body.
@meocong
meocong merged commit f41783b into main Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants