Skip to content

修 flaky 测试:vscode 取消用例改为真实的『读着读着中断』形状 - #3430

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-16_vscode-cancel-flake
Oct 16, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-16_vscode-cancel-flake

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

现象

定时全量 run 38896091237(head 83197e9,windows-24 shard 1)唯一红腿:vscode-copilot #177 (2): client cancel aborts upstream and frees the session lock,断言 `upstream fetch was not aborted after client cancel`。

定性:flaky,不是回归

  • 同一 commit 同一腿 重跑绿(见上 run 的 rerun)
  • 06:11 定时全量(745be9f)windows-24 三腿全绿;745be9ff→83197e91 的 src 改动(agent 文件 / v1internal / acp-cache-diff / guard 触发条件)没有一个在这条 OpenAI 转发路径上
  • Linux 本地 origin/master 与 83197e9 精确 checkout 各跑多轮全绿

根因(测试自身的竞态形状)

旧写法 `for await ... break` 先触发迭代器 return()(= 取消 body),之后才 `abort()` —— 此时 signal 上没有任何 pending 操作,undici 在 Windows runner 上可以不销毁客户端 socket,代理侧 `res 'close'` 等 5 秒等不到,上游 socket 一直被按住 → 断言超时。真实的 vscode 取消从来不是这个形状:用户取消时 abort 直接打在正在读的流上。

修法

读到一个非空 chunk 后,body 仍活跃时直接 `abort()`(真实客户端形状),再 cancel reader。本地 8/8 绿,tsc 干净。

…lient shape)

Scheduled full run 38896091237 (83197e9, windows-24 shard 1) went red on
'upstream fetch was not aborted after client cancel'; the same commit
reran green on the same leg — flake, not a regression. The racy shape was
the test's own: for-await break first (iterator return() cancels the
body), abort() after — at that point nothing is pending on the signal and
undici can leave the client socket up instead of destroying it; the proxy
then never sees res 'close' within the 5s poll window.

Read exactly one chunk, then abort while the body is still active (what a
real vscode cancel does), then cancel the reader. 8/8 green locally,
tsc clean.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-16_vscode-cancel-flake (f018fd2)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4035-pr.3430.054d7f3

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3430.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit ce9bc90 into master Oct 16, 2026
37 of 38 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.497-master.ce9bc90 (rolling master tag).

npm install -g billion-context@0.0.497-master.ce9bc90  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Oct 16, 2026
…nt refs at #2960⑥

Review fix-up for the config-epoch guard: the staleEffectiveStamp docstring claimed
the epoch hashes the resolved path (cross-instance stamps never validate), which
contradicts the implementation (sha256 of file CONTENT — byte-identical files do
validate, tests/config-epoch.test.ts case 4) and the configFileEpoch docstring.
Also re-point the '#3430' references: that number is the unrelated vscode
cancel-flake PR; the incident class is tracked as ⑥ on #2960.
LoveDoLove pushed a commit to LoveDoLove-Forked-Projects/billion-context that referenced this pull request Oct 17, 2026
…ch (ranxianglei#3430)

Every wire request stamps metadata.effectiveConfig, but the stamp only
refreshed on the NEXT wire request — tool-path readers (plugin tool API,
status panels, nudge re-anchor) kept executing settings the user had
already deleted from the config file, and a session on a multi-instance
machine could carry a foreign instance's stamp for days (the October
externalSummary incident: a user-disabled summary chain kept running).

- configFileEpoch() (src/config.ts): sha256 of the live config file
  content — content-keyed so byte-identical files validate cross-instance
  while any edit diverges; cost mirrors loadConfigFile()'s per-call read.
- storeEffectiveConfig stamps metadata.effectiveConfigEpoch next to the
  snapshot; forks inherit the key (plugin.ts copy list).
- effectiveConfig refuses the snapshot when the epoch no longer matches
  and re-resolves the live file tier (global compress.*, including
  externalSummary) onto the fallback; provider/model cascade levels are
  deliberately re-stamped by the next wire request (they need the
  request URL). The nudge growth-margin reader takes the same guard.
- Legacy snapshots without an epoch keep the old merge semantics.
- Goldens re-pinned: metadata digest gains the epoch key only.
@github-actions github-actions Bot mentioned this pull request Oct 17, 2026
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.

1 participant