* fix: surface event payload read/parse failures in ai_review (fixes#2070)
Issue #2070: .github/scripts/ai_review.py::_event_payload() previously
caught (OSError, ValueError) and silently returned {}, which collapsed
three distinct failure modes — missing event file, unreadable file, and
malformed JSON — into a single downstream symptom
('PR number is unavailable for GitHub API review'), making PR review
failures in workflow_dispatch / schedule runs impossible to triage.
Fix preserves the empty-payload degradation contract (so PR_NUMBER still
unblocks the chain when set explicitly), but splits the except clause
into three distinct branches that print a warning identifying the
failure mode by name (file-missing / OSError-derived / JSONDecodeError-
derived), the source path being GITHUB_EVENT_PATH, and the exception
class name. The warning never prints the payload content.
Tests in tests/test_ai_review_github_api.py add regression coverage for:
- missing event file -> {} + 'GITHUB_EVENT_PATH 指向的文件不存在'
- unreadable file (chmod 0o000) -> {} + '事件载荷读取失败' (skipped
on root runners where chmod is a no-op, but never raises)
- invalid JSON -> {} + '事件载荷 JSON 解析失败'
- valid JSON happy path -> payload + no warning (guards against the
warnings accidentally firing on success)
- PR_NUMBER unset + bad event payload -> RuntimeError surfaces with
the warning printed first so logs distinguish 'bad payload' vs
'no PR number'
10 tests pass (5 new + 5 existing) in 0.09s.
* fix: 回应 codex P2 review 反馈 (PR #2096)
1. UnicodeDecodeError 显式分支: open(..., encoding='utf-8') 在非合法 UTF-8
字节序列上抛 UnicodeDecodeError(是 ValueError 子类,旧 (OSError, ValueError)
接住了它,但拆成 OSError + JSONDecodeError 后该异常不再被覆盖,会让 review
终止而非降级). 新增 unicode 分支恢复降级行为,补 1 条独占回归测试.
2. CHANGELOG 收窄到本 PR 实际范围: 移除两条无关条目(parse_analysis_target 来自
PR #2094,YfinanceFetcher 港股裸码路由来自 PR #2097),它们不应进入本 PR 的
release notes.
- Pass auto-check job outputs (syntax_ok, has_py_changes, result) as env vars to ai_review.py
- Add _build_ci_context() to build CI status section injected into review prompt
- Update prompt: AI reviewer must reference CI status before judging validation sufficiency
- Clarify blocker vs suggestion: only correctness/security/CI failure/contradiction/missing rollback are blockers
- Update AGENTS.md: add CI coverage principle, blocking conditions, suggestion conditions