Skip to content

fix(ci): ci-net-retry 识别 apt 的 429/5xx 镜像限流并重试 - #3630

Merged
deepcoldy merged 2 commits into
deepcoldy:masterfrom
zerone0x:fix/ci-net-retry-apt-429
Nov 20, 2026
Merged

deepcoldy merged 2 commits into
deepcoldy:masterfrom
zerone0x:fix/ci-net-retry-apt-429

Conversation

@zerone0x

@zerone0x zerone0x commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #3573. scripts/ci-net-retry.mjs did not recognise apt's 429 Too Many Requests output, so network-boundary failed immediately on a mirror rate limit instead of retrying.

Root cause

TRANSIENT only matched npm/bun/curl shapes (GET <url> - 429, code E429, Response code 429). apt prints Err:N <url> / 429 Too Many Requests [IP: ...] and E: Failed to fetch ... 429 Too Many Requests, which neither list matched, so it was classified unknown and not retried.

Changes

  • scripts/ci-net-retry.mjs: add one TRANSIENT rule for apt status lines (408 Request Time-out, 429 Too Many Requests, 502/503/504/500 with their reason phrases). DETERMINISTIC is still checked first, so 401/403/404 and signature errors still fail fast.
  • test/ci-net-retry.test.ts: fixtures for the apt 429 log (shape from the ci-net-retry 不识别 apt 的 429 输出,network-boundary 遇镜像限流不自动重试 #3573 job) and a 502; a bounded-retry test (recovers / exhausts 5 attempts); a test that 429 together with 404 stays deterministic.

Repro

Before: the new apt 429 / 502 fixtures classify as unknown (4 new tests fail with the script reverted). After: they classify as transient and runWithRetry retries up to 5 times.

Safety

Deterministic patterns take precedence, so the new rule cannot retry a not-found/forbidden/signature failure. Covered by the added 429+404 test and the existing apt deterministic cases.

Tests run

  • vitest run test/ci-net-retry.test.ts: 71 passed, 0 failed. Reverting the script change makes 4 of them fail. The runner was a minimal copy (the two files plus the workflow files the test reads), because the machine's disk was full and a full bun install was not possible. Full CI is the full-suite check.

Behaviour changes and questions for maintainers

apt update/install now retries on 408/429/500/502/503/504 responses (bounded: 5 attempts, up to 150s of waiting). The fixture is reconstructed from the issue's log excerpt; the IP in it is illustrative.

@deepcoldy

Copy link
Copy Markdown
Owner

你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改:
https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=136uea82-1628-4774-8a39-8b75effa2e9e

另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe

(本条为自动流程发出的提示消息)

新增 TRANSIENT 规则里 408、500、503(两种原因短语)、504 分支此前
没有专属用例:实测摘掉这些分支测试仍全绿(变异存活)。补 5 条 apt
日志形态夹具,每个状态码与短语分支的变异现在都会咬红。

Co-Authored-By: Claude Fable 5 <[email protected]>

@deepcoldy deepcoldy left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

结论:针对 f0102f84d,代码与测试层面可合,未发现新的合前阻断项。 新 head 的 CI 在发表本意见时仍在运行,合并仍以最终 checks 为准。

1. 补充夹具足够,变异验证通过

test/ci-net-retry.test.ts:26-32 现在覆盖 apt 的 408、429、500、502、503(两种短语)与 504;runWithRetry 的恢复/持续失败两条路径也已有 429 用例。

我在独立临时源码副本中复验,而不是仅阅读夹具:

  • 基线 Vitest:76/76 通过;当前 worktree 另跑 Bun:76/76 通过。
  • 11 组单点变异(逐个移除状态码、原因短语,以及切换 503 长/短短语)全部咬红。
  • 将 scripts/ci-net-retry.mjs:54 整条新 apt 规则置为不命中后,恰好 9 failed / 67 passed:7 条分类用例加 2 条 429 重试用例。

因此 f0102f84d 已补齐此前存活的正则分支,不再只是给实现拍照。

2. 认可 flake 归因与 #3643

  • 原 run 44562559664 的 bun-test (3/4) 日志确认为 test/v3-progress-card-manager.test.ts:198 期望 1 次、实际 0 次;该分片 608 个文件中只有这个文件失败。
  • 该测试文件相对本 PR 基线逐字未变;当前 head 下 Vitest 与 Bun 各跑一次均为 13/13 通过。
  • test/v3-progress-card-manager.test.ts:191 只等待真实 setTimeout(10),而首次 refresh 在调用 reply 前还要经过 src/im/lark/v3-progress-card-manager.ts:223 的文件锁、sidecar/envelope/journal 读取与写入,直到 :300-302 才进入 transport。runner 过载时断言先于首次 reply 执行,得到 0 次;这不是合流逻辑产生重复调用的失败形状。

#3643 的根因描述成立,改成等待 fake reply 首次进入的 promise 后再断言,也比继续调大 wall-clock 更合适。

非阻断备注

  • scripts/ci-net-retry.mjs:54 的状态码+短语匹配没有限定 apt 行或 apt 命令。行为探针确认:普通编译错误若打印源码 throw new Error("500 Internal Server Error"),也会被判为 transient 并有界重试。最终结果与退出码不变,只增加最多 150 秒等待,因此不作为本 PR 阻断项;后续若要收紧,可锚定 apt 的 Err: / Failed to fetch 行。
  • test/ci-net-retry.test.ts:12 的注释统称样本为真实输出,但 :27-32 是占位 IP 的合成夹具;下次触碰时可把「现场日志」与「合成边界样本」分开描述。

@deepcoldy

Copy link
Copy Markdown
Owner

补充 CI 首跑结果:f0102f84d 对应的 run 44655777697 已完成且结论为 success。build、test (1/4–4/4)、bun-test (1/4–4/4)、三个 binary 作业及两个聚合 check 共 14 项均为 SUCCESS;API 确认 PR head 仍是 f0102f84dadb0bdb9f5008b0c71942039444b473。此前意见中的 CI 待定项已消除。

@deepcoldy
deepcoldy merged commit 189f370 into deepcoldy:master Nov 20, 2026
14 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

感谢贡献,已合并。

本 PR 让 scripts/ci-net-retry.mjs 能识别 apt 的 408/429/500/502/503/504 状态行并按既有退避策略有界重试;DETERMINISTIC 仍优先判定,401/403/404 与签名错误继续快速失败,不会被误重试。合入时在作者提交之外追加了一条纯测试提交,为新规则的每个状态码与原因短语分支补齐夹具——这些分支此前没有对应用例,摘掉后测试仍会全绿。

后续跟踪(均不阻断本 PR):

以上为自动评审流程的落地记录,最终以维护者审阅为准,欢迎继续贡献。

@github-actions

Copy link
Copy Markdown

@zerone0x @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 189f370…411e9d032(8 个提交),同批合入的还有 #3610 #3642 #3632 #3635 #3633 #3629 #3567,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Codex prompt submission feishu-core-codex failed Replanned 20 times, exceeding the limit. Please configure a larger value for replanningCycleLimit (or use MIDSCENE_REPLANNING_CYCLE_LIMIT) to handle more complex tasks.
Consecutive message queue feishu-core-queue failed waitFor timeout: The screenshot shows a chat application interface. The left panel lists various topics, including one highlighted at the top: "申晗: e2e-consec-1-179...". However, the right main conte…

@github-actions

Copy link
Copy Markdown

🚀 Released in v3.59.23

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.

ci-net-retry 不识别 apt 的 429 输出,network-boundary 遇镜像限流不自动重试

2 participants