Repository navigation
Commit 357fb1e
fix(ci): bound every git transfer by its byte rate so a stalled checkout or history fetch retries instead of running to its timeout (#35032)
Fixes #34994
Clause-②: no
Metadata-protocol: none
Tier: S. `.github/workflows/**` is a governed surface, and
`check-governed-merges --pr 35032` reads this diff as Tier S by content
(the workflows split, ruling record 6722205630, letter C; no Tier H
trigger). Governed: `.github/workflows/ci.yml`,
`.github/workflows/lint.yml`. Landing: L1-a, then the seat's PASS
contract review on the head, then the owning seat's area queues it
(claim amendment on #34994).
## 维护者速读
- **改了什么**:合并队列里 `Checkout repository` / `Fetch this commit's history`
卡死、跑满 14–25 分钟超时、把 PR 踢出队列的问题,这个 PR 就是修它的。做法是在 ci.yml 和 lint.yml 加一个工作流级
`env:`(`GIT_HTTP_LOW_SPEED_LIMIT=1000`、`GIT_HTTP_LOW_SPEED_TIME=120`):git
的一次传输如果连续 120 秒低于 1000 字节/秒,curl 就主动中止,actions/checkout 自带的重试(3 次)和
fetch-history.sh 的重试(3 次)随即接手。fetch-history.sh 还会实时打印每个阶段;lint-eslint 这条
lane 不读历史,改为浅检出。
- **为什么改**:过去 48 小时里,合并队列和 main 上有 29 个作业卡死在这两步,PR 运行上另有 19
个,全部是服务器一直没开始发包。#34561 的静默看门狗没触发,因为卡住期间服务器还在不断输出 `remote: Counting
objects` 进度,日志一直在长。最近 24 小时,失败的合并队列运行里有 18/65 死在这里。
- **风险与回滚**:风险低。阈值离健康值很远:健康传输是每秒 MiB 级,服务器开始发包前最慢只等约 15
秒,慢但还在动的传输不会被切断;步骤超时和作业墙钟一个没改。回滚就是 revert 这一个 PR。
- **先看**:① `.github/workflows/ci.yml` 顶部的 `env:` 块及其注释;②
`scripts/ci/fetch-history.sh` 的头注释和 `current_phase`/实时阶段打印;③
`.github/workflows/lint.yml` 中 `lint-eslint` 去掉 `fetch-depth: 0` 的那一处。
- **两分钟验证**:本地跑 `bash scripts/ci/fetch-history.selftest.sh`,最后一行应是
`fetch-history self-test: all checks passed`;本 PR 自己的 CI 里,每个 checkout
都已带着这个限速运行。
- **需要你做的**:无需审批。这是 Tier S 受管 PR,由 L1 与席位合同审查通过后由座位入队。合入后如果停顿仍然出现,再按下方的
GitHub Support 工单方案处理。
## What changes
- **`.github/workflows/ci.yml` and `.github/workflows/lint.yml`: a
workflow-level `env:`** with `GIT_HTTP_LOW_SPEED_LIMIT: '1000'` and
`GIT_HTTP_LOW_SPEED_TIME: '120'`, plus a short reasoning comment.
- git applies these to every curl handle, so every git HTTP request in
every job of both files is covered: actions/checkout,
`fetch-history.sh`, `select-shard-packages`' deepen, and spec's one-tag
fetch.
- A request that moves under 1000 B/s for 120 s exits 128 (`curl 28
Operation too slow`). The retry around it then runs:
- actions/checkout v7's `fetch()` is wrapped in `retryHelper.execute` (3
attempts, 10–20 s apart), and its git inherits `process.env`;
- `fetch-history.sh` makes 3 attempts.
- **`scripts/ci/fetch-history.sh`:**
- exports the same two defaults only when they are unset, so a
workflow's values win and a local run is bounded too;
- prints `fetch-history: +Ns PHASE` each time a new phase starts,
reading only complete lines, so a step that still hits its wall names
where it stood;
- prints the bound once per run;
- corrects the #34561 header reading: a hung fetch can keep printing
server sideband progress;
- keeps the 60 s silence watchdog as the backstop for a request that
sends nothing.
- **`lint.yml` `lint-eslint`:** checks out at depth 1. Its three steps
(`pnpm lint`, `check:engine-double-contract`, lane verdict) read no
history. The note that justified `fetch-depth: 0` named the slot-lookup
ratchet, which runs in `lint-scoped-slot-corpus` since the lane split.
That reason now stands on `lint-repo-tooling`'s checkout; the six "same
reason as" pointers, the `lint` job's lane note and
`typecheck-source-gates`' CHECKOUT BUDGET note follow it.
- **Not changed:** every step budget and job wall,
`governed-surface-guard.yml` (0 stalls measured on it), and the other 11
lint lanes' `fetch-depth: 0`.
- **No changeset:** `.github/**` and `scripts/ci/**` ship in no package
(the root package is private). This PR is labelled `skip-changeset`.
## Measurement (Actions API, 2026-11-15T22:00Z → 2026-11-17T22:26Z)
**Wall hits (merge_group and main push): 29 jobs.**
- `fetch-history.sh`, 18:
- 852–853 s at the 14-min budget;
- 1213 s at 20 min;
- 493 s at 8 min.
- lint.yml full-ref checkout, 10: 1500 s at 25 min, or 1200 s at 20 min.
- ci.yml depth-1 checkout, 1: cancelled at its 20-min job wall.
**PR-event runs since 2026-11-16T22:00Z: 19 more**, including PR
#34992's `Lint · scoped · query-options erasure` job 134411985185.
**Queue impact:** in the 24 h to 22:26Z, 18 of 65 failed or cancelled
merge_group runs failed in these steps.
| step | n | p50 | p95 | p99 | over 150 s, succeeded | wall hits |
|:--|--:|--:|--:|--:|--:|--:|
| ci.yml `fetch-history.sh` | 12,368 | 57 s | 72 s | 88 s | 5 | 18 |
| lint.yml full-ref checkout | 10,296 | 65 s | 85 s | 120 s | 31 | 10 |
| ci.yml depth-1 checkout | 21,518 | 27 s | 34 s | 39 s | 34 (13 at
15–22 min) | 1 |
**The tail is bimodal**, not #29980's flat hazard:
- Same-run siblings of a hung fetch take 51–65 s (run 44173519141: 12
Test UI shards at 51–65 s, shard 6 at 852 s).
- P(wall | over 150 s) = 18/23 for the fetch, so a retry at about 2 min
draws again from a distribution where P(over 150 s) is about 0.2%.
- Wall hits by day: 11-12: 4; 11-13 to 11-15: 0; 11-16: 9; 11-17: 20.
All fell on weekdays between 16:00Z and 00:05Z.
**Healthy pre-pack wait, measured locally** (this fetch shape, git
2.43):
| fetch | pack starts at | total | size |
|:--|--:|--:|--:|
| depth-1 | 13.5 s | 25 s | 153 MiB |
| `--unshallow` | 14.7 s | 77 s | 660 MiB (`pack-reused 0`) |
| full-ref | 4.0 s | 82 s | 1.30 GiB (pack reuse) |
`GIT_HTTP_LOW_SPEED_TIME=120` is 8x the slowest of these, and it still
holds a 6.5x slowdown like 2026-11-03's.
<details><summary>Measured job ids</summary>
merge_group / main: 133435052239 133462684295 133470361132 133557664420
133577089390 133628404121 133637316745 133640228994 133645669009
133708987651 134190769187 134248343224 134250079846 134252806729
134257792648 134263160306 134282169394 134300103634 134314160613
134316771638 134330131026 134330172643 134348709261 134348509034
134348594081 134348634118 134358477635 134360293444 134393319006
pull_request: 133644413587 133664673312 133694024292 133695937589
133699212754 133700332558 134179666962 134211418703 134221147317
134234042188 134242570257 134245502895 134337923899 134359661557
134377275418 134377467166 134398650398 134404354815 134411985185
Queries: `GET
/repos/objectstack-ai/objectstack/actions/workflows/{ci,lint,governed-surface-guard}.yml/runs`
by event in 6 h windows, then `GET /actions/runs/RUN_ID/jobs?filter=all`
for 1,937 runs and 329 PR runs, and `GET /actions/jobs/JOB_ID/logs` for
every wall hit read. The full report is on the card.
</details>
## Diagnosis: why #34561's stall bound did not fire
1. **The attempts hang before the pack.** Every wall hit's orphan list
(the runner's `Terminate orphan process` lines) is `git`, `git` (the
remote-https wrapper) and `git-remote-https`, plus the script's `bash`
and `sleep` for fetch-history. It is never `index-pack`, and fetch-pack
starts `index-pack` only once it reads the pack header. This holds for
fetch-history, full-ref and depth-1 checkouts alike, so neither size nor
depth is the cause.
2. **The watchdog ran and never fired.** Its `sleep` is among the
orphans, and its PID climbs about 3/s across the whole budget (2234 →
4969 over 852 s). All 13 post-#34582 wall hits show `Attempt 1 of 3`, no
`::warning::` and no attempt 2.
3. **The log grew because the server kept talking.** While the server
enumerates, counts and compresses, the sideband demux prints `remote:
... objects: N%` lines, and no pack bytes arrive. Reproduced locally:
`GIT_HTTP_LOW_SPEED_LIMIT=100000000 GIT_HTTP_LOW_SPEED_TIME=5` aborted a
v2 fetch while `remote: Compressing objects: 36%..38%` was still
streaming (rc 128, `error: RPC failed; curl 28 Operation too slow`). So
curl's byte-rate bound fires exactly where the silence bound cannot.
4. **The phase was never printed.** The attempt's log printed only when
the attempt ended, and the step timeout kills the script first. The live
phase lines fill that gap.
5. **The same stall ends by itself after 17–22 min.** 13 depth-1
checkouts in jobs with no step timeout finished in one attempt after
1000–1351 s (for example 134182008086). That is why the budgets read as
timeouts rather than errors.
## Tests
- **`bash scripts/ci/fetch-history.selftest.sh`** (= `pnpm
check:fetch-history`) at b4162ea: `fetch-history self-test: all
checks passed`, 65 PASS. New cases:
- the healthy run hands git `1000 120`, and a preset `5 7` is kept;
- `talk-then-curl28,ok`: a stub prints `remote: Counting objects` every
second for 5 s, longer than the 2 s stall bound, then exits 128 with
`curl 28`. The script retries it, and attempt 2 succeeds, ends
unshallowed and shows no stall warning. Both attempts ran under the
bound, and the live line `fetch-history: +Ns remote: Counting objects`
prints;
- the slow case prints its phase live, once;
- both workflows' single `env:` block carries the script's defaults;
- `lint-eslint` sets no `fetch-depth`.
- **Ablation, one-shot, via `scripts/ablation-replace.mjs`** (the
mutation landed per its blob/anchor proof; restored with `git checkout
HEAD --`, blobs equal to HEAD):
- the two `export` lines made plain assignments: 7 FAIL (healthy env,
talk-then-ok env, script defaults, the four workflow env pins);
- lint.yml `GIT_HTTP_LOW_SPEED_TIME: '120'` → `'60'`: exactly 1 FAIL
(`lint.yml's env: sets GIT_HTTP_LOW_SPEED_TIME to the script's
default`).
## Acceptance notes
- **If stalls persist after this lands (maintainer's option):** open a
GitHub Support ticket citing the job ids above. The ticket would say:
- smart-HTTP fetches against github.com stall before the pack header for
14–22 min, depth-1 single-sha fetches included;
- weekdays, 16:00–00:05Z, since 2026-11-12;
- same-run siblings take 51–65 s.
Larger runners are not expected to help, because the runner sits idle
while the server stalls.
- **Post-landing plan:** re-measure 24 h of merge_group runs after the
merge and post the wall-hit count for `Checkout repository` and `Fetch
this commit's history and the base branch` on #34994. Expected: 0 wall
hits, and `curl 28` followed by `Waiting N seconds before trying again`
(checkout) or `Attempt 2 of 3` (fetch-history) where a stall was caught.
- `scripts/check-published-files.mjs`'s refusal text still truthfully
cites lint.yml's `fetch-depth: 0`. The lane that runs it keeps depth 0.
- Out of scope, noted only: the other 11 lint lanes could move to a
depth-1 checkout plus `fetch-history.sh`. Measured, it is about 20 s
slower per lane at p50 and adds no stall coverage, so it stays with
#22034.
## Verification
Local runs at b4162ea. `dispatch-gates --commands` derived 64
commands, and `--ran` reconciles 64 derived, 64 run, 0 unrun.
<details><summary>Local gate results (exit code captured before any
pipe)</summary>
- **60 exited 0**, among them:
- `check:fetch-history`, `check:ci-filter-parity`,
`check:required-contexts` and `check:stall-guard-budget`;
- `check:stall-guard-headroom`, `check:workflow-status-functions`,
`check:workflow-step-name-quoting` and
`check:self-test-workflow-commands`;
- `check:pm-dispatch-gates` (364 s), `check:pm-governed-merges`,
`check:nul-bytes`, `check:bash32-floor` and
`check:select-gate-families`;
- `check:type-check-coverage` and `check:type-check-debt`.
- **4 NOT MEASURED** (exit 3, prerequisite: built `dist/`):
`check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content`. These
whole-tree families read build output, and this diff touches no package;
CI builds and runs them.
- Not run locally, CI-owned: the repo-wide `pnpm lint`, `test:repo`, the
type-check lanes and the path-scheduled jobs. This PR's own CI runs
every checkout and fetch with the new env, which is the live positive
control.
- `overlap-check` on b4162ea: `VERDICT clean exit 0` (origin/main
merges cleanly, 0 open PR heads share a file).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgwLiKcfujYUug7sPs -->
Co-authored-by: Claude <noreply@anthropic.com>1 parent d4b2a75 commit 357fb1e
4 files changed
Lines changed: 184 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
188 | 204 | | |
189 | 205 | | |
190 | 206 | | |
| |||
1105 | 1121 | | |
1106 | 1122 | | |
1107 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1108 | 1129 | | |
1109 | 1130 | | |
1110 | 1131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
217 | 231 | | |
218 | 232 | | |
219 | 233 | | |
| |||
311 | 325 | | |
312 | 326 | | |
313 | 327 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
318 | 333 | | |
319 | 334 | | |
320 | 335 | | |
| |||
525 | 540 | | |
526 | 541 | | |
527 | 542 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
534 | 548 | | |
535 | 549 | | |
536 | 550 | | |
| |||
610 | 624 | | |
611 | 625 | | |
612 | 626 | | |
613 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
614 | 633 | | |
615 | 634 | | |
616 | 635 | | |
| |||
1956 | 1975 | | |
1957 | 1976 | | |
1958 | 1977 | | |
1959 | | - | |
| 1978 | + | |
1960 | 1979 | | |
1961 | 1980 | | |
1962 | 1981 | | |
| |||
3008 | 3027 | | |
3009 | 3028 | | |
3010 | 3029 | | |
3011 | | - | |
| 3030 | + | |
3012 | 3031 | | |
3013 | 3032 | | |
3014 | 3033 | | |
| |||
4158 | 4177 | | |
4159 | 4178 | | |
4160 | 4179 | | |
4161 | | - | |
| 4180 | + | |
4162 | 4181 | | |
4163 | 4182 | | |
4164 | 4183 | | |
| |||
4318 | 4337 | | |
4319 | 4338 | | |
4320 | 4339 | | |
4321 | | - | |
| 4340 | + | |
4322 | 4341 | | |
4323 | 4342 | | |
4324 | 4343 | | |
| |||
4464 | 4483 | | |
4465 | 4484 | | |
4466 | 4485 | | |
4467 | | - | |
| 4486 | + | |
4468 | 4487 | | |
4469 | 4488 | | |
4470 | 4489 | | |
| |||
4654 | 4673 | | |
4655 | 4674 | | |
4656 | 4675 | | |
4657 | | - | |
| 4676 | + | |
4658 | 4677 | | |
4659 | 4678 | | |
4660 | 4679 | | |
| |||
4816 | 4835 | | |
4817 | 4836 | | |
4818 | 4837 | | |
| 4838 | + | |
| 4839 | + | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
4819 | 4843 | | |
4820 | 4844 | | |
4821 | 4845 | | |
| |||
4855 | 4879 | | |
4856 | 4880 | | |
4857 | 4881 | | |
4858 | | - | |
4859 | | - | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + | |
4860 | 4885 | | |
4861 | 4886 | | |
4862 | 4887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | | - | |
21 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
72 | 87 | | |
73 | 88 | | |
74 | 89 | | |
| |||
90 | 105 | | |
91 | 106 | | |
92 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
93 | 112 | | |
94 | 113 | | |
| 114 | + | |
95 | 115 | | |
96 | 116 | | |
97 | 117 | | |
| |||
102 | 122 | | |
103 | 123 | | |
104 | 124 | | |
| 125 | + | |
105 | 126 | | |
106 | 127 | | |
107 | 128 | | |
| |||
124 | 145 | | |
125 | 146 | | |
126 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
127 | 155 | | |
128 | 156 | | |
129 | 157 | | |
| |||
160 | 188 | | |
161 | 189 | | |
162 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
163 | 202 | | |
164 | 203 | | |
165 | 204 | | |
| |||
188 | 227 | | |
189 | 228 | | |
190 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
191 | 248 | | |
192 | 249 | | |
193 | 250 | | |
| |||
0 commit comments