Repository navigation
Commit 97defd6
fix(ci): a stalled history fetch is killed and retried, not left to the step's wall (#34582)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9R6fQuMSzSrRW2oowG4K2kQ)_
Fixes #34561
Governed: `.github/workflows/ci.yml`, `.github/workflows/lint.yml` (Tier
H). **改根 ci.yml,需维护者同意。**
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:CI 里「Fetch this commit's history and the base
branch」这一步(`test-plan`、`test`、`type-check-ui`、`test-ui-plan`、`test-ui`
五个 job 各一份)合成一个脚本 `scripts/ci/fetch-history.sh`。每次 `git fetch`
都带进度输出、单独一个进程组;一次尝试 60 秒没有任何输出,就连同 `git-remote-https`
一起杀掉,进入下一次重试。还在动的拉取(哪怕很慢)不会被打断。
- 为什么改:2026-11-16/17 五小时内四次步骤超时(push `6a7403ba` Test Core 7/8,队列
pr-34447 Test Core 5/8、pr-34381 Test UI 4/16、pr-34511 Plan Test Core
shards)。能找到的三份日志一样:第 1 次 fetch 一直没输出,直到 8/14/20
分钟的步骤预算把它杀掉,原来的三次重试一次都没轮上;同一 run 的兄弟分片拉同样的历史只用 47–96
秒。所以不是深度或体量,是传输卡死而没人发现。
- 风险与回滚:没有调大任何超时,五个步骤的预算不变;拉取的内容(HEAD 全部祖先 + main,PR 进别的分支时再加那个分支,不拉
tag)不变。回滚即 revert 本 PR。
- 先看:`scripts/ci/fetch-history.sh` 的 `fetch_once`(看门狗 + 进程组杀);`ci.yml`
五处步骤现在都只剩 `run: bash scripts/ci/fetch-history.sh`。
- 两分钟验证:`pnpm check:fetch-history`,预期 46 项 PASS(约 40 秒,离线)。
- 需要你做的:**同意改根 ci.yml**,并按 Tier H 审批。
## What changes
- **`scripts/ci/fetch-history.sh`** (new): the step's body, once. Same
refspecs, same `--unshallow` of HEAD's sha, same three attempts and 15 s
/ 30 s sleeps, same `::error::` and `History:` lines. New: `git fetch
--progress` into a log, started under `setsid` so git and its
`git-remote-https` helper share a process group of their own; a watchdog
ends an attempt after 60 s in which the log did not grow (`kill -TERM`
then `-KILL` to the group), prints the attempt's last progress line per
phase (so the next stall names where it stopped), warns, and lets the
loop retry. The 60 s is silence, not elapsed time: a healthy fetch
writes at least once a second (enumerating, counting, compressing, then
receiving with its byte rate).
- **`.github/workflows/ci.yml`**: the five inline copies become `run:
bash scripts/ci/fetch-history.sh`; budgets (8 / 20 / 20 / 14 / 14)
untouched. The `test` job's comment, which sizes the budgets, now says
why the body is shared and bounded; the three "verbatim but for its
budget" notes say "the same script with its own budget".
- **`ui/scripts/__tests__/select-affected-tests.test.ts`**: the two
#22034 pins read the script for the fetch spelling and ci.yml for the
call.
- **`scripts/ci/fetch-history.selftest.sh`** (new) +
`check:fetch-history` + a `History fetch self-test` step in lint.yml's
`lint-ci-engine` job, next to the Test Core package-selection self-test.
## Evidence
<details><summary>The three failed logs (attempt 1 silent until the
budget; orphan helper reaped)</summary>
```
job 133708987651 merge group pr-34511 Plan Test Core shards
00:04:02 Run refspecs=… (attempt 1: git fetch --no-tags --unshallow origin ea1edf9… +refs/heads/main:…)
00:12:15 ##[error]The action 'Fetch this commit's history and the base branch' has timed out after 8 minutes.
Terminate orphan process: pid (2206) (git-remote-https)
job 133645669009 merge group pr-34381 Test UI (4/16)
22:02:27 → 22:16:40 timed out after 14 minutes; orphan git, git, git-remote-https
job 133557664420 push 6a7403b Test Core (7/8)
19:35:18 → 19:55:31 timed out (20 min); orphan git, git, git-remote-https
Sibling shards' successful fetch step, same runs (s): 47 48 48 49 53 61 63 63 96 (push) · 49 50 50 51 53 53 57 57 60 61 62 65 66 67 67 67 96 (pr-34381)
```
The pr-34447 run is past the run listings I read; the card's table
reports the same signature.
</details>
<details><summary>Rehearsal against a real smart-HTTP server that stalls
(git http-backend behind a node proxy; 400-commit, 6.8 MiB upstream;
depth-1 clone first, like the checkout)</summary>
```
old step body, pack stalls after 2,000,000 bytes, step budget 120 s:
exit 124 after 120 s, still shallow (1 commit) — the production signature
new script, same stall, production bound (60 s):
Attempt 1 … Receiving objects: 50% (574/1148)
::warning::git fetch wrote nothing for 60s after 12356 byte(s) of output, so it was killed with its process group (#34561).
Attempt 2 … Receiving objects: 100% (1148/1148), 6.84 MiB | 30.60 MiB/s, done.
exit 0 after 80 s, unshallowed (400 commits), no orphan helper
new script, server never answers the pack request (5 s bound): killed after 0 bytes, attempt 2 green
new script, slow but moving (146 KiB/s, 49 s, 5 s bound): one attempt, never cut
```
</details>
## Tests
`bash scripts/ci/fetch-history.selftest.sh` — a stub `git` plays `fetch`
per attempt and hands everything else (and every healthy fetch) to the
real git against a throwaway file:// upstream: healthy (args, unshallow,
no tags, History line), PR into another branch / into main, full clone
(no `--unshallow`), silent hang then ok, hang after progress then ok
(prints the stalled phase), slow-but-moving (never cut), three fast
failures (red, named), three hangs (red inside three bounds, not at the
wall); every hang checks the stub's child process is gone (the group
kill). The last section pins the five ci.yml call sites and that no
inline loop is left. 46 checks.
<details><summary>Ablations (script mutated on disk, restored
after)</summary>
```
A1 kill the pid, not the group × hang-then-ok / progress-then-hang / hang3 left no child process 3 FAILED
A2 no stall bound (the old loop) × hang-then-ok names the stall · hang3 warns three times · hang3 is bounded 3 FAILED
```
</details>
## Verification
- `node scripts/pm/dispatch-gates.mjs --ran` on f2767e1: 76 derived, 76
run, 0 NOT-MEASURED, every one exit 0. 63 of them ran on c216805, whose
tree differs from f2767e1 only by the ui pin test; the 13 the second
commit added ran on f2767e1.
- f2767e1 updates the two pins in
`ui/scripts/__tests__/select-affected-tests.test.ts` that read the
inline loop (Test UI 1/16 went red on c216805 for exactly that): they
now read the step's env and run line in ci.yml and the fetch spelling in
the script. That file: 71 passed.
- CI runs the rest; its result is read at the final head.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmSYe73LCZ6WxGFvcko
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmSYe73LCZ6WxGFvcko -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f4a2d14 commit 97defd6
6 files changed
Lines changed: 361 additions & 99 deletions
File tree
- .github/workflows
- scripts/ci
- ui/scripts/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
800 | 800 | | |
801 | 801 | | |
802 | 802 | | |
803 | | - | |
804 | | - | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
| 809 | + | |
826 | 810 | | |
827 | 811 | | |
828 | 812 | | |
| |||
1097 | 1081 | | |
1098 | 1082 | | |
1099 | 1083 | | |
1100 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1101 | 1094 | | |
1102 | 1095 | | |
1103 | 1096 | | |
| |||
1116 | 1109 | | |
1117 | 1110 | | |
1118 | 1111 | | |
1119 | | - | |
| 1112 | + | |
| 1113 | + | |
1120 | 1114 | | |
1121 | 1115 | | |
1122 | 1116 | | |
1123 | 1117 | | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
| 1118 | + | |
1141 | 1119 | | |
1142 | 1120 | | |
1143 | 1121 | | |
| |||
3865 | 3843 | | |
3866 | 3844 | | |
3867 | 3845 | | |
3868 | | - | |
3869 | | - | |
| 3846 | + | |
| 3847 | + | |
| 3848 | + | |
3870 | 3849 | | |
3871 | 3850 | | |
3872 | 3851 | | |
| |||
3876 | 3855 | | |
3877 | 3856 | | |
3878 | 3857 | | |
3879 | | - | |
3880 | | - | |
3881 | | - | |
3882 | | - | |
3883 | | - | |
3884 | | - | |
3885 | | - | |
3886 | | - | |
3887 | | - | |
3888 | | - | |
3889 | | - | |
3890 | | - | |
3891 | | - | |
3892 | | - | |
3893 | | - | |
3894 | | - | |
3895 | | - | |
| 3858 | + | |
3896 | 3859 | | |
3897 | 3860 | | |
3898 | 3861 | | |
| |||
4175 | 4138 | | |
4176 | 4139 | | |
4177 | 4140 | | |
4178 | | - | |
4179 | | - | |
4180 | | - | |
4181 | | - | |
4182 | | - | |
4183 | | - | |
4184 | | - | |
4185 | | - | |
4186 | | - | |
4187 | | - | |
4188 | | - | |
4189 | | - | |
4190 | | - | |
4191 | | - | |
4192 | | - | |
4193 | | - | |
4194 | | - | |
| 4141 | + | |
4195 | 4142 | | |
4196 | 4143 | | |
4197 | 4144 | | |
| |||
4364 | 4311 | | |
4365 | 4312 | | |
4366 | 4313 | | |
4367 | | - | |
4368 | | - | |
| 4314 | + | |
| 4315 | + | |
4369 | 4316 | | |
4370 | 4317 | | |
4371 | 4318 | | |
| |||
4374 | 4321 | | |
4375 | 4322 | | |
4376 | 4323 | | |
4377 | | - | |
4378 | | - | |
4379 | | - | |
4380 | | - | |
4381 | | - | |
4382 | | - | |
4383 | | - | |
4384 | | - | |
4385 | | - | |
4386 | | - | |
4387 | | - | |
4388 | | - | |
4389 | | - | |
4390 | | - | |
4391 | | - | |
4392 | | - | |
4393 | | - | |
| 4324 | + | |
4394 | 4325 | | |
4395 | 4326 | | |
4396 | 4327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3331 | 3331 | | |
3332 | 3332 | | |
3333 | 3333 | | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
| 3339 | + | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
| 3343 | + | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
3334 | 3347 | | |
3335 | 3348 | | |
3336 | 3349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
0 commit comments