Repository navigation
[PR] fix: judge ACP confirmation marker icon from the first line only - #5388
ranxianglei wants to merge 5 commits into
Conversation
buildVisibilityMarker scanned EVERY receipt line for FAILED / "not found" / "is required" when choosing the confirmation icon, so a SUCCESS compress whose summary fingerprint excerpt (or a decompress's restored history, a search evidence snippet, an acp_status block topic) merely mentioned a keyword rendered as ❌ while its text said "Compressed …". The first non-empty line is the authoritative status line for every proxy tool — every failure receipt carries its keyword there; judge only that. Mirror defect in the same mechanism: acp_read_original_image failure receipts carried no keyword at all → failures rendered 📦. They now follow the [tool FAILED: …] convention so both judgment schemes read them right. Behavior changes (old → new): - marker icon judgment: all non-empty lines → first non-empty line only. Success receipts with keyword mentions in embedded content: ❌ → correct tool icon. Real failures (keyword on line 1): unchanged. - acp_read_original_image failure receipts: "acp_read_original_image: …" → "[acp_read_original_image FAILED: …]" (model-visible text in plugin mode; icon flips from wrong 📦 to correct ❌). Regression tests: tests/issue5389-marker-icon-first-line.test.ts (both directions per #3617 gate discipline). Closes #5389
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9182-pr.5388.b190fb2This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5388.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR(GitHub #5388 / ework #5390)是 issue #5389「成功压缩画成 ❌ 图标」的修复本体,一个 issue 一个 PR。相邻条目我都核过、均不同机制:#5384 改的是控制流分类器(只看首行状态行,与本函数正交)、#1029 是回执「单行即权威状态行」契约的来源、#1708 改的是 visibilityMarkers 三态开关门控(不碰图标判定)。open+closed 无第二个同机制(首行图标判定)PR/issue。 我独立重读了 diff 与全部回执产出点(未照抄 #5389 floor 2/3 的表述)。以下为我的审核结论。 结构化八问
行为变更披露(旧→新,已写入 PR 正文)
测试有效性(④)新 diff 整洁度 / 代码质量(⑤/⑤b)3 文件 +167/-8,单 commit,基于当前 master(e209109bf),无越界改动、无空白/锁文件 churn。注释讲“为什么”(引 #5389/#1029 契约并列出各失败形状)而非复述代码;命名/风格一致;image-rescale 改动逐字保留指引。达标。 我的独立发现(不在本 PR 范围,建议另行跟踪)审控制流时发现同机制的隐性缺陷:core.ts 有 5 处直接扫 这是 #5389 同一根机制(拿全文做状态分类 vs 首行权威)的另一 facet,但症状不同(控制流 vs 图标)、触发集更窄。没有并入本 PR:本 PR 是纯展示小修(可独立合并),把 5 处 load-bearing 的折叠/缓存信用逻辑塞进来会膨胀 diff、抬高回归面,且需独立的两种压缩模式分析+测试。按 loop-guard(#5389 系自动立项 lineage)我不擅自开新 issue,在此上报请 owner 定夺:并入 #5389 作子项,或按其更窄触发单开。修法方向与 #5389 一致(改判首行即可)。 CIhead 655a3a3:30 项 check,0 failed,6 个 ubuntu test shard 仍在跑;已完成项(static-gates×2、mysql-contract、gate、plan、windows test 全 5 shard)全绿,e2e 类按门控 skipped。等 6 个 shard 收口即全绿。 收工判定可合(mergeable)——逻辑正确、无真实失败误判、测试有牙、diff 干净;等 6 个 ubuntu shard 转绿即可由 owner 合并。控制流 facet 不阻塞本 PR,建议按上单独跟踪。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — independent review of the full diff (3 files, single commit vs master e209109; no kernel/, no config surface).
What I verified myself (not taken from the issue thread)
- Every real failure receipt carries its keyword on line 1. Walked all emission sites:
[Compression FAILED: …](src/stream.ts:792/1009/1013/1017/1062/1297/1518),[decompress FAILED: …]/[Block bN not found](src/decompress-shared.ts:106–600, all sites),[search_context FAILED: …](:830/:990),[absorb FAILED: …](src/absorb.ts:89/104/109), acp_cache (src/cache-ledger.ts:2437), retrieve (src/store.ts:205/219 — the multi-line export-failure form has FAILED on L1), and the exception path❌ [ACP] <tool> FAILED: …(src/compress-loop-responses.ts:126, single line). None regresses to a success icon. - The first-line-is-authoritative contract holds for success receipts too: decompress success always leads with the controlled header
[Block bN content — N item(s)](decompress-shared.ts:246/442/597) before any embedded restored body; the compress fingerprint excerpt starts on line 2. So judging line 1 cannot misread a success either. - acp_status unification is sound:
handleAcpStatus(src/acp-status.ts) has exactly two return paths, bothtoolOk; zero toolFail/throw in the file — there is no in-text failure shape to preserve, so dropping its all-lines special case loses nothing (and fixes 📊→❌ on report bodies mentioning keywords). - Strip side is icon-agnostic:
MARKER_LINE(src/loop/tag-echo-filter.ts) matches\p{So} [ACP]for ANY symbol; anchors.ts:16 cites both shapes as prose examples only; golden contracts pin no icon+keyword combo → no mis-strip, no downstream dependency on the old judgment. - Control flow untouched by the image-tool wording change: all loop FAILED-scans are name-gated to compress/decompress/absorb (src/loop/core.ts:1461/1482/1572/1687/1694); nothing scans
acp_read_original_imageresults. Display-only, as disclosed. - Tests have teeth and cover both directions (#3617): the real
applyRangessuccess case asserts the keyword actually sits in a NON-first line (so the test would go blind if the fixture drifted); the unit matrix covers success-keeps-icon ×4 and failure-stays-❌ ×6 incl. the exception shape; mirror-defect cases assert[… FAILED: …]+ preserved guidance substrings; strip-compat asserts removal by shape for both icons. - CI on head 655a3a3: mirror cache shows 30 checks, 0 failed, 0 pending (15 success / 15 skipped).
Existing-behavior audit (touched paths)
| Behavior | Verdict |
|---|---|
| Failure marker renders ❌ (all tools + exception path) | preserved — keyword always on L1 |
| Success marker renders tool icon | preserved; false-❌ on keyword-mentioning embedded content eliminated (the fix) |
| Marker stripping from replayed history | unchanged — regex is icon-agnostic |
visibilityMarkers tri-state gating / dedup (seenMarkers) |
untouched |
| Model-visible text of acp_read_original_image failures | INTENTIONAL change, disclosed in PR body: acp_read_original_image: <msg> → [acp_read_original_image FAILED: <msg>] |
No-keyword failures ([Unknown proxy tool: X], rules-feature validation) render tool icon not ❌ |
pre-existing, unchanged by this PR — noted, not a regression |
No fail-fast→swallow, no threshold/timing/output-format drift beyond the two disclosed items.
结构化八问
- 是什么问题:成功的压缩/decompress/search/acp_status,只要回执第 2 行起的内嵌模型内容(摘要摘录、恢复正文、证据摘录、块主题)提到 FAILED / not found / is required,确认标记就画成 ❌,与成功文字自相矛盾。
- 什么原因导致:buildVisibilityMarker 拿回执全文做状态分类;而全仓回执契约是首个非空行即权威状态行(#1029 注释文档化),第 2 行起是模型自撰内容——拿内容当状态是错层。
- 影响范围与严重程度:纯展示层;visibilityMarkers 默认可见的车道(pi/opencode 等)在特定条件下图标画错,Hermes 生产 false 不可见;控制流不受影响。p3。
- 怎么修复的:判定只看首个非空行(与 #5384 同原则);acp_status 经核实无文本内失败形态,统一进同一规则;同机制镜像缺陷(image 工具三条失败回执无关键字→失败画 📦)一并对齐到
[…] FAILED: …约定。 - 是否有回归问题:逐项审过——全部真实失败回执关键字都在首行(仍 ❌);剥离正则与图标无关;控制流扫描均 name-gated 不碰该工具;既有 ❌ 钉住测试在新判定下全部成立(CI 绿)。无 fail-fast 变吞错、无阈值/时序漂移。
- 是否破坏缓存:不涉及。
- 是否改了设计方向:不涉及,收敛于既有「状态行为准」契约。
- 是否引入新配置:不涉及。
收工判定:可合并(人工 merge)。
(ai: vllm-qwen/qwen3.8-27b) Review 完成:判定 APPROVE —— 独立核验了全部失败回执产出点(关键字均在首行)、acp_status 无文本内失败形态、剥离正则与图标无关、控制流扫描均 name-gated 不碰 image 工具;测试双向有牙(#3617);CI head 655a3a3 全绿(30 checks,0 failed,镜像缓存读取)。无 kernel/ 改动、无新配置、行为变更已在 PR 正文披露。GitHub 不允许 approve 自己的 PR,故以 COMMENT 态评审发出(https://github.com/ranxianglei/billion-context/pull/5388#pullrequestreview-5724980308),可人工合并。 |
…l receipt (#5389) Review follow-up for this PR's first-line-only marker judgment: executeRule's multi-operation refusal was the one reachable toolFail site whose first line carries no keyword, so a real refusal renders the tool icon instead of the crossed-out one under either judgment scheme. Prefix it with the [acp_rule FAILED: ...] receipt convention (same shape as the image-rescale receipts fixed here); update the exact-string constant in tests/rules.test.ts.
|
(ai: vllm-qwen/qwen3.8-27b) Reviewed this against the live branch (head 655a3a3) rather than from the description:
Composition check: #5384 + this PR merge cleanly together and pass 46/46 across plugin-protocol + marker + rules suites on the composed tree — the two halves are independent and merge order is free. |
(ai: vllm-qwen/qwen3.8-27b) Follow-up 三项逐条处置完毕:
CI 状态(final head 判定维持 APPROVE(GitHub 禁止 approve 自己的 PR,完整审核以 COMMENT 态评审在档:pull/5388#pullrequestreview-5724980308)。rerun 转绿后即可人工合并。 |
The confirmation-marker icon was chosen by scanning receipt TEXT for FAILED / "not found" / "is required" — a heuristic over model-influenced bytes. Success receipts embed model-authored content (summary fingerprint excerpts, restored history, evidence snippets, report topics) where those words appear as ordinary prose, and some failure wordings carry no keyword at all ([Compression REFUSED: …], pre-fix acp_read_original_image). The judgment is now protocolized: the executor's structured outcome (#1875 ProxyToolResult.outcome) is authoritative — failure/refused → ❌, applied/partial/success → the tool icon — threaded through every marker call site (loop/core.ts streaming + re-request paths, all five wire adapters' emitMarker incl. commandcode, the responses lane incl. its exception path). Receipt text is scanned only as a fallback when outcome is absent (first non-empty line only; no executor today omits it). Closes #5387
Closes #5387
What
buildVisibilityMarker(src/loop/core.ts) chose the ❌/tool icon by scanning every non-empty line of a tool receipt forFAILED/not found/is required. But success receipts embed model-authored content from line 2 onward (the compress summary fingerprint excerptsummaryFingerprintLine, decompress's restored history, search evidence snippets, acp_status block topics). Whenever that content merely mentions a keyword, a successful compress rendered as:Icon contradicts text. Display layer only — control flow never used this path (the #5384 classifier is a separate function that already judges line 1).
Fix — protocolized judgment (owner directive 2026-11-11)
The recurring class ("success/failure misjudged from receipt text") should not be patched with another text heuristic. The executors already return a structured outcome (#1875
ProxyToolResult.outcome: compress tri-valuedapplied/partial/refused, every other toolsuccess/failure), and every marker call site can reach it — so the judgment is now protocolized:failure/refused→ ❌ ·applied/partial/success→ the tool icon.toolOk/toolFail/compressResult); the fallback is defense for a future executor that forgets to set it. No dual track: each call site has exactly one deterministic judgment source.Call-site inventory (all threaded; no legacy path left without the outcome):
src/loop/core.tsstreaming emit +streamedMarkersexecuteProxyToolAsyncresult objectsrc/loop/core.tsre-requestcoreMessagesmarkersproxyResultsentries (carry the outcome from the same execution)emitMarker(google / anthropic / openai / responses / commandcode)src/compress-loop-responses.tssurfaceProxyJson + re-request itemstoolResult.outcome; the exception path explicitly stampsoutcome="failure"What the protocolization catches that NO text scheme can: keyword-less failure receipts (pre-fix
acp_read_original_image) and the[Compression REFUSED: …]refusal whose wording contains noFAILEDat all (rendered a SUCCESS icon under every prior scheme).Mirror defect fixed in the same PR:
acp_read_original_image's three failure receipts now follow the[acp_read_original_image FAILED: …]convention (model-visible wording for other consumers; the icon itself is now driven byoutcome="failure").Behavior changes (old → new)
[Compression REFUSED: …], gate refusals): 📦 (wrong — no keyword in the text) → ❌. Keyword-less failures (acp_read_original_image): 📦 (wrong) → ❌. GenuineFAILEDfailures: unchanged ❌.acp_read_original_imagefailure receipt wording:acp_read_original_image: <msg>→[acp_read_original_image FAILED: <msg>]. Model-visible text in plugin mode changes; no control-flow consumer scans this tool's result for keywords (all loop FAILED-scans are name-gated to compress/decompress/absorb).<icon> [ACP] <first line>text; strip/replay contracts unchanged —MARKER_LINE(src/loop/tag-echo-filter.ts:409) matches<So> [ACP] …regardless of icon, and the anchors.ts shape convention + golden contracts do not pin icon+keyword combos.Adjacent control-flow text scans (
anyCompressFailedin loop/core.ts, retry/recovery classification) are deliberately untouched — that is #5384's territory.Tests
Updated
tests/issue5389-marker-icon-first-line.test.ts(8 tests, both directions per #3617 gate discipline):applyRangessuccess whose summary containsFAILED(fingerprint line carries it on a non-first line — asserted as test teeth) → 📦 viaoutcome="applied";[Compression REFUSED: …]→ ❌ with the outcome but 📦 without it (proof of the hole every text scheme had); partial → 📦;[… FAILED: …]+outcome="failure"+ ❌, guidance substrings preserved;Targeted local suites green (209 tests across 18 files) +
npm run typecheckclean; full-suite verdict = remote CI on this head.No config surface changes. No
kernel/changes.