Skip to content

[PR] fix: rank the node runtime's Low integrity label first in win32 EPERM hints; add non-blocking startup self-check (#5155) - #5160

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-29_integrity-label-hints-selfcheck
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-29_integrity-label-hints-selfcheck

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What / why

#5155 supplies reproducible A/B evidence (4/4) for the whole win32 EPERM-on-own-data family (#5096 crash loop, #4614 READONLY degrade, #5103 power-loss report): the real switch is not Defender/ACL/read-only-dir but the NTFS mandatory integrity label on the node executable itself — a Low-labeled node.exe cannot write Medium-labeled files even with correct ACLs (MIC no-write-up → EPERM -4048 on every write), and relabeling Low→Medium fixed everything with zero AV/ACL change. This PR implements #5155's suggestions 2/3/4. Suggestion 1 (CA-bundle write degradation) is already implemented on the #5103 thread's branch 2026-10-29_issue5103-startup-recovery-visibility and is deliberately NOT duplicated here.

Changes

  1. Hint order flipped on all three EPERM surfaces — "check the node runtime's integrity label" is now the FIRST suggestion for OS-level write refusals on win32, with copy-pasteable commands embedding the REAL runtime path (icacls "<process.execPath>" + /setintegritylevel Medium); AV exclusion drops to second. The canonical diagnosis text lives in ONE place (src/integrity-label.ts) so the surfaces cannot drift:
  2. Startup self-check (suggestion 3): new src/integrity-selfcheck.ts, fired from cli.ts at bili start. Non-blocking spawn of icacls <realpath(process.execPath)> (win32 only, 3s timeout, 8KB cap); parses the mandatory ACE; Low/Very Low → one prominent [integrity] … warn naming the cause and the exact fix commands (incl. the non-recursive parent-dir convergence for inherited labels). Fail-open by construction: missing icacls / timeout / unparseable output = silent. Node has no built-in LABEL_SECURITY_INFORMATION API, so the probe reads the same security database via icacls output.
  3. Docs (suggestion 4): CONFIGURATION.md gains "Windows: node runtime demoted to low integrity (The incremental lane re-renders the entire conversation history and synchronously flushes it to disk each turn; large co | 增量车道每轮把整段会话历史重新渲染并同步落盘,大对话每轮多花约100毫秒 #5155)" — symptom, check, fix (incl. why one NON-recursive relabel of the parent dir converges the tree), the new self-check warn line, and an explicit note that recursively lowering the data dirs to Low (the SQLite unified storage degraded to legacy-only (bili v0.1.205, node v24.22.1, win32-x64) #4614 interim advice) is superseded as the recommended direction. The [bug] 0.1.63 起 Windows persist EPERM 风暴:会话持久化静默丢数据(4.9k 次/117 会话)+ compress no-valid-ranges 拒绝 #362 section's sentence claiming the AV exclusion was "the first suspect" is corrected to match.

Behavior changes (old → new)

Log/hint wording only, plus one new conditional warn line:

Coordination (hot-file overlap)

Verification

Targeted local runs green: 67/67 across tests/integrity-selfcheck.test.ts (new: all five levels parse, fail-open negatives, warn positive/negative gate per #3617), tests/storage-cantopen-hint.test.ts (ordering pinned both directions, READONLY shape fires, non-matching errors stay silent, platform gate both directions), tests/persist-eperm.test.ts (ordering pinned) plus all logger suites and proxy-persist (unchanged pins still hold). typecheck clean; full build green. Full regression = CI on this head.

Closes #5155

@ranxianglei ranxianglei changed the title fix: rank the node runtime's Low integrity label first in win32 EPERM hints; add non-blocking startup self-check (#5155) [PR] fix: rank the node runtime's Low integrity label first in win32 EPERM hints; add non-blocking startup self-check (#5155) Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-29_integrity-label-hints-selfcheck (0a0be94)

Latest build — install this exact version

npm install -g billion-context@0.0.9139-pr.5160.aa17c0a

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
0a0be94 billion-context@0.0.9139-pr.5160.aa17c0a build
619ed00 billion-context@0.0.7467-pr.5160.ac6c135 build
d04ebe7 billion-context@0.0.7409-pr.5160.d5d260d build
c6532f1 billion-context@0.0.7300-pr.5160.9f1a9a6 build
cb22754 billion-context@0.0.7069-pr.5160.37ec9f1 build
d07517f billion-context@0.0.6831-pr.5160.d16cf98 build

Download artifact

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

Install instructions are refreshed on each push.

ranxianglei pushed a commit that referenced this pull request Oct 30, 2026
Review polish for #5160: the new src/integrity-label module was imported as
"./integrity-label.ts" / "../integrity-label.ts" in persist-eperm.ts and
storage/shadow.ts while cli.ts, logger.ts and integrity-selfcheck.ts already
use the ".js" specifier. Normalize to ".js" so the module's import specifier
is uniform across its four call sites and matches the repo's dominant ESM
convention. Non-semantic: tsconfig allowImportingTsExtensions makes both
resolve identically (NodeNext maps .js -> the .ts source). typecheck clean,
integrity/persist/storage-cantopen/logger suites green (30/30).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷
(ai: vllm-qwen/qwen3.8-27b)

Synced: master was moving fast during this window (two merge cycles needed — #5294/#5292/#5253 batch, then #5163, then #5236 message-timestamps + kernel 0.0.173). Both merges were clean with zero conflicts; this PR's diff stays small and touches no files those merges rewrote semantically. Verified on the new head d04ebe7: typecheck clean + 32/32 targeted tests green (storage-cantopen-hint / persist-eperm / issue5154-selfcheck). State after push: mergeable: true, compare vs master = ahead_by 8 / behind_by 0, mergeable_state: blocked = checks running only. Fully caught up now.

@ranxianglei
ranxianglei force-pushed the 2026-10-29_integrity-label-hints-selfcheck branch from d04ebe7 to 619ed00 Compare October 31, 2026 08:37
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

rebase 完成(簇攻坚 #5302 攻击序第 3 项):分支已重建为当前 master 顶上的单个线性提交 619ed00(force-with-lease 更新 PR 头)。

… hints; single linear commit on current master (#5155)

Rebuilt from the original branch content (identical diff) onto current master:
the old head had accumulated repeated merge-guard 'merge master' commits.
The startup self-check half (#5154 warnIfLowIntegrityRuntime) already landed
on master separately — this commit carries the remaining delta only: the
shared integrityLabelDiagnosis helper wired into the log-reopen warn and the
persist-EPERM alert, CONFIGURATION.md evidence-order text, and the two
ordering gate tests.
@ranxianglei
ranxianglei force-pushed the 2026-10-29_integrity-label-hints-selfcheck branch from 619ed00 to 0a0be94 Compare November 11, 2026 12:22
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — this run is the CI conflict-fix lane for PR #5160 itself; no new issue/PR opened.

Conflict resolution complete. The branch was ~1572 commits behind master (f6e69aee base from Oct 31 vs current dc041dd1ab), which made it unmergeable (state: dirty). I rebased the single-commit branch onto current master and force-pushed: 619ed003 → 0a0be94af9 (verified via live GET after push: mergeable: true, state blocked = CI re-running; remote head checked before push — no concurrent pushes, so the force-push was the sanctioned conflict-rebase case only).

Two real conflicts, both resolved as a union of intent:

  1. src/logger.ts import block — master's log-retention rework inserted a big import block exactly where the PR adds its integrity-label.js import. Kept both (PR import placed above the retention block). The warnReopenFailed hunk auto-merged; verified master's stderrMuted-before-guard restructure is preserved alongside the PR's win32 EPERM remedy append.
  2. CONFIGURATION.md — master turned this file into a one-line redirect stub after the docs move ([PR] docs: batch-migrate 14 root-level documents into docs/ (consolidation + master index + redirect placeholders) | docs: 14 个根级文档一次性迁入 docs/(集中 + 总目录 + 重定向占位) #5920). Kept master's stub and relocated the PR's single-sentence evidence-order rewording to docs/configuration.md (the Windows AV-exclusions section); its anchor link points at the #5154 heading, which exists there unchanged.

Everything else (src/integrity-label.ts, src/persist-eperm.ts, both test files) auto-merged clean. Final diff is structurally identical to the original PR: 6 files, +58/−6 (only CONFIGURATION.md swapped for docs/configuration.md). No code semantics touched — pure conflict resolution.

Targeted verification (local): npm run typecheck clean; tests/persist-eperm.test.ts + tests/storage-cantopen-hint.test.ts 22/22 pass (incl. the two new #5155 ordering gates); logger suites (rotate/rotation/stderr-mute/silent-loss) + issue5154-low-integrity-selfcheck 26/26 pass. Full-suite verdict belongs to remote CI on the pushed head.


七问(中文结论)

  1. 是什么问题:PR [PR] fix: rank the node runtime's Low integrity label first in win32 EPERM hints; add non-blocking startup self-check (#5155) #5160(win32 EPERM 提示把 node runtime 的 Low integrity label 排到第一位,附可复制的 icacls 修复命令)分支停在 10 月 31 日的 master 上,与已前进约 1572 个提交的 master 冲突,处于 dirty 状态无法合并。
  2. 什么原因导致的:PR 创建后未跟进 master;期间 master 发生两件事与该 PR 的改动文本重叠——文档迁移([PR] docs: batch-migrate 14 root-level documents into docs/ (consolidation + master index + redirect placeholders) | docs: 14 个根级文档一次性迁入 docs/(集中 + 总目录 + 重定向占位) #5920:CONFIGURATION.md 整体移入 docs/configuration.md,原路径只剩重定向 stub)和 logger 日志保留机制重构(log-retention:import 区重写、warnReopenFailed 内部结构调整)。
  3. 影响范围与严重程度:仅该 PR 自身被阻塞(不能合并);不影响任何已发布版本、运行时行为或终端用户。
  4. 怎么修复的:单提交分支 rebase 到当前 master(dc041dd1ab)。冲突按双方意图并集解决:import 区两路 import 全保留;文档句子改写跟随迁移落到 docs/configuration.md 对应段落(锚点指向该文件中仍存在的 [Bug][dsh] EPERM on startup data writes: the real switch is the node runtime's NTFS mandatory integrity label (Low IL), not Defender/ACL — reproducible A/B, and it explains the #5096 crash loop #5154 小节,链接有效)。push 前 fetch 确认远端 head 仍是旧提交、无并行推送,force-push 仅限本任务明确授权的冲突 rebase。
  5. 是否有回归风险:无——rebase 不改任何代码语义,最终 diff 与原 PR 同构(6 文件 +58/−6)。定向验证:typecheck 干净;persist-eperm + storage-cantopen-hint 22/22 过(含 The incremental lane re-renders the entire conversation history and synchronously flushes it to disk each turn; large co | 增量车道每轮把整段会话历史重新渲染并同步落盘,大对话每轮多花约100毫秒 #5155 两条顺序门测试);logger 四套件 + issue5154 自检 26/26 过。高危模式逐项过:无语义漂移、无阈值/时序变化、无输出格式变化(除本 PR 本就计划的提示文案排序)、fail-fast 行为未动。全量以远程 CI 为准。
  6. 是否破坏缓存:不涉及(无缓存/重试/增量游标/去重键相关改动)。
  7. 是否改了设计方向或引入新配置:均不涉及(无架构/边界/数据流转向;无新 env/config/默认值)。

判定:冲突已解除(live 查证 mergeable=true),等 CI 跑完即可进入人工合并;若 CI 出现红项,由本车道的后续触发继续处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Status report after process restart — work from the previous run is complete and verified live in this run. Nothing regressed while the session was down.

Previous run (before the restart): rebased the single-commit branch onto master dc041dd1ab, resolved both conflicts (src/logger.ts import union; doc sentence relocated CONFIGURATION.md → docs/configuration.md per the #5920 docs move), force-pushed 619ed003 → 0a0be94af9, ran targeted verification (typecheck clean; 48/48 targeted tests pass), and posted the full 七问 summary. That reply is the one above this message.

Re-verified against live sources in THIS run (fresh fetch + single PR GET + mirror check cache):

  • Remote branch head: 0a0be94af9 — exactly my rebased commit, no concurrent pushes, no lost work.
  • origin/master: still dc041dd1ab — identical to my rebase base, so no fresh conflict can have appeared.
  • Live PR state: mergeable: true, state blocked (the dirty/conflict blocker is gone; blocked = waiting on the remaining CI runs).
  • Mirror check cache (fetched a few minutes ago, sha matches my push): every check reported so far is success — test shards (ubuntu/windows × node 22/24), static-gates, mysql-contract, lifecycle-ledger-guard, lock-sync, test-import-graph, config-surface-guard, lane-guard. Remaining lanes (e2e suites etc.) were still in flight at cache time; I'm not claiming full green until they land.

No action needed from anyone right now. If any check comes back red, this same lane picks it up on the next trigger (attempts 2/3 available).


七问(本 run:重启后核实与汇报)

  1. 是什么问题:进程被强制重启后需要确认上一轮冲突修复的成果是否仍然成立、PR 当前处于什么状态。
  2. 什么原因导致的(卡住本身):上一轮在等待 npm 安装与测试执行期间被判定 31 分钟无输出而重启;工作成果已落盘并推送,不依赖进程存活。
  3. 影响范围与严重程度:无影响——分支、提交、已发布的评论均完好;仅会话中断过一次。
  4. 怎么修复的/做了什么:本轮未改任何代码;只做三件实时核查——fetch 对比远端 head(仍为我的 rebase 提交 0a0be94)、查 origin/master(仍是 rebase 基线 dc041dd,无新冲突)、读镜像 check 缓存 + 单次 PR GET(mergeable=true,已出结果的 check 全部 success)。
  5. 是否有回归问题:未发现——远端状态与上一轮推送后完全一致。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向或引入新配置:均不涉及。

判定:冲突修复维持有效,等剩余 CI 跑完即可人工合并;若出现红项由本车道后续触发继续处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Verified live in this run: the reported blocker no longer exists — no action taken.

The trigger described merge state dirty, but every live source I checked this run says otherwise:

  • Branch: remote head is still 0a0be94af9 (my conflict-rebase from the earlier runs); no concurrent pushes, nothing lost.
  • Merge state (live GitHub GET): mergeable: true, state behind — i.e. clean-mergeable against the current master tip, just not up-to-date. The dirty/conflict condition was cleared by the earlier force-push; GitHub's recomputation confirms it.
  • Why behind is safe: master advanced 13 commits while the session was down (dc041dd1ab → c26c31ace4), and I diffed those commits against this PR's six files (docs/configuration.md, src/integrity-label.ts, src/logger.ts, src/persist-eperm.ts, tests/persist-eperm.test.ts, tests/storage-cantopen-hint.test.ts) — zero overlap, so no new conflict can arise at merge time.
  • Checks (mirror cache, last fetch 23:48 local, sha matches my push): 18 success / 12 skipped / 0 failure. All completed lanes green; skipped ones are conditional/gated lanes. (I did not gh-poll beyond that — shared PAT budget policy.)

Deliberately did NOT push anything this run: there is no conflict to rebase (force-push is only authorized for an explicit conflict-rebase) and no red CI to fix. The PR is ready for a human merge; if the owner wants it rebased onto the newest master tip first, that's one click ("Update branch") or say the word and I'll do it as a merge-base refresh.


七问(本 run:触发复核,未改任何代码)

  1. 是什么问题:系统再次转发「PR [PR] fix: rank the node runtime's Low integrity label first in win32 EPERM hints; add non-blocking startup self-check (#5155) #5160 与基线冲突(dirty)」的阻塞通知,需要核实该阻塞是否仍然存在。
  2. 什么原因导致的(误报):通知携带的是触发时刻的旧状态;实际冲突在更早一轮已解决(rebase + force-push 到 0a0be94),GitHub 重算后当前状态是 behind(可合并、仅落后),不是 dirty。
  3. 影响范围与严重程度:无影响——PR 处于可合并状态,CI 已完成项全绿;只是落后 master 13 个提交,且这 13 个提交与本 PR 的 6 个文件零重叠,合并时不可能产生新冲突。
  4. 怎么修复的/做了什么:本轮零代码变更;做了四项实时核查——fetch 对比远端分支 head、单次 GitHub GET 查 mergeable_state、diff 新 master 区间与本 PR 文件集、读镜像 check 缓存统计结论分布。
  5. 是否有回归问题:无——未触碰任何代码或分支。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向或引入新配置:均不涉及。

判定:无需本轮修复;PR 可人工合并(如需先对齐最新 master,点「Update branch」即可)。若后续 CI 出现红项,由本车道下一轮触发处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Closing out this run (full detail already posted above): the re-trigger claimed merge state dirty, but all four live checks this run say otherwise — remote head still 0a0be94af9 (my conflict-rebase), live GitHub GET mergeable: true / behind (not dirty), master's 13 new commits have zero overlap with the PR's six files, and the mirror check cache shows 18 success / 12 skipped / 0 failure.

What I did: verification only — fetch + head comparison, single PR-state GET, diff of the new master window against the PR file set, mirror check-cache read. Zero code or branch changes (force-push reserved for an explicit conflict-rebase; none exists).

Outcome: no blocker remains. The PR is ready for a human merge as-is; optionally click "Update branch" first to absorb master's 13 commits (safe — no file overlap). If any red check appears later, this same CI lane picks it up on the next trigger.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

重启后进度汇报:无阻塞、无待办——上一轮的工作在重启前已全部完成并汇报(见上方两条回复),本次卡住的原因是会话在发完最终报告后空闲等待,没有任何挂起的命令或操作。

重启后已重新做实时核查(不依赖记忆):

  • fetch 对比:远端 PR head 仍为 0a0be94af9(我此前的冲突 rebase 提交),无并行推送;
  • origin/master 仍为 c26c31ace4,31 分钟内未前进;
  • 单次 GitHub GET:mergeable: true、状态 behind(可合并、仅落后,非冲突);
  • 镜像 check 缓存(sha 匹配我的推送):18 success / 12 skipped / 0 failure。

四项全部与此前一致:当前不存在任何阻塞项(无冲突、无红 CI)。PR 可直接人工合并;如需先对齐最新 master,点「Update branch」即可(已核实新 master 区间与本 PR 的 6 个文件零重叠)。本车道继续待命,若后续出现红项或新冲突,由下一轮触发处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant