Repository navigation
fix: propagate compress outcome/blocksCreated through host forwarding lanes (#2752) - #2782
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3125-pr.2782.0af8b23This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2782.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… lanes (#2752) The endpoint already reports machine-readable outcome/blocksCreated (#1875), but both forwarders collapsed it to {text, failed}: a partial fold rendered identically to a full apply on every host lane. - agent/shared.ts + mcp.ts: parse outcome/blocksCreated defensively (known enum values / non-negative integers only; garbage degrades to absent); append one explicit PARTIAL note line to text ONLY when outcome is partial — applied/refused/failure envelopes keep their exact historical bytes - mcp shim: expose the state as MCP structuredContent alongside content (additive spec field; older clients ignore it); isError unchanged - pi lane: ride pi's details metadata channel (persisted with the session, not sent to the LLM) on both success and error branches - string-only lanes (dsh/opencode V1/V2/acp-command) need no change: they read out.text, which now carries the partial marker
e5da77b to
2ab8530
Compare
[bot] 🏷 合前验证完成(代码审查 + CI 诊断 + 修复已推送)。CI 正在新 head 验证了什么① 原 issue 方向(#2752):成立。#1875/PR#2116 让 endpoint 返回机器可读 ② 回归清点(diff 触碰路径的既有行为,逐项):
③ 代码审查:防御式解析正确——仅已知枚举值/有限非负整数存活,垃圾值降级为 absent,不从脏数据推断新行为; ④ 测试有效性:有牙。22 个用例用真实 HTTP canned proxy 驱动真实转发路径(不是 mock 被测函数);malformed 矩阵覆盖 outcome ⑤ diff 整洁度:5 个文件全部与本 PR 目的相关;无空行/重排噪音;无 lockfile churn(本地 npm install 产生的 package-lock.json 漂移已还原,未入提交)。 CI 红了的原因(已诊断并修掉)
已推送到 PR 分支的两个动作:
rebase 后 head 的本地定向验证:unused-export gate clean;#2752 套件 22/22 绿;typecheck 干净。全局回归交 CI(正在跑)。 结构化八问
判定代码面已就绪:rebase 至最新 master + guard 修复后,本地定向验证全绿。等 CI 在新 head |
[bot] 🏷 CI 进展更新:guard 全绿(含修好的 unused-exports),ubuntu 两条 test leg(22/24)全绿;windows-latest 两条 test leg(22/24)红。 初步排查(平台托管的 check 不暴露日志,API 无 output/logs_url,以下为代码侧证据):
已推空提交 |
[bot] 🏷 CI 最终结论(拿到日志实证了):windows 红腿与本 PR 无关——是 master 新 storage proof 套件在 Windows 上的环境性 flake。 证据(下载了两轮失败 leg 的完整 Actions 日志)两轮 windows 失败均为 6359 tests / 6336 pass / 1 fail / 22 skip,唯一失败都在
同一失效域(Windows 文件锁撞上 cleanup),实例不同、非确定性——与今日刚合入的 54f21d3( 本 PR 的 22 个新用例在 Windows runner 上全部通过(四个 suite 逐个 ✔,含 spawn 真 shim 的 stdio wire 级测试);ubuntu ×2 全绿;其余 24 checks(guards + e2e lanes)两轮全绿。 处置
判定代码面无回归、无缓存/配置/wire 上游变更(八问见上条回复),CI 唯一红灯为无关环境性 flake 且有日志实证。可合:按 §7.4 宿主可见回执形状变更须人工合并,请自行合并 #2782 ;若分支保护要求 CI 形式全绿,点一次 re-run failed jobs 即可(或等 #2799 修复后自然转绿)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.316-master.467b0f6 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…2816) tests/issue2752-forward-partial-outcome.test.ts (added by c81be81, merged via ranxianglei#2782) spawns the real MCP shim over stdio but was never registered in the ranxianglei#2816 tripwire, so every test job died at startup before running a single test since 467b0f6. Concurrency review for c=4: all HTTP servers bind listen(0) dynamic ports; the spawned shim is killed in afterEach; BILI_MCP_PROXY/BILI_CONVERSATION_ID are passed in the child env at spawn time; src/mcp.ts itself binds no port and writes no state. Registered after review per the tripwire contract.
…, reds every PR test job)
… events (#2901) #2637's fail-fast tiering gated version/kernel/pi-subagents/lane-guard with 'if: pull_request' on the assumption that skipped needs count as satisfied. That is not what GitHub Actions does: a needed job skipped via if blocks its dependents, so since bc6e327 every master push, release-branch push and workflow_dispatch showed test+static-gates = skipped — master's own CI never ran the suite (the blind spot through which #2782's unregistered spawner shipped undetected; #2896/#2901). Remove the four event gates so all eight needs run on every event. The guards are inert by construction on non-PR events: their checks are three-dot diffs against origin/master (empty on a push to master), and version-guard/kernel-guard fall back from GITHUB_HEAD_REF to GITHUB_REF so *_release-v*, bugfix-release/* and *_release-kernel-v* branches keep their exemptions. PR flow is unchanged (GITHUB_HEAD_REF takes precedence). Behavior change: non-PR runs execute the full test + static-gates matrix again (pre-#2637 behavior restored) plus four ~10s zero-dep guard jobs.
… events (#2901) #2637's fail-fast tiering gated version/kernel/pi-subagents/lane-guard with 'if: pull_request' on the assumption that skipped needs count as satisfied. That is not what GitHub Actions does: a needed job skipped via if blocks its dependents, so since bc6e327 every master push, release-branch push and workflow_dispatch showed test+static-gates = skipped — master's own CI never ran the suite (the blind spot through which #2782's unregistered spawner shipped undetected; #2896/#2901). Remove the four event gates so all eight needs run on every event. The guards are inert by construction on non-PR events: their checks are three-dot diffs against origin/master (empty on a push to master), and version-guard/kernel-guard fall back from GITHUB_HEAD_REF to GITHUB_REF so *_release-v*, bugfix-release/* and *_release-kernel-v* branches keep their exemptions. PR flow is unchanged (GITHUB_HEAD_REF takes precedence). Behavior change: non-PR runs execute the full test + static-gates matrix again (pre-#2637 behavior restored) plus four ~10s zero-dep guard jobs.
Closes #2752
问题
#1875/PR #2116 让 endpoint 返回机器可读的
outcome/blocksCreated,但两个转发器(src/agent/shared.ts与src/mcp.ts各自的forwardTool)把它压成{text, failed}:partial与applied在宿主侧形状完全相同,模型与分析工具只能靠解析自然语言区分「全部应用」和「部分应用」。大回执里 partial 很容易被读成完整完成。修法(机制层面)
outcome(仅接受已知枚举值)与blocksCreated(仅非负整数),垃圾值降级为 absent——旧 envelope 保持原有形状,不从脏数据推断新行为。outcome === "partial"时在 text 末尾追加一行[acp-result: PARTIAL — N block(s) created; some requested range(s) were NOT folded. Retry ONLY the failed range(s) listed above; do not re-fold the ranges that were applied.]。applied/refused/failure envelope 逐字节不变(有回归测试钉住)。字符串型通道(dsh-native/dsh-acp/opencode V1/V2/acp-command)无需改码——它们读out.text,标记自动到位。structuredContent字段({outcome?, blocksCreated?},仅在字段存在时发出);isError语义不变。details元数据通道(session-manager.d.ts:91 官方注释:"Use details for extension-specific metadata (not sent to LLM)")——成功与失败分支都携带,分析工具可分类每一次调用;旧 pi 宿主忽略未知字段。行为变更披露(old → new)
[Compressed … → N block(s), … saved.]+ per-range Errors/Skipped[acp-result: PARTIAL …]{content, isError}structuredContent(spec 字段,老客户端忽略)details:{outcome?,blocksCreated?}(不发给 LLM)不改变
ok传输语义、不回滚已应用块、不改成整批原子提交、不引入新的成功推断(blocksCreated == 请求范围数不作为判据;refold 场景两者不等价)。幂等/重叠跳过(refused with reason)继续走 isError 且 reason 保留在正文。config surface
无新增配置项/env/CLI flag。无 kernel/ 触碰。无版本 bump。
测试
新增
tests/issue2752-forward-partial-outcome.test.ts(22 个用例,真实共享转发路径):定向验证全绿:#2752 套件 22/22;issue1875+issue2204+host-native-caller 29/29;plugin-agent 69/69;mcp-native-thread(真 shim stdio e2e)8/8;typecheck 干净;build 通过。全局回归交 CI。