Repository navigation
feat: one-shot EPERM diagnostic alert for Windows + AV-exclusion docs (#367) - #373
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-373Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr373.tgz
npm install -g packageThis comment is automatically updated on each push. |
[bot] 已 checkout PR 分支 独立验证
检测机制核对(对已安装 acp-kernel 0.0.46 dist 逐行验证)
代码质量(对 AGENTS.md)
Layer 1 提示属实(重要)已核对安装的 0.0.46: 非阻塞小 nit(不挡合并,供后续)
结论:PR 完整实现 #367 的 Layer 2 + Layer 3,检测机制经对内核逐行核对成立,pre-flight 全绿,代码符合规范,Layer 1 跨仓依赖披露准确且已跟踪。可合并(rebase 到最新 master 后)。合并请人工操作:#373 |
2a2122f to
89b4bba
Compare
|
Conflict-resolved against master (kernel 0.0.53 + #559) — branch force-updated, head What was resolved
Compatibility fix for acp-kernel 0.0.53 (just released, pin bumped in #560)
Pre-flight
Ready to merge — closes #367 (Layer 2 + Layer 3; Layer 1 shipped in acp-kernel 0.0.47→0.0.53). |
- CONFIGURATION.md: keep both the EPERM alert knobs and master's BILI_TUNNEL_ALLOWED_HOSTS row. - tests/proxy-persist.test.ts: keep master's #499 pfa migration test and the PR's wire test; the wire test now polls (waitFor, 5s) for the kernel failure line because acp-kernel 0.0.53 retries the whole write cycle on transient ENOTDIR (~1.5s) before logging it — a fixed settle(50) would fail. Verified against pinned acp-kernel 0.0.53: recordFailure emits the same '[persist] write failed for <id> (total <N>x): <err>' shape the detector regex parses; EPERM/EBUSY/EACCES lock codes remain non-transient enough to count toward the alert. Pre-flight: typecheck ✓, tests 1058/1060 (2 known env fails in plugin-agent.test.ts), build ✓.
3c25a9e to
7bc107f
Compare
|
上一条推送用了 merge 方式解冲突,导致 GitHub Files changed 显示 ~115 个文件(把 master 这一周的演进也显示进去了,非本 PR 内容)。已改为 rebase 到 master( |
[bot] Post-merge verification done. Heads up first: this PR is already merged into Verdict: LGTM ✅ — the 0.0.53-compatible detector is correct. The only real risk the rebase onto kernel-0.0.53 master introduced was whether the alert still parses the changed kernel log line and keeps a stable session id for counting. I checked the actual
Pre-flight (run independently on the merged content, byte-identical to
The single failure is unrelated to this PR and is environment-dependent: Two minor doc nits (non-blocking, report-only):
I can open a tiny docs-fix follow-up PR for these two if you want them cleaned up. Cross-repo status: Layer 1 (spill-to- Nothing here blocks anything (already released). Let me know if you want the two doc nits fixed up. |
…session state Dual-instance rollback guard (#405 fix #4, tracked in #598): when two bili processes share BILI_SESSIONS_DIR, the instance holding an older in-memory copy must not overwrite the fresher on-disk state. Monotonic signals (stats.requests, state.nextBlockId) prove staleness; a stale save is turned into a content-identical rewrite of the disk payload (keeping the newer state) with a throttled one-minute warn. Rebased onto master (v0.1.92 era): loadEnvelope() probe extracted from loadSync keeps the #408 negative-clamp reload path; constructor unifies this.log with the #373 PersistEpermAlert baseLog. Fixes #598
Summary
Implements the two remaining layers of the #362 root-cause fix (Layer 1 resilience already landed in acp-kernel PR #172):
BILI_PERSIST_EPERM_ALERT_THRESHOLD) with a file-lock error (EPERM/EBUSY/EACCES) on the same session id, emit one actionable warning naming the sessions dir and pointing at the Windows Defender exclusion (+ OneDrive/sync warning). One-shot by default; optional low-frequency repeat viaBILI_PERSIST_EPERM_ALERT_REPEAT_MS. Windows-only + lock-codes-only, so non-Windows / non-lock failures never alert.How detection works
The kernel's debounced
scheduleSavepath swallows write errors, so its[persist] (write|flushSync|shutdown flush) failed for <id>: <err>log lines are the only signal for the hot path.SessionStorenow wraps theStateStorelogcallback with aPersistEpermAlertdetector (src/persist-eperm.ts) that counts per-id consecutive lock failures and emits the alert. This works against the pinnedacp-kernel0.0.46 — no cross-repo change needed.The pinned
acp-kernel0.0.46 does not contain PR #172 (spill-to-<name>.fb.json/ error rate-limiting) — verified against the installeddist. PR #172 is only in acp-kernel master / prerelease0.0.46-pr.172.23. So until acp-kernel ships a stable with PR #172 and this repo bumps the pin, published billion-context still reproduces the #362 data-loss + log-flooding. This PR's Layer 2 is independent and works on 0.0.46 (it makes the lock diagnosable), but the data-loss resilience still needs the kernel bump. I'll track that as a separate issue.Tests
tests/persist-eperm.test.ts— 11 unit tests: alert fires exactly at the Nth consecutive EPERM; below-threshold / non-lock / non-error-level / non-Windows → no alert; one-shot; rate-limit cadence; per-id counting; all 3 kernel failure kinds; no false match on unrelated lines; alert message content.tests/proxy-persist.test.ts— integration: a realSessionStoreroutes a write failure through the detector with no false alert on a non-lock error.Pre-flight
npm run typecheck— cleannpm test— 862/862 passnpm run build— successCloses #367 (Layer 2 + Layer 3).