Repository navigation
[PR] batch-C: storage/network/panel misc — 5 absorbed fixes + 1 new (#7407 DNS worker leak); #7419 investigated, no in-repo fix - #7449
Open
ranxianglei wants to merge 6 commits into
Open
ranxianglei wants to merge 6 commits into
ranxianglei wants to merge 6 commits into
Conversation
… real error (#6642) The 404 fallthrough in handlePluginStatus built headers by hand with only content-type, while the 2xx branches above it use jsonHeaders() (which adds access-control-allow-origin when a trusted origin is admitted). The dsh Context tab polls this route cross-origin, so a bare 404 is rejected by the browser as 'Failed to fetch', masking the real 'unknown plugin conversation' error the panel is trying to surface. Reuse jsonHeaders() in the 404 branch. Both 404 paths (fallback=latest 'since boot' and bare 'unknown plugin conversation') go through this one writeHead, so one fix covers both. Negative case pinned: no trusted origin → no allow-origin header (never echoed to an untrusted caller). (cherry picked from commit b154797)
(cherry picked from commit c11a7ef)
… writer state (#7408) The pre-#6480 wording ("storage.unified=full or BILI_STORAGE_UNIFIED=full: ... legacy files keep being written — unset the knob to roll back") survived the pure-sqlite default flip. Under the default posture — no knob set, JSON envelopes NOT written — all three clauses were false, contradicting the accurate jsonWriter-off line persist.ts prints in the same boot and steering field diagnosis into chasing a non-existent dual-write (#7408 §3b). The line now branches on the raw selection (unifiedSelectionIsSqlite) and the effective writer state (effectiveJsonWriterOff, which at that point equals persist.ts's jsonWriterOff: mode is full, backend is sqlite, and an encryption-blocked open never reaches the line): - writer off → "index.db is the load path AND the only persistent copy — JSON envelopes are not written; restore dual-write with storage.jsonWriter=on" - writer on + pure-sqlite selection → names the explicit storage.jsonWriter=on as the reason envelopes are written - writer on + explicit full → the historical dual-write wording, unchanged maybeOpen/openAsync take the file-tier jsonWriter value as a new optional parameter (persist.ts passes fileStorageJsonWriter() at both call sites); the module doc header is updated to the four current postures. Regression test: tests/issue7408-storage-boot-log.test.ts pins the exact boot line for all five reachable postures. Log wording only — no wire, config, or storage-semantics change. (cherry picked from commit 3e82f42)
A HEAD response has no body by definition (RFC 9110 §9.3.2), so a 200 HEAD with a null body is normal, not the #821 anomaly. Health probes (e.g. HEAD /api/hello) hit the relay's 2xx null-body branch on every request and flooded bili.log with `[unknown] ← upstream 200 returned a null body` lines — the exact noise in the #7072 report. The relay now skips the warn for HEAD while still warning for a genuine 2xx null body (204/304 on a body-bearing method). No behavior change: the response is still relayed empty for HEAD (the client gets the 200 with no body, as before); only the spurious warn is suppressed. (cherry picked from commit 83c0e04)
…ns (#7345) The watermark fastpath head check compared a.id !== b.id between the fresh head cores (content-hash ids minted by openaiToCore, h_…) and the stashed seed cores. In a pinned session (pluginLaneServerHistory + pluginMsgIdIncremental — the 2x2 traffic the fastpath exists to accelerate) prepare-openai rebinds originalMessages to the POST-PIN cores before finalizeWatermarkTurn, so the seed carries host/ledger msgids while a fresh openaiToCore parse mints content-hash ids. The two id namespaces differ structurally on every turn, so the comparison could never pass: every turn of a pinned session logged fastpath miss (head-prefix-drift) and fell back to the full legacy parse. The id is not a content signal: exclude it from the head comparison (content and role inequality are still caught, and a remint with identical bytes is not a rewrite). Non-pinned traffic keeps content-hash ids on both sides, so when a.id === b.id the full-JSON equality holds iff the id-stripped equality holds — existing behavior is unchanged. Regression test plays the field sequence: seed with a host-id list, then a tail-only growth turn must HIT (was head-prefix-drift) and an in-place head edit must still drift. Fixes #7345 (cherry picked from commit ba4d5a6)
…r deadline settles the probe (#7407) The tunnel-admission worker probe (the post-main-pool-exhaustion fallback from #5222) runs in a throwaway worker thread with an inner 2.5s lookup deadline and an outer 3s worker deadline. When the inner timer posted ETIMEDOUT, the parent rejected the probe and cleared the outer timer but never stopped the worker: the expired one-shot worker (and its still- queued getaddrinfo, holding a libuv pool slot) stayed alive until unrelated native work completed. Repeated failing admissions could each retain a worker thread. The message handler now requests worker.terminate() for the inner-deadline ETIMEDOUT verdict — the same termination the outer deadline already used — handling terminate's async rejection before the existing timeout error is returned. Success and settled-failure verdicts are untouched (the lookup has already completed there and the worker drains and exits on its own). Admission classification, retries, and configured behavior are preserved; no wire, config, or message-shape change. Regression: tests/tunnel-guard-worker-lifecycle.test.ts runs the REAL Worker implementation with a controlled stalled-lookup boundary (real eval-worker plumbing; only dns.promises.lookup is replaced with a never-settling boundary plus a liveness anchor). It fails on the unfixed base (expired worker still alive after the ETIMEDOUT verdict) and passes with the fix (terminated, exit code 1). Controls: the outer deadline still stops a worker that cannot send its inner verdict, and a successful localhost lookup exits normally with its addresses.
Contributor
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11181-pr.7449.21ffadfThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7449.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这批是什么
一次小修批处理:把 5 个已评审通过的 PR 原样吸收进来(cherry-pick
-x,保留原作者),外加 1 个新修(DNS 回退 worker 泄漏)。全部是单模块小修,每个都带回归测试。吸收的原 PR
access-control-allow-origin时浏览器直接报 "Failed to fetch",真实错误被网络错误盖住新修(本批自己写的)
#7407 — DNS 回退 worker 泄漏:隧道准入的 DNS 回退在一次性 worker 线程里跑,内层 2.5s 超时到点发 ETIMEDOUT 后,父进程只清外层定时器、从不 terminate 这个 worker——过期的 worker 连同它队列里还没跑完的 getaddrinfo(占着 libuv 池一个槽位)一直活着,反复失败的准入会攒下一串僵尸 worker。现在内层超时判词一到就
worker.terminate(),和外层超时同一套处理。回归测试用真实 Worker 实现 + 受控的卡死 lookup 边界:未修代码上失败、修好后通过,另有外层超时/正常成功两个对照。#7419(pnpm allowlist)——查过了,本仓库没有可修的东西
dsh plugin add billion-context@latest报ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED,被挡的包是dshmarket@1.73.11——DSH 自己装进 profile 的 git 依赖(带prepare构建脚本),不是 billion-context 的依赖:本仓库 package.json / lockfile 里完全没有它,发布产物零 git 依赖。pnpm 的构建脚本白名单是项目级配置(装在哪就在哪的pnpm-workspace.yamlallowBuilds),一个 registry 依赖自己 package.json 里的 pnpm 字段管不到别的项目——在本仓库加白名单条目是死配置。issue 里已有完整 triage(根因在 DSH profile + hub 归因),给了三步解阻方案和外部仓库修复计划。本 PR 不声称修 #7419,也不自动关它。关联 issue
原 PR #6648 / #7349 / #7409 / #7420 / #7352 将在本批合并后由人工关单并注明"已收编进本批"。
测试
npm run typecheck干净;5 个 cherry-pick 各自自带的回归测试 + 新写的tests/tunnel-guard-worker-lifecycle.test.ts全部在目标运行中通过(8 个目标测试文件 65/65)。test车道为准(本地全量是环境噪音,不作合并依据,§7.2)。