Skip to content

[PR] batch-5: 21 low-risk community fixes (verbatim merges, authorship preserved) - #7392

Merged
ranxianglei merged 44 commits into
masterfrom
batch/afloat16-layered-2026-11-20
Nov 20, 2026
Merged

ranxianglei merged 44 commits into
masterfrom
batch/afloat16-layered-2026-11-20

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

batch-5: 21 low-risk community fixes (verbatim --no-ff merges, authorship preserved)

One batch PR carrying 21 independently-reviewed, self-contained fixes by Afloat (issues #7120–#7383 era). Each was reviewed commit-by-commit against current master and got a SAFE verdict. Every one is a scoped bugfix with a regression test — no design-level change, no hot-path/core file touched.

This is batch-5 of the layered split: the small, isolated fixes come here in one reviewable unit; the 15 load-bearing ones (fetch-util / preflight / loop-adapter-*/billing/storage/session-gc/persistence/keepalive, plus one conflicting) are kept as separate PRs so they get their own focused review. See the bottom for that list.

How the merges preserve authorship (and auto-close the source PRs)

Each PR is brought in with git merge --no-ff <its head> — the original commit SHAs, author (Afloat), dates, messages, and content are preserved verbatim in this branch's history (not squashed, not cherry-picked). Because each source PR's head commit becomes an ancestor of master once this lands, GitHub flips all 21 source PRs to "merged" automatically — no manual closing, no duplicate landings.

What's in it (21)

PR Issue What it fixes (plain language)
#7138 #7120 Node's Happy-Eyeballs connect can surface an ETIMEDOUT AggregateError whose children still carry syscall: "connect"; the classifier read it as a generic upstream-timeout, so a request that never connected skipped the bounded connect-retry + alert path. Connect-phase ETIMEDOUT is now classified correctly.
#7141 #7140 Protected (original) images were not counted against the image caps, so a protected original could push a request over the limit unnoticed.
#7147 #7146 The ordinary image pass admitted a candidate by its decoded byte size, then the encoder rejected every in-limit image when force=false — so the byte-size trigger never reached a normal re-encode. Byte-triggered re-encoding restored.
#7162 #7160 With plan-aware search on, planTokenize() lowercased its entire input on every token match (incl. the final failing match); a Chinese plan emits a token per character, so an unchanged source was rescanned/renormalized repeatedly. Plan text is now normalized once per source.
#7166 #7165 connectThroughProxy only enforced its 64 KiB response-header limit while the terminating \r\n\r\n was absent — a complete 80 KiB 200 head opened a tunnel while the same oversized head without its delimiter was rejected. Header bound now applies to completed responses too.
#7171 #7170 A rejected continuation's non-429 branch cleared the fetch watchdog without consuming/canceling the upstream response body; a server that sent an error chunk and left the response open held the connection. Rejected bodies are now cancelled.
#7174 #7172 Anonymous affinity rebuilt canonical JSON with {} + dynamic keys, so an own key named __proto__ invoked the inherited setter and vanished from the fingerprint. Histories differing only in that retained key were wrongly replayed/merged. Own keys preserved.
#7182 #7180 After a refused WebSocket upgrade, the generate:false warmup read the HTTP/SSE fallback with a parser that only knew LF/LF + data: — valid CRLF, lone CR, or data: framing became "incomplete". Complete SSE events now parsed.
#7185 #7183 With output steering on, a Google function response carrying an explicit error was treated as a clean continuation; the forwarder cut thinkingBudget: 8000 → 128 even after a permission/partial-tool failure. Thinking budgets now survive tool errors.
#7187 #7186 Google native requests can auth via a key/$key query param, but the 429 governor fingerprinted only credential headers — independent query-auth accounts on the same host shared one anonymous hold, so account A's 429 blocked account B. Holds now isolated per query-key.
#7220 #7218 The Claude MCP watchdog accepted any successful HTTP status as a healthy proxy; an HTML page or {"ok":false} with 200 reset its failure counter, so recovery never ran and MCP tools stayed pinned. Health payloads now validated.
#7285 #7284 Relay lookup walked every lowercase-index entry for each model suffix even when the registry was unchanged — repeated pricing/context/output queries re-scanned the whole roster for a tiny match set. Suffix candidates now indexed.
#7290 #7289 When several disk files represent one session, the index already picks a winner by newest savedAt/mtime, but the summary merge ignored it and let the last file visited overwrite earlier summaries — a stale twin could win. Freshest disk summaries now selected.
#7292 #7291 Disk-only sessions reused a fully-priced summary indefinitely, so a price edit left old spend/fold-savings/payback/rates on disk (live sessions updated, disk didn't). Cached disk summaries refresh on price change.
#7294 #7293 Registered diagnostics topics triggered a full retained-log scan even when the report didn't use the result; reports needing only the latest 12/20 lines still streamed every old generation. Unused generations no longer read.
#7341 #7339 Blog refresh's 512 KiB text / 2 MiB image limits were applied after buffering the whole response, so a missing/understated Content-Length let oversized downloads run to EOF before rejection. Unread-blog response cleanup shared + bounded earlier.
#7359 #7358 The renderer's link/image regexes repeatedly scanned overlapping suffixes of malformed labels and nested URL starts — a 40k-char literal label took ~1.42 s and could block synchronously. Repeated scans of malformed links eliminated.
#7362 #7361 Port 65535 was accepted as a zone base/sticky port; a launcher-managed listener forced off it during retries computed 65536, which Node rejects with ERR_SOCKET_BAD_PORT. Listen retries now stay in the valid range.
#7370 #7369 An active upstream alert kept its old skipped-proxy endpoint after later requests started using/bypassing that proxy — the English hint refreshed but the localized banner kept reading stale structured fields. Skipped-proxy evidence refreshed in repeated alerts.
#7375 #7374 A failed read of the optional article manifest was caught together with the normal missing/malformed cases, so a refresh could publish new posts while discarding the previous article set and still report success. The complete blog feed is preserved on manifest read failures.
#7384 #7383 Changelog checks rejected HTTP errors before consuming their response bodies and stopped the idle watchdog; a server leaving an error response open held the connection after getChangelog() returned. Error response bodies now released.

著作权 (authorship)

All 21 source PRs are by Afloat (ShuffleMonkey@163.com); their original commits are preserved verbatim via git merge --no-ff (author, date, message, content intact). 46 files changed, +2781 / −150, 21 merge commits. No conflicts at assembly time (the two intra-batch file overlaps — src/web/sessions-data.ts from #7290+#7292 and src/web/blog-refresh.ts from #7341+#7375 — merged cleanly).

Verification

After this merges

The 21 source PRs — #7138 #7141 #7147 #7162 #7166 #7171 #7174 #7182 #7185 #7187 #7220 #7285 #7290 #7292 #7294 #7341 #7359 #7362 #7370 #7375 #7384 — land with content identical to theirs and will auto-flip to "merged" (their head commits are ancestors of master). Nothing needs manual closing.

Fixes #7120, fixes #7140, fixes #7146, fixes #7160, fixes #7165, fixes #7170,
fixes #7172, fixes #7180, fixes #7183, fixes #7186, fixes #7218, fixes #7284,
fixes #7289, fixes #7291, fixes #7293, fixes #7339, fixes #7358, fixes #7361,
fixes #7369, fixes #7374, fixes #7383.

Afloat16 and others added 30 commits November 18, 2026 17:44
Recognize direct connect syscalls and homogeneous connect AggregateErrors
as connect-timeout, restoring existing bounded retries and alerts.
Keep read, write, unknown, mixed and externally aborted failures conservative.

Fixes #7120
Keep retained original images in the remaining-image budget while preserving their byte-pressure exemptions. Archive eligible images until the shared target is met and reuse the learned cap on subsequent proxy and plugin relay turns.

Fixes #7140
Restore ordinary same-dimension encodes above the existing byte threshold.
Keep the forced path and keep-smaller policy unchanged, and verify real
codec output, original-byte preservation and proxy/plugin HTTP requests.

Fixes #7146
Reuse the stripped, lowercased plan string across token matches instead of normalizing it for every token. Preserve extraction and search results while avoiding repeated full-text scans on CJK and mixed-language plans.

Add a reproducible benchmark using actual compressed blocks and the plan-aware search entry point.

Fixes #7160
Apply the existing 64 KiB response-header budget whether or not the
terminating delimiter is already buffered. Exclude tunneled payload
bytes, and cover exact limits, split delimiters and the blind tunnel.

Fixes #7165
Release non-429 response bodies when the continuation is discarded.
Keep cancellation asynchronous so an unfinished tee sibling cannot delay
the existing null fallback; preserve successful streams and 429 readers.
Keep literal prototype-named JSON data in neutral and legacy fingerprints.
Cover four wire formats, old lossy snapshots, and real HTTP session routing.
Reuse the shared line-ending and data-field parser after HTTP fallback. Preserve terminal boundaries, buffer limits, and successful warmup checkpoints.
Carry explicit function-response errors into the existing structural classifier. Keep clean-result effort routing and the requested error-recovery budget distinct.
Bound raw document and image reads before buffering an oversized response,
cancel rejected bodies, and measure contents-API base64 payloads after
removing whitespace and accounting for padding. Preserve fallback and
last-good-overlay semantics at the existing byte limits.
Apply the review's cleanup extraction without changing the five fetch paths or the order of body cancellation and idle-watchdog shutdown. The 38 blog-refresh tests and TypeScript typecheck pass.
@ranxianglei ranxianglei changed the title batch-5: 21 low-risk community fixes (verbatim merges, authorship preserved) [PR] batch-5: 21 low-risk community fixes (verbatim merges, authorship preserved) Nov 20, 2026
@ranxianglei ranxianglei added root-cause bug Something isn't working p2 scope/ui labels Nov 20, 2026
The #7146 fix made the 100 KiB trigger gate apply equally to force and
non-force paths. The comment still claimed force 'skips the 100 KiB trigger
gate' — now inaccurate. Updated to reflect the post-fix behavior.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Review: PR #7392 — batch-5: 21 low-risk community fixes

Verdict: APPROVE (pending CI green). All 21 fixes verified correct against supporting code. All 23 touched test files pass on a clean environment (398 pass / 0 fail). One minor finding (stale comment) fixed and pushed to the PR branch.

Per-fix verification (all 21 CORRECT):

Batch 1 (upstream/affinity/image/registry/steering):

Batch 2 (responses-ws/web):

Minor finding (FIXED, commit d5ab3aa56ca): src/image-rescale.ts:152-155 stale comment claimed "force skips the 100 KiB trigger gate" — now inaccurate post-#7146 (the trigger gate applies equally to force and non-force). Updated to reflect the post-fix behavior.

Test verification: All 23 touched test files: 398 pass / 0 fail (clean environment). The PR author's "396 pass / 1 fail" is consistent — the 1 fail was a stale persisted snapshot (~/.local/state/billion-context/prefix-affinity.json with 1024 entries) loaded on server startup. This is an ENVIRONMENT issue (the test is not hermetic — _setStoreForTest disables the store but not affinity persistence), not a Node-version artifact and not a bug in the fix. With the snapshot moved aside, all tests pass.

CI status: 30 checks, 0 failed, 12 pending (test lanes queued, as of last check). The comment fix (commit d5ab3aa56ca) will trigger a new CI run.


8 问审核结论

  1. 是什么问题: 社区批量 PR(batch-5),21 个独立低风险修复,每个 = bugfix + 回归测试,为分层拆分中的低风险批次(15 个承重修复另开)。
  2. 什么原因导致的: 每个修复对应一个具体 bug(已逐条对照支撑代码验证,非凭描述开工)。
  3. 影响范围与严重程度: 低风险——不触碰热路径/核心(无 server.ts/loop/**/update.ts/persist.ts/kernel/)。涉及面:upstream/affinity/image/registry/steering + responses-ws/web。均为特定条件下的功能修复,无可用性影响。
  4. 怎么修复的: 每个修复都是定向 bugfix + 回归测试,已验证全部正确。
  5. 是否有回归问题: 无。23 个触碰的测试文件在干净环境全部通过(398 pass / 0 fail)。行为变更均为有意修复:Image byte-size trigger skips compressible images within the dimension limit #7146 字节触发器(普通路径大尺寸图片现在会重编码)、Anonymous prefix affinity drops own __proto__ keys and joins divergent tool histories #7172 proto-key(__proto__ 键不再丢失)、Image-count rescue omits protected originals from the remaining budget #7140 exempt 计数(保护图片现在计入上限但永不修改)——force 路径行为不变,无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存: 不涉及缓存变更。
  7. 是否改了设计方向: 不涉及设计方向变更。
  8. 是否引入了新的配置: 不涉及新配置。

合并判定: 可合并(待 CI 全绿)。21 个修复全部验证正确,测试全绿,1 个次要发现(过期注释)已修复并推送至 PR 分支。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: batch/afloat16-layered-2026-11-20 (d5ab3aa)

Latest build — install this exact version

npm install -g billion-context@0.0.11087-pr.7392.229ef2f-a4

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
d5ab3aa billion-context@0.0.11087-pr.7392.229ef2f-a4 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

Live state re-verified this run (mirror cache, fetched 13:40Z): build-artifact is the ONLY red check on head d5ab3aa56c; every test lane (ubuntu/windows × node22/24 shards), static-gates, and all other lanes are green. The build itself fully succeeded (kernel + pi-subagents + all tsup bundles, dist-ready: OK) — the job dies at the final "Publish to npm with rolling pr tag" step:

npm error 403 403 Forbidden - PUT https://registry.npmjs.org/billion-context
- Two-factor authentication or granular access token with bypass 2fa enabled is required to publish packages.

This is a CI-credential problem, not a code problem. The NPM_TOKEN GitHub Actions secret is authenticated but lacks 2FA bypass. No code change on this branch can fix it, and nothing is pushed this run (no [ework:ci-held] mid-session residue on head either).

Systemic, already on record: every same-repo PR's build-artifact run has been failing since ~06:02Z today (runs 44742582670, 44740076988, 44737048706, 44727359213, 44725540415, 44724168437, 44723497657, 44722795367, 44721888236); the "green" runs in that window are fork PRs, where the publish step is skipped by design (secrets not shared with forks). #4599 floor 1602 (today 09:26Z) reported this same systemic issue with a 404 signature (token account lacked publish rights). Our 13:39Z attempt (run 44722044985, attempt 3) shows the signature has evolved to 403 2FA-bypass — the token now has maintainer access but no 2FA bypass, i.e. the token state changed after that report (likely a rotation). I posted this signature update to #4599 just now.

Options (needs owner action):

  • A (recommended): rotate the NPM_TOKEN repo secret to a token with 2FA bypass (classic token created with 2FA, or a fine-grained token with the bypass-2FA permission on the package). Restores the full feature: pr-tag test builds, artifact upload, and the install-instructions comment.
  • B: make the publish step non-fatal in .github/workflows/pr-artifact.yml (continue-on-error / skip) so PRs stop being blocked while the token is broken. Changes CI behavior for ALL PRs and degrades the feature (no pr-tag builds, no artifact, no install comment) — a design call, not a mechanical fix.
  • C: do nothing; the PR stays blocked on this one check until the token is fixed.

Default if undecided: C — no code-side action; the PR remains blocked solely on build-artifact. needs-decision label applied.

八问

  1. 是什么问题:本 PR 的 build-artifact 检查红——但构建本身全部通过,红在最后的 npm publish 步骤(PR 试验版发布到 npm pr 滚动 tag)被 registry 拒绝。
  2. 什么原因导致的:GitHub Actions 的 NPM_TOKEN secret 当前状态是「已认证但缺 2FA bypass」(403 报错逐字如上)。这是 CI 凭据配置问题,不是 PR 代码缺陷。系统性问题:今天 ~06:02Z 起所有 same-repo PR 的 build-artifact 都红(fork PR 按设计跳过 publish 所以显绿);CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 09:26Z 已有同族记录(当时签名 404 = 无发布权),本次签名变为 403 2FA,说明 token 状态在那之后变化过(疑似轮换),已在 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 更新。
  3. 影响范围与严重程度:本仓库所有 same-repo PR 的 build-artifact 检查红、合并被该检查阻塞;无用户侧功能影响——测试矩阵与静态门禁在本 PR 上全绿,代码本身无问题。严重度:信号级阻塞(检查矩阵一条),非功能缺陷。
  4. 怎么修复的:代码侧无法修——这是 secret 配置问题,agent 无权改 GitHub Actions secret。已发 🔶 决策请求(A/B/C 选项,推荐 A:owner 轮换带 2FA bypass 的 NPM_TOKEN)、已打 needs-decision 标签、已把签名更新(404→403)同步到 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599。
  5. 是否有回归问题:本次零代码改动(PR 分支无新 commit),无回归面。既有行为逐项过:构建管线、测试矩阵、静态门禁均保持原状且全绿。
  6. 是否破坏缓存:不涉及(无代码改动)。
  7. 是否改了设计方向:没有。
  8. 是否引入了新的配置:没有。

结论:PR 代码侧全绿(全部测试 + 静态门禁);唯一红条 build-artifact 卡在 NPM_TOKEN secret,等 owner 决策(推荐 A:轮换带 2FA bypass 的 token)。token 修好后重跑 build-artifact 即绿,无需任何代码改动。

@ranxianglei
ranxianglei merged commit f7621b1 into master Nov 20, 2026
92 of 95 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1240-master.f7621b1 (rolling master tag).

npm install -g billion-context@0.0.1240-master.f7621b1  # 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.

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