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 (619ed00)

Latest build — install this exact version

npm install -g billion-context@0.0.7467-pr.5160.ac6c135

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
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.

… 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 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 头)。

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