You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[bot] 🏷 Confirmed — this is the same root cause as billion-context-pi#255, and a duplicate of the in-repo issue #359.
Root cause: the pi plugin's /acp command (src/agent/pi.ts) renders the status panel through ctx.ui.notify(). Web hosts like agegr/pi-web render notify() as a transient toast by design — it never lands in the session transcript. pi-web does render custom_message session entries persistently, so the fix direction is to emit a persistent custom_message instead.
A fix already exists: PR #360 (opened against #359). It's a two-part change, because a plugin-only port is not safe in proxy mode:
Plugin (src/agent/pi.ts): /acp emits pi.sendMessage({ customType: "bili-acp-status", content, display: true }) when available, falling back to ctx.ui.notify() for older pi.
Proxy (src/acp-panel.ts + the three prepare paths): strips the panel user-message from the request before *ToCore, so it never enters the compression state / recent zone and is never forwarded to the model. In proxy mode pi's convertToLlm projects every custom message as a plain user message and drops the customType, so the panel would otherwise leak into the model's context every turn — the exact interference the extension-mode fix avoids.
Status: PR #360 was cut against an older master (pre-#377, which reworked src/server.ts). I just rebased it onto current master — clean, no conflicts. Running typecheck / test / build now; I'll report back with the green result and the PR link.
Note: I can't merge it myself (human-only), so once it's green it'll be ready for you to merge.
Plugin (src/agent/pi.ts): /acp emits pi.sendMessage({ customType: "bili-acp-status", content, display: true }) → a persistent transcript entry in TUI + pi-web, with ctx.ui.notify() fallback for older pi.
Proxy (src/acp-panel.ts + prepareAnthropic/prepareOpenai/prepareResponses): strips the panel user-message from the request before*ToCore, so it never enters the compression state / recent zone and is never forwarded to the model. This part is required in proxy mode, where pi's convertToLlm projects the custom message as a plain user message and drops the customType — without it every /acp panel would leak into the model's context.
PR:#360 — now mergeable (no conflicts). It Closes #359, which is the in-repo home for this (and #430). I can't merge it (human-only) — it's ready for you whenever.
[bot] 🏷 CI is now fully green on the rebased PR #360 — all 4 test matrix jobs (ubuntu/windows × node 22/24) passed, plus version-guard and build-artifact. The PR is mergeable with no conflicts and ready for you to merge whenever. It Closes #359 (the in-repo home for this, and for #430).
Activity
ranxianglei commentedon Sep 1, 2026
[bot] 🏷 Confirmed — this is the same root cause as billion-context-pi#255, and a duplicate of the in-repo issue #359.
Root cause: the pi plugin's
/acpcommand (src/agent/pi.ts) renders the status panel throughctx.ui.notify(). Web hosts likeagegr/pi-webrendernotify()as a transient toast by design — it never lands in the session transcript. pi-web does rendercustom_messagesession entries persistently, so the fix direction is to emit a persistentcustom_messageinstead.A fix already exists: PR #360 (opened against #359). It's a two-part change, because a plugin-only port is not safe in proxy mode:
src/agent/pi.ts):/acpemitspi.sendMessage({ customType: "bili-acp-status", content, display: true })when available, falling back toctx.ui.notify()for older pi.src/acp-panel.ts+ the three prepare paths): strips the panel user-message from the request before*ToCore, so it never enters the compression state / recent zone and is never forwarded to the model. In proxy mode pi'sconvertToLlmprojects every custom message as a plain user message and drops thecustomType, so the panel would otherwise leak into the model's context every turn — the exact interference the extension-mode fix avoids.Status: PR #360 was cut against an older master (pre-#377, which reworked
src/server.ts). I just rebased it onto current master — clean, no conflicts. Running typecheck / test / build now; I'll report back with the green result and the PR link.Note: I can't merge it myself (human-only), so once it's green it'll be ready for you to merge.
ranxianglei commentedon Sep 1, 2026
[bot] 🏷 Done — PR #360 is rebased onto current master and ready to merge.
What I did
src/server.ts). I rebased its single commit onto current master — clean, no conflicts — and force-pushed to update the PR (head is nowe6e2da2).Pre-flight (all green, run on the rebased branch)
npm run typecheck— cleannpm test— 905 pass / 0 failnpm run build— successversion-guard+build-artifactgreen; the 4-platformtestmatrix is still running — I'll confirm when it lands.The fix (unchanged from PR #360, now current)
src/agent/pi.ts):/acpemitspi.sendMessage({ customType: "bili-acp-status", content, display: true })→ a persistent transcript entry in TUI + pi-web, withctx.ui.notify()fallback for older pi.src/acp-panel.ts+prepareAnthropic/prepareOpenai/prepareResponses): strips the panel user-message from the request before*ToCore, so it never enters the compression state / recent zone and is never forwarded to the model. This part is required in proxy mode, where pi'sconvertToLlmprojects the custom message as a plain user message and drops thecustomType— without it every/acppanel would leak into the model's context.PR: #360 — now
mergeable(no conflicts). ItCloses #359, which is the in-repo home for this (and #430). I can't merge it (human-only) — it's ready for you whenever.ranxianglei commentedon Sep 1, 2026
[bot] 🏷 CI is now fully green on the rebased PR #360 — all 4
testmatrix jobs (ubuntu/windows × node 22/24) passed, plusversion-guardandbuild-artifact. The PR ismergeablewith no conflicts and ready for you to merge whenever. ItCloses #359(the in-repo home for this, and for #430).ranxianglei commentedon Sep 1, 2026
代码评审:PR #360
结论:可合并——但建议先收紧一个真实误剥离 bug,或记录跟进 issue。
已验证 / 正确
node_modules/acp-kernel/dist/panel/index.js.map(kernel 构建 sourcemap),buildStatusPanel输出确以 U+256D 顶边框开头,标题行含ACP Context Analysis,与src/acp-panel.ts:12-14精确匹配。回支路src/agent/pi.ts:193的renderAcpStatus首行📊 ACP status,与PANEL_FALLBACK_HEADER一致。tests/acp-panel.test.ts通过buildStatusPanelfromacp-kernel/panel真实产出 panel,不拼手抄——将来 kernel 文案改动测试直接红。防漂移选型正确。src/server.ts)。strip 位于早返回/passthrough 判断之后、*ToCore(parsed)投影之前——正是日志的 "before projection"。Responses 侧排序normalize → sanitize → dropWhitespace → strip → responsesToCore,与 omp 无类型 wire 形态需求对齐。snapshotMessages(session, originalMessages)用投影后的msgs——快照同样剔除 panel,"UI-only" 语义落实。parsed由decodeRequestBody每请求独用,跨请求无泄漏;后续rebuilt = {...parsed, messages: rebuiltMessages, ...}用新 messages 替换旧引用。/acphandlertry { pi.sendMessage(...) return } catch {} notify(text, "info")覆盖老版 pi(无 sendMessage)与 pi-web sendMessage 抛错两种情形。sendMessage?:声明可选。splice(i,1):索引安全。messageText对非纯文本(image / tool_result / mixed)返回undefined,剔循环判text !== undefined && isAcpPanelText(text)——多模态与工具结果始终保留。一个真实 bug:panel 后接用户文本会被误剔
src/acp-panel.ts:17-24isAcpPanelText:判用
includes(PANEL_BOX_TITLE)——只要 trim 后开头是顶边框 U+256D,标题在文本中任意位置命中即 true。用户粘贴 panel 后追加提问内容,整条消息被剔除,从模型看和持久历史(snapshotMessages)双双消失,会话内不可恢复。回支startsWith(PANEL_FALLBACK_HEADER)同样漏洞。PR 自带测
isAcpPanelText('here is the panel:\n'+panel) === false守的是前缀情形(不以 U+256D 开头);后缀情形(panel 末尾拼用户提问)零守护。本 PR 之后
/acp写持面板进历史,用户从 pi-web 拷贝粘贴 panel 后再打追问是常规工作流。吃掉用户提问是真实后果。建议修法(任一种即可):
\n行尾。新增负测:
isAcpPanelText(panel + "\n\nmy follow-up question") === false。次要(非 blocker)
prepareResponsesCompact与prepareAnthropic的isAutoModeClassifier(parsed)早返回不走 strip。codex native-compact 与 claude-code auto-mode 分类这两路径现实中 client 不会发 panel(非/acpclient),非回归;但完整性缝隙建议在 strip 调用点加一行注释("skip compact/classifier passthrough — no client emits panel on these paths"),减少后续埋雷。messageText接受type: "output_text"part。剔循环已role === "user"守,投影不会见 user role 带 output_text——无害,建议加注释或直接 drop 该 type。src/agent/pi.tstry/catch 静吞 sendMessage 抛错。同文件其他 host-side catch 走console.error("bili-plugin(...) ..."),本处空catch {}风格不一致且未来不可诊——建议加一行console.error。issue #359好;如果将来用户报"消息消失",建议在 info 行再加长度 delta 或首尾片段,便于运线对账。测覆盖质量
10 个 acp-panel 单测 + 3 个 sendMessage/fallback 测——覆盖实。load-bearing 是
tests/acp-panel.test.ts用真buildStatusPanel构造 panel。如 finding 1,再加两负测。合并。bug 1 先在同一 PR 收紧,或单独开 issue 跟进——其余设计 sound。
🤖 Review by pi · model qwen3.8-27b · 本地
/tmp/billion-contextclone,PR 分支origin/2026-08-30_acp-panel-persistent-stripHEADe6e2da2。ranxianglei commentedon Sep 1, 2026
[bot] 🏷 已按 review 在同一 PR 收紧了那个真实 bug,并处理了几个次要项。新 head
3273a9c(amend 进原 commit +--force-with-lease推到 feature 分支)。Bug 1(panel 后接用户文本被误剔)— 已修
先纠正一个前提:我核对了
buildStatusPanel的真实输出,它不是一个整体边框盒子,而是 3 行头框(顶边框 U+256D + 标题行 + 底边框 U+2570)+ 一段可变正文(version / Context / Blocks / Tag visibility…)。关键事实:正文的最后一行恒定是Tag visibility: tags injected to LLM only (deep copy), not persisted in session, not shown in terminal.(kernel
panel/index.js:150无条件 push,永远是最后一行)。所以 box 的"结尾"锚点是这行 footer,不是底边框——你建议 #1 里"结尾为底 U+2570 边框"在真实 panel 上不成立,我按"或回支已知脚行"的意图落到了这行 footer 上。改成整段锚定(
src/acp-panel.ts):startsWith(U+256D) && includes(标题) && endsWith(footer)。贴完 panel 再追问 → 结尾变成用户文字而非 footer → 不再误剔。renderAcpStatus):首行精确等于📊 ACP status,且其余每行都是缩进字段行(两空格开头)。追加一行顶格文本即破坏匹配。新增负测(你点名的后缀情形):
isAcpPanelText(panel + "\n\nmy follow-up question") === false、panel + " and what about X?" === false、FALLBACK + "\nmy follow-up" === false,外加 fallback 容忍四周空白一个正测。已知取舍(透明说明):fallback 分支下,若用户在 panel 后追加的是缩进行(两空格开头),仍会被当作 panel 的一部分而误剔——极罕见边界;主路径(box)用精确 footer 锚定没有此问题,且 fallback 仅在老版 pi / status 拉取失败时兜底。
次要项
src/agent/pi.ts的sendMessagecatch 补了console.error,与同文件其他 host-side catch 一致(pi.ts 是 agent 侧,允许 console.error)。prepareAnthropic的 strip 调用点加一行注释,说明 classifier passthrough 与prepareResponsesCompact有意不走 strip(这些路径无 client 发 panel)。messageText可接受 type 里 drop——它只作用于role === "user",而output_text是 Responses 的 assistant 输出 part,user 消息不会带;万一出现,按"非纯文本"→ 保留也是安全方向。Pre-flight
typecheck 干净 ·
npm test907/907(新增 2 测)· build 成功。PR #360 现
mergeable: true(无冲突),CI 正在新 head 上跑。合并仍由你操作(我不 merge)。ranxianglei commentedon Sep 1, 2026
[bot] 🏷 CI 已全绿(新 head
3273a9c):test矩阵 4×(ubuntu/windows × node 22/24)+version-guard+build-artifact全 success。PR #360 现mergeable: true、检查通过,可合并。ranxianglei commentedon Sep 5, 2026
与 #359 重复(同缺陷同根因),关闭本 issue,跟踪统一在 #359。
现状核实(2026-09-05, master e3abc16):问题仍在——
src/agent/pi.ts:367/acp面板仍走ctx.ui.notify()→ web 宿主(pi-web)渲染为瞬时 toast,不进 transcript。上游 billion-context-pi#255 已修(PR #256:
pi.sendMessage({customType:"acp-status"})+entriesToCoreMessages过滤),但不可照搬到 proxy 模式:pi 的convertToLlm会把 custom message 投影为普通 user 消息上 wire,proxy 无法区分面板与真实用户消息——只改插件会把每次/acp的面板泄漏进模型上下文。已有修复 PR #360(两段式:插件 sendMessage + proxy 侧按面板签名剥离),但基于 2026-08-30 的 master,与 #535 落地后的
src/agent/pi.ts/src/server.ts大改严重冲突(mergeable_state: dirty),需要重做后重新评估。继续在 #359 跟踪。