Repository navigation
[PR] feat: pi lane — show the injected nudge text verbatim in the terminal when debug is on - #6151
Conversation
… debug is on
With the existing debug switch on (ACP_DEBUG=1 / config debug), every
compression nudge the proxy injects is mirrored into the pi transcript
as a transcript-only CustomEntry: [bili-nudge] <protocol>/<kind>
tier=… reason=… label + the final wire text the model actually read
that turn. Human-only: pi's session-context build ignores
type:"custom", so the view never enters LLM context or re-sent history.
Mechanism: the prepare stage (anthropic + openai lanes — the two pi
reaches) emits the post-wrapper text into a tiny in-process pub/sub
(src/nudge-debug.ts); in the default INLINE pi mode the extension is
the same bundle/process and mirrors each event via
pi.appendEntry("bili-nudge") + registerEntryRenderer. Emitters are
listener-less no-ops, so the prepare sites stay config-plumbing-free;
the consumer gate is a new debugEnabled() knob (src/knobs.ts) mirroring
Options.debug exactly (env ACP_DEBUG > file debug > false).
No new config fields / env vars / CLI flags — rides the existing debug
switch (owner decision; a draft nudgeDebug field from the first draft
was removed before the PR). kernel/ and pi-subagents/ untouched.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9338-pr.6151.e19b3faThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6151.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 open+closed 全量扫过,本主题(debug 开关下把注入的 nudge 原文逐字镜像进 pi 转录)无其他在途 PR/issue;仓库里其他 nudge 相关条目(可配置升级行、nudge surface 的 ref pair 打印等)机制与症状都不同。 当前状态(live 核实过):GitHub #6151 open,head 标签(本环境 label API 未实现,先在此记录判定):enhancement / pi / scope/wiring / p3——纯观测面新功能,默认全关零行为变化。 审核进行中,先报方向性结论:方案成立(进程内总线 + pi CustomEntry 人可见/模型不可见,复用现有 debug 开关不新增配置面,发射端 no-op 不碰配置管线),测试有牙(两条 wire 的金标断言是「总线事件文本 === 实际发往上游的尾随 user 消息」逐字节相等,wiring gate 双向断言齐)。发现 3 个小问题,按 review 纪律直接在 PR 分支上补 commit 修掉(独立标注):
推完看 CI 重跑,随后给完整八问结论。 |
…eal docs NudgeDebugKind is referenced only inside this file (by NudgeDebugEvent.kind), so the gate classifies the export INTERNAL_ONLY — drop the leading export per the gate's own remedy. Fixes the failed static gate on head 141cfbc. Also correct the header comment: the spawn/attach inertness limit is documented in docs/clients.md en+zh (Pi section), not docs/configuration.md.
Options.debug (src/config.ts) resolves as (env.ACP_DEBUG ?? (fileConfig.debug ? "1" : "0")) === "1". The first pass used .debug === true on the file tier, which diverges from the main debug surface for a non-boolean truthy file value. Use the literal same expression so the two surfaces cannot disagree on any input.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 审核完成,发现的三处小问题已在 PR 分支直接修掉并推送(commit 当前状态(live 核实):GitHub #6151 open、mergeable;新一轮 CI 全部跑完——52 个 check:38 success / 14 skipped(路径过滤不适用)/ 0 failed,包括之前红的 八问:
测试有效性:tests/nudge-debug.test.ts 断言有牙——wiring gate 双向(#3617 纪律)、两条 wire 的字节相等金标、turn-1 负向断言、坏监听者隔离;端口 listen(0) 无环境运气。 判定:可合(合并操作在你)。 |
- custom type acp-nudge (was bili-nudge); compact one-liner [ACP nudge] <pct>% · T<tier>[ EMERGENCY][ · top range a–b] - the compact record line is ALWAYS on (no debug config needed): one per user turn, persistent in the session file, pi-visible / model-invisible (type:custom never enters LLM context) - the verbatim wire text becomes a transient terminal notification (debug switch on: ACP_DEBUG / config debug), shown once per turn after the model answered — never persisted - dedup per (session, turn) via a stable key of the last text user message (anthropic tool_result user messages skipped) - bus events carry the record metadata (pct/tier/emergency/topRange/ turnKey); emitters compute it from the PRE-nudge array
…otify only Per owner review: the always-on compact record line (acp-nudge CustomEntry, billion-context-pi #326 parity) is unnecessary — the transient verbatim terminal notification (debug switch on) is the whole point of this feature. - src/agent/pi.ts: no more registerEntryRenderer/appendEntry wiring; one after_provider_response hook shows the verbatim wire text once per user turn via ctx.ui.notify (consumes+clears the pending event, turnKey dedup) - src/nudge-debug.ts: drop ACP_NUDGE_CUSTOM_TYPE + formatNudgeRecord - tests: wiring test asserts the pi host carries exactly one extra after_provider_response subscription vs omp (the #3248 ack channel subscribes both lanes); formatNudgeRecord test removed - docs en+zh, architecture.md: transient notify only, never persisted
(ai: vllm-qwen/qwen3.8-27b) Re-verified the live check state first (auto-fix lane rule): the reported red check ( What resolved it: commit Verification detail: mirror cache showed 29/30 checks success/skipped with 结构化八问(中文)
收工判定:head |
# Conflicts: # src/server/prepare-anthropic.ts
[bot] (ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed. (Note: this lane's process was force-restarted twice for going quiet while waiting on CI — no work was lost; this run completed the resolution and verified the result live.) What I did:
Verification (live, this run): typecheck clean; PR suite 结构化八问(中文)
收工判定:冲突已解、 |
(ai: vllm-qwen/qwen3.8-27b) Verdict: APPROVE (head Independent re-review at the current head — the branch moved past the earlier review ( What I verified:
Non-blocking note (author, not a code issue): the PR body's "怎么实现的" / "模型永远看不到" / "局限" sections still describe the earlier persistent- 结构化八问(中文)
判定:可合(合并操作在 owner)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review complete — verdict: APPROVE / 可合 (head Independent end-to-end re-review at the current head — the branch moved past the earlier review through two author commits that changed the approach from a persistent Verified:
Outcome:
判定:可合(合并操作在 owner)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1220-master.301e1a5 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Master moved from 4a24c26 to 301e1a5 (PR ranxianglei#6151). Nine files: a nudge-debug bus that mirrors the exact wire nudge text to the pi lane's debug terminal (transient, never in LLM context), its knobs/debug wiring, docs, and the architecture map row for src/nudge-debug.ts. Two files overlap this branch. reference/architecture.md auto-merged: master added the nudge-debug.ts row and this branch adds the responses-system-sections.ts row that master's earlier ranxianglei#6922 batch left out, and both survive. src/server/prepare-openai.ts and src/server/prepare-anthropic.ts are master-only changes in the nudge delivery path; this branch does not touch them. The same merge also recalibrates the ranxianglei#2929 probe. That test pins which upstream request index carries the ephemeral nudge (PROXY_AT and FOLD_AT) so it can build the proxy-tool-then-compress shape, and those indices are sensitive to any per-turn prompt-surface change. ranxianglei#4521 added an armed-but-silent status line that shifted the schedule, and ranxianglei#6928 removed that line, shifting it back, which left the pinned index pointing at a request that no longer carries the nudge. Verified by bisect: the test is green on d1ff6ea and red from 4ccccab (the ranxianglei#6928 removal) onward, including pristine master 4a24c26 and 301e1a5. The fix does not pin a carrier index at all: it requires that SOME pre-fold request carried the nudge, which is the actual production precondition the probe has to materialize. Negative control: with injectNudge disabled the relaxed assertion still fails, so it keeps guarding the trigger. Verified on the merged tree: kernel build clean, tsc reports only the five pre-existing @deepseek-ai/cordis farm errors (identical on pristine master), all five gates green including architecture-docs, config docs regenerate with zero drift, and the key suites green (issue2929 1/0 three times, issue5175 66/0, tag-echo 79/0, issue2190-degen-close 32/0, nudge-debug 7/0).
Resolve 2 import conflicts in prepare-anthropic.ts / prepare-openai.ts: keep applyDecisionReasoningPolicy (this branch's ranxianglei#5030 decide-lane function) + add master's nudge-debug.js import (emitNudgeInjected, nudgeDebugMeta from ranxianglei#6151). Drop stripDecisionReasoningFields (not used in the merged body - replaced by applyDecisionReasoningPolicy). Verified locally: typecheck clean, build clean, 137/137 targeted decide-lane + nudge-debug tests pass.
做什么
pi 车道:debug 开关打开时,代理注入 nudge 的那一刻,终端以一次性临时通知显示逐字 wire 原文——模型当轮实际读到的那条临时尾随 user 消息,一字不差。
ACP_DEBUG=1或配置文件"debug": true),无新增 config 字段。怎么实现
src/nudge-debug.ts:进程内 pub/sub,prepare 阶段注入点(anthropic/openai wire)emit 最终 wire 文本 + 元信息(tier/pct/emergency/topRange/turnKey)。无监听者时是 no-op。src/agent/pi.ts:pi 扩展订阅总线,after_provider_response钩子(模型已回答)里ctx.ui.notify显示原文;turnKey 去重;消费后清空。测试
tests/nudge-debug.test.ts7 个:bus 单元、debugEnabled 开关语义(env 只认字面量 "1",与 Options.debug 一致)、turnKey(anthropic tool_result 尾巴不改变 key)、meta 计算、pi wiring(pi 宿主比 omp 恰好多 1 个 after_provider_response 订阅——Delta lane: native-mode clients send only deltas, server maintains full state + one-time fold, upstream receives snapsho | 增量车道:native 模式客户端只发增量,服务端全量维护+一次折叠,上游只收快照(#2926 的泛化) #3248 增量 ack 通道两车道都订)、两条 wire 的 e2e 逐字一致性(总线事件文本 === 实际发给上游的请求体末条 user 消息,字节级)。config surface
无新增字段——复用现有
debug开关(owner 定,初稿的 nudgeDebug 字段已移除)。