Skip to content

[PR] test(launcher): cover the #5955 wedged-takeover escalation ladder + win32 ESRCH silence - #5989

Merged
ranxianglei merged 1 commit into
masterfrom
2026-11-09_wedged-takeover-coverage
Nov 9, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-11-09_wedged-takeover-coverage

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Supersedes #5980(其 src 改动已被 2826c51 取代 —— 该 commit 已随 #5972 进 master,见 #5980 讨论)。本分支为 016d933 的 owner-repo 镜像(fork-collab 限制,无法直接从 fork 建 PR),内容与 TOSKA1226:tests-wedged-budget 完全一致。本 PR 只保留其中真正的增量价值:测试覆盖。

内容(commit 016d933,作者 TOSKA1226,基于 2826c51 —— 已在 master)

  • tests/issue5955-wedged-same-lane-takeover.test.ts 18 cases(+61/−2):
    • 升级预算断言(re-tune 友好,不再硬编码旧 750ms 常量):shutdown POST 必须收到 (0, 3000) 内的 timeout —— 即绝不再是 BUSY holder 永远不应答的 3s graceful 默认;整段升级虚拟耗时 ≤ ~6s。未来在此包络内重新调参测试保持绿,回退到 3+5+2s 旧阶梯则红。
    • ESRCH 静默:对已退出 pid 硬杀不再刷 direct SIGKILL … may survive 行;taskkill 自身失败仍照旧上报。
  • src/launcher.ts 仅一个 token:export function hardKillProxyTree —— win32 静默断言直接调用它所需的唯一 seam(该 import 同时保持 unused-exports gate 绿)。

验证(2026-11-09,master 6d750ef + 016d933,本地)

  • 3-way merge 入 master:clean,无冲突
  • node --import tsx --test tests/issue5955-wedged-same-lane-takeover.test.ts → 18/18 pass
  • node --import tsx --test tests/launcher.test.ts → 351 pass / 1 skip / 0 fail
  • tsc --noEmit clean;check-unused-exports clean(8 waived);check-test-import-graph ok

合并备注:016d933a 的 author 已是 TOSKA1226,merge commit 会原样保留署名;若 squash,请保留一行 Co-authored-by: TOSKA1226 <toska1226@users.noreply.github.com>(TOSKA1226 在 #5980 的署名请求)。

The field-tuned timings in 2826c51 shipped without tests: the escalation
budget (1s POST + 2s post-shutdown wait + 1s SIGTERM drain + 2s post-kill
wait + 2s settle) and the win32 ESRCH silence are unguarded, so the next
re-tune can silently bring back a ~12s stall or emit a false "listener may
survive the cleanup" alarm on every takeover.

tests/issue5955-wedged-same-lane-takeover.test.ts (18 cases):
- candidate matrix: same lane + canonical port + BUSY + fingerprint
  mismatch is the ONLY cell that may be taken over
- ledger boundaries: window, min observations, 300s stale gap, persistence
  across client restarts, fresh window after pid reuse (birth stamp key)
- escalation order shutdown -> SIGTERM -> hard kill, and the short BUSY
  budget instead of the 3s graceful default (staging bounded to ~6s)
- kill failure falls through to the normal spawn ladder, entry kept
- port:0 lazy sticky-lane resolution; graceful path never signals/kills
- negatives: healthy older/newer/same-build BUSY holders, user zone,
  foreign lane, other port and explicit attach targets are left alone
- win32: a pid already reaped by taskkill stays silent, real failures
  still surface (#4125 vs #5955 field noise)

Exports hardKillProxyTree so the win32 silence assertion can call it.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-09_wedged-takeover-coverage (016d933)

Latest build — install this exact version

npm install -g billion-context@0.0.8715-pr.5989.6818e1e

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

Recent builds (commit → version)

commit version build
016d933 billion-context@0.0.8715-pr.5989.6818e1e build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei merged commit 48f9e69 into master Nov 9, 2026
73 of 120 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1107-master.48f9e69 (rolling master tag).

npm install -g billion-context@0.0.1107-master.48f9e69  # 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 Nov 9, 2026
…in LIVE_FILES

#5989 landed the suite without registering it; its spawnSync import trips
the SPAWN_RE gate (#1248) so every PR head rebased past that merge fails
all 11 test shards at pretest self-check before running any test.
Concurrency-reviewed per #1248: fully mocked children + fake clock, the only
real spawn is one bare node child for a dead pid — no ports, no zone band.
ranxianglei pushed a commit to Louie0806/billion-context that referenced this pull request Nov 9, 2026
ranxianglei pushed a commit that referenced this pull request Nov 9, 2026
…n LIVE_FILES

Converged master-red fix (sentinel ci-fixes lane): #5989 merged the
spawning suite without registering it, so the #1248 SPAWN_RE tripwire
kills all 11 core-matrix test shards before any test runs on every PR
head. Hunk is byte-identical to open PR #5990 (which carries the same
registration plus a test-tolerance change to master).
ranxianglei pushed a commit to glfruit/billion-context that referenced this pull request Nov 9, 2026
…master red)

Inherited failure, not caused by this PR's diff: ranxianglei#5989 (016d933, merged as
48f9e69) landed tests/issue5955-wedged-same-lane-takeover.test.ts without
registering it in scripts/live-files.mjs, so the SPAWN_RE tripwire
(scripts/run-ci-tests.mjs, ranxianglei#1248) aborts every test shard on any PR head at
pretest, before a single test runs. Confirmed against the failing job logs of
this PR's run 42551827921 (all 11+ shards, one error line each).

Per the few-line CI-fix discipline this lands as its own labeled commit here.
The hunk is byte-identical to in-flight PR ranxianglei#5990 (same append-only zone), so
it dedupes cleanly on the next rebase once ranxianglei#5990 merges into master.

Local verification: replicated the tripwire scan on this head -> 62 live
files, zero unregistered spawning suites.
ranxianglei pushed a commit to El1mir/billion-context that referenced this pull request Nov 9, 2026
…cumented one-observation loss

Byte-identical mirror of in-flight PR ranxianglei#5990, inlined onto this PR branch per
ranxianglei#4599 coordination for the inherited red: master commit 48f9e69 (ranxianglei#5989)
added tests/issue5955-wedged-same-lane-takeover.test.ts without registering
it in scripts/live-files.mjs, so the SPAWN_RE tripwire (ranxianglei#1248) in
scripts/run-ci-tests.mjs killed all 11 test shards at pretest before any
test ran. The second hunk tolerates the wedged-ledger's documented
worst-case one-observation read-modify-write loss instead of turning an
fs-timing hiccup into a CI flake. When ranxianglei#5990 merges to master these hunks
dedup cleanly (byte-identical changes merge without conflict).

Verified locally: tripwire scan clean (1147 test files / 62 live entries,
zero unregistered spawning files); issue5955 suite 18/18 pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants