Skip to content

fix(ci): switch AI review to sensenova-6.8-flash-lite and treat curl timeout as non-fatal - #52

Merged
jizhenjun merged 1 commit into
ScratchV-Compiler:mainfrom
watney1024:fix/ai-code-review-model-timeout
Aug 25, 2026
Merged

fix(ci): switch AI review to sensenova-6.8-flash-lite and treat curl timeout as non-fatal#52
jizhenjun merged 1 commit into
ScratchV-Compiler:mainfrom
watney1024:fix/ai-code-review-model-timeout

Conversation

@watney1024

Copy link
Copy Markdown
Collaborator

概述

修复 ai-code-review.yml AI Code Review workflow 在大 PR 上因模型超时导致 job 失败(exit code 28)的问题。

背景

PR #35 的 CI 在 "AI Code Review" step 失败:

Reviewing: .github/workflows/ci.yml
  [ERROR] HTTP 429 for .github/workflows/ci.yml  (insufficient_quota)
Reviewing: benchmarks/bench_const_merge.py
Error: Process completed with exit code 28.

根因(本地用真实 PR 数据完整复现确认):

  1. deepseek-v4-flash 在此 key 下处理大文件 diff(如 ci.yml ~14KB payload)时持续挂起,超过 curl 的 60s 超时。
  2. 随后 --retry-all-errors 又把 HTTP 429(配额)当成可重试错误,重试 3 次,把一次超时拖成 180s+ 的挂起,最终 curl 返回 exit 28
  3. GitHub Actions 默认 bash -e -o pipefail 使任何非零退出立即中止整个 step → job 标红。

对照实验(同 key、同 PR #35 真实 diff、workflow 原样 curl 参数,仅换模型):

模型 结果
deepseek-v4-flash 第一个文件即超时 exit 28,job 崩 ❌
glm-5.2 全 429 Workspace allocated quota exceeded(key 无该模型额度)❌
sensenova-6.8-flash-lite 10 文件全 200,稳定通过 ✅

改动内容

  1. 换模型deepseek-v4-flashsensenova-6.8-flash-lite(唯一实测稳定通过的模型)。
  2. 去掉 --retry-all-errors:HTTP 429(配额)不再被重试成长时间挂起。
  3. 超时中性化:curl 失败用 || { echo "[WARN] ..."; continue; } 包裹——单文件超时被当作"本次无结果"跳过,job 仍正常成功,不再因 set -e 崩溃。
  4. 收紧超时预算--max-time 60 --retry 3--max-time 30 --retry 1,单个慢文件最多占用 ~60s(原 ~240s),确保 job 落在 timeout-minutes: 15 内。

验证

本地端到端:以 sensenova-6.8-flash-lite 跑完整 21 文件 PR #35 模拟,全部文件成功返回 review,无 exit 28 / 429 崩溃。bash -n 语法检查通过,YAML 校验通过。

备注

  • 超时语义:单文件超时会打印 [WARN] curl timeout ... skipped (no result) 并跳过该文件,job 保持绿色成功。
  • glm-5.2 已验证此 key 无额度(Workspace allocated quota exceeded),故未采用。

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

🤖 AI Code Review

共审查 1 个变更文件

📁 .github/workflows/ai-code-review.yml

🔴 No blockers found.

🟡 HTTP error codes are silently ignoredcurl exits 0 for 4xx/5xx responses; the || { … continue; } only catches transport-level failures (timeout, DNS, connection reset). A 401/429/500 will still produce a non-empty RESPONSE, and the script will proceed to parse it, likely failing later with invalid JSON or an empty BODY.
Suggestion: after parsing HTTP_CODE, add:

if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then
  echo "  [WARN] API returned $HTTP_CODE for $FILE — skipped"
  continue
fi

🟡 Dropping retries increases flakiness--retry 3 --retry-all-errors was replaced with --retry 0. Transient network blips now skip files entirely instead of retrying, which can silently reduce review coverage. The new || fallback is good, but it should be the safety net, not the primary mechanism.
Suggestion: keep --retry 3 --retry-all-errors alongside the || { continue; } guard. With --max-time 90, worst-case time becomes 270s, but successful reviews won't be lost to a single dropped packet.

💭 --retry 0 is redundant — it's equivalent to removing the flag entirely. Either delete it or set an actual retry count.

💭 Verify the new model namesensenova-6.8-flash-lite must match the exact string exposed by the Sensenova API. A typo here will surface as a 400 error (which the missing HTTP-code check above would swallow). Double-check against the provider's model list.


The AI code review workflow failed (exit 28) on large PRs because
deepseek-v4-flash processing a big file diff (e.g. ci.yml ~14KB payload)
hangs past the curl timeout, and --retry-all-errors then retried the
subsequent HTTP 429 quota errors into a 180s+ hang + curl exit 28, which
the implicit set -e (GitHub Actions default bash) turned into a job
failure.

Local repro on real PR ScratchV-Compiler#35 data (same key and workflow curl args, model
swapped):
- deepseek-v4-flash: first file times out (exit 28), job aborts
- glm-5.2: 429 Workspace allocated quota exceeded (key has no quota)
- sensenova-6.8-flash-lite: all files return 200, stable

Changes:
- Switch model to sensenova-6.8-flash-lite (verified working).
- Drop --retry-all-errors so HTTP 429 (quota) is not retried into a hang.
- Wrap curl in || { [WARN] ...; continue; } so a per-file curl failure is
  treated as 'no result' and skipped while the job still succeeds, instead
  of aborting via set -e.
- Set --max-time 90 --retry 0: gives large diffs enough time while capping
  worst case at 90s/file (10 files fit inside timeout-minutes: 15).
@watney1024
watney1024 force-pushed the fix/ai-code-review-model-timeout branch from 9333cae to 41a112f Compare August 25, 2026 14:18
@jizhenjun
jizhenjun merged commit bb601d4 into ScratchV-Compiler:main Aug 25, 2026
4 checks 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.

2 participants