Repository navigation
fix: strip case-drifted render tags; uncapped open-side attrs in tag-echo filter (#1731) - #1741
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1689-pr.1741.1009c43This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1741.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review of PR #1741 (Fixes #1731) Pulled ① Original-issue direction. #1731 names two independent defects (lowercase-only name patterns, with the ② Regression review — existing behaviors on the touched paths:
③ Code review.
④ Test validity. The new tests have teeth: exact-equality assertions, full split-position sweeps (the strongest streaming-boundary pin available), gate-engagement checks, prose-survival guards, and a ReDoS guard whose thresholds (500 ms / 1000 ms) sit 100–1000× above the claimed measurements — an exponential blow-up would trip them. Deleted pins are documented as superseded in-test. One minor, non-blocking gap: no explicit case-drift variant of the #644 ">32-char malformed close" test — the mechanism is identical through the shared ⑤ Diff cleanliness. Single purposeful commit; no unrelated files, no whitespace churn, no lockfile/generated churn. Pre-flight (reproduced locally on the rebased head): Behavior changes (confirming the PR's disclosure): (1) name matching is case-insensitive everywhere — a bare angle-bracketed uppercase token like Gate note: per §7.4, a change to the stripping surface (which model-output bytes reach the client) stays human-merge regardless of how clean the rest is. Nothing here needs a fix-up commit; no separate issue warranted. 一句话中文摘要:审查了 PR #1741(修 #1731 tag-echo 过滤器大小写盲区 + 开标签属性上限绕过)——两处根因都在源头修复(名字模式大小写折叠直接烤进交替式、规避 .source 重建丢 flag 的二阶陷阱;开侧上限移除且保住 #644 闭侧 {0,32} 边界),既有行为逐项回归清单干净、行为变更已如实披露,本地 typecheck/测试(3326/0/17)与 CI 全绿(含 e2e),diff 干净,可以合并(按规约由人工执行合并)。 |
…ICT_PORT pipe Review finding on the env-surface retirement: #1714's Class B inventory lists BILI_STRICT_PORT, but it was left readable from process.env in every proxy (server.ts port-retry opt-out, #964). It is a claude SessionStart hook -> launcher -> child pipeline var, so like BILI_MITM_DOMAINS it moves to the internal BILI_LAUNCHER_* namespace and joins the RETIRED boot-scan map — a stale 'export BILI_STRICT_PORT=1' now warns instead of silently disabling port retry on all instances (#1706 failure class). Also rebased onto current master (no file overlap with #1741).
Fixes #1731
What changed
src/loop/tag-echo-filter.ts— two independent defects in the model-emitted render-tag stripper:Defect 1 (case). Every name pattern was built from lowercase literals only, so uppercase/mixed-case echoes (m00001, <AcP …>…, lone ) passed through verbatim. The fix bakes case folding into
buildAcplikeName()as per-letter character classes instead of aniflag — deliberately flag-free, becausestripAcpTagsandflush()rebuild their regexes from.source, where a flag would be silently dropped at every rebuild site (the second-order trap called out in the issue). The raw-wire gate (RENDER_TAG_DETECT), the streaming partial-tail gate (third branch made case-aware), and the Responses-adapter replay-drop regex all consume the same alternation and become case-aware without further edits.Defect 2 (caps defined a bypass). Open-side attr caps (
PAIRED/LONE_OPEN{{0,256}},BROKEN_ATTRS{{0,512}}) meant a longer attr run escaped every open-tag matcher while the loose close still went — the observed residue "open survived, close deleted". Caps removed on the open side only:[^<>]cannot cross a bracket, so the matchers stay linear for arbitrarily long runs (measured: single 200 KB attr run ≈ 0.5–2 ms; 500 unterminated heads ≈ 0.4 ms; pinned by a new perf-guard test). Close-side {{0,32}} bounds are UNCHANGED — they are load-bearing for #644 (an unbounded close-side tail ate real content after a malformed close; a dedicated test requires the bound).Tests: the two old pins that encoded the bypass ("long tag-like spans are prose, not tags", "prose with a tag-like opening beyond the attr bound survives intact") are superseded by #1731 tests — long-attr paired tags stripped whole-text and at every split position, case-drifted pairs/lone opens/closes stripped plus a full split sweep, gate engagement on upper-case tag-head tails, prose guards under case drift (Caption/app/"the ACPI spec"/#include <ACPI/acpi.h> all survive), and the ReDoS guard.
Behavior changes (old → new)
PAIRED正则吞掉最多 64 个字符的助手正文 #1720): ref-like body → whole span stripped; prose body → tags go, prose stays. Previously such openings leaked verbatim or half-leaked (open kept, close deleted = orphan markup). Performance measured linear; see perf-guard test.Config surface: none — no config field added, renamed, or re-semantics'd.
Scope notes
PAIRED正则吞掉最多 64 个字符的助手正文 #1720 (payload-length proxy) was already fixed upstream by merged PR fix: keep prose between paired render tags in tag-echo filter (#1720) #1721 before this branch cut — nothing to do here.Pre-flight (rebased onto current master 27c8774)
npm run typecheck— cleannpm test— 3326 pass / 0 fail / 17 skipnpm run build— success