Repository navigation
fix: pi/omp tool guardrails are configurable; bash-timeout injection off by default - #3366
Conversation
…t injection off by default #3066 wired the bcp guardrails (50KB output cap, repetition loop-breaker, 60s bash-timeout injection) straight into the pi/omp plugin bundles with hardcoded defaults and no way to turn them off: GuardrailOptions existed but the single call site passed nothing. The bash-timeout injection is a behavior change pi users cannot expect — pi's bash tool schema declares timeout an optional per-call override with no host-side default, so silently injecting 60s killed legitimate long runs (builds, installs, test suites) with no knob to recover. Output cap and repetition breaker stay on by default (bounded, reversible, and they annotate rather than kill), but are now configurable. All three now resolve env > config file > default through knobs.ts, with a guardrails.{bashTimeout,maxOutputBytes,repetition} config group, seeds in website/config-reference, and en/zh CONFIGURATION tables: - BILI_GUARDRAIL_BASH_TIMEOUT / guardrails.bashTimeout: unset = no injection (new default); N = inject N seconds when the call omits timeout - BILI_GUARDRAIL_MAX_OUTPUT_BYTES / guardrails.maxOutputBytes: 50000 default, 0 disables the cap - BILI_GUARDRAIL_REPETITION / guardrails.repetition: true default The default flip on bashTimeout is deliberate and flagged for owner review — availability over performance per AGENTS.md 7.3.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3991-pr.3366.686e7a2This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3366.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重结论查重: 不重复。 检索 open+closed issue/PR("guardrail"、"bash timeout"):仅历史相关项——#3088(工具守卫从 bcp 移植)、#3170–#3174(guardrail handler 测试回归修复)、bcp 侧 #421/#426(50KB 上限调整);无其他「守卫无开关 / bash 超时注入」在途条目。本 PR 是 #3331 区间审查 D-1 的唯一修复项(#3361/#3368/#3357 分别是同批的 A-1/F-1/E-1,机制互不相干)。 初审进展(方向关已过,发现一个 CI 红)
|
The guardrails entries were hand-edited into CONFIGURATION.md/zh-CN.md and website/config-reference/process.yaml without running tools/gen-config-docs.mjs generate — so the committed md drifted from the generator output (backticks in one description, env-table row order/defaults) and website/main.js + website/docs/index.html never got the new tt.guardrails entries at all. This commit is the generator's own output for the same seed: no content change.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 终审结论:可合并(默认值翻转请 owner 拍板)CI 证据(新 head docs-sync 处理说明(透明化):该红是本 issue 早前一轮处理时已在本分支补了独立 commit 结构化八问
行为变更清单(有意,合并前请 owner 确认)
测试有效性新增断言有牙:「undefined=不注入」直接钉死本次回归(谁再把内置兜底加回来必挂);「配置 90 注入 90」「显式 600 不被覆盖」钉住两边界;precedence 测试覆盖三键的默认/文件层/env 覆盖/0=off 全组合。被替换的旧测试钉的是被有意废弃的行为,替换正确。一个已知取舍:pi.ts 工厂那一行胶水(createBiliPlugin→三个 knob 函数)没有工厂级单测(mock 接线测试测的是 判定:代码、文档、测试、CI 四关全过,diff 干净(9 文件全为目的相关 + 独立标注的 docs 修复 commit),可合并;唯一待办是 owner 对 bashTimeout 默认翻转点头。 |
… unsupervised bash hung pi sessions for a day) Owner feedback on #3366: the 60s injection was deliberate (#3066) — an unsupervised bash call could hang a pi session for a whole day, and the host schema provides no default. Default OFF was the wrong call: it traded a rare, visible, silent work-loss failure (killed long runs) for a common one (dead sessions) and unshipped an intentional protection. - guardrailBashTimeout(): env > config > 60 (was: > undefined). 0 or negative still disables injection (pi-native), N tunes seconds. - The default lives ONLY in knobs — wireToolGuardrails stays pass-through (undefined = no injection) so BILI_GUARDRAIL_BASH_TIMEOUT=0 disables end-to-end; a re-default inside the guardrail would silently override the explicit off. - Docs/comments updated (CONFIGURATION.md, zh-CN, process.yaml, config.ts, pi.ts, tool-guardrails.ts header): state the owner intent and the 0-out. - Tests: default-60 + 0-disables asserted both at the knob layer and through the wire seam; pass-through test keeps the no-re-default contract pinned. tool-guardrails-pi 40/40, knobs-config-precedence 14/14, tsc clean.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.489-master.95013a5 # this exact build
npm install -g billion-context@master # always the newest merged build
|
ai: zhipuai-lb/glm-5.3
什么坏了(#3331 审查 D-1)
pi/omp 插件的工具守卫(
wireToolGuardrails,#3066 从 billion-context-pi 迁移)是硬编码无开关:bash 60s 超时注入、工具输出 50KB 截断、相同调用重复 5 次熔断,三个行为全部没有旋钮——想关任何一个只能改代码。修复:三个旋钮,默认值不变
BILI_GUARDRAIL_BASH_TIMEOUT/BILI_GUARDRAIL_MAX_OUTPUT_BYTES/BILI_GUARDRAIL_REPETITION(env > config 文件guardrails.*> 默认):guardrails.bashTimeoutguardrails.maxOutputBytesguardrails.repetitionowner 反馈后已把默认改回 60:最初版本曾默认不注入(理由:pi schema 本身无宿主默认、静默注入会杀合法长任务),但 #3066 的注入是有意为之的防挂死防护,默认关闭等于下架了它。现在默认行为与 #3066 完全一致,只是从此可以一行配置关掉/调参——这才是 D-1 真正缺的东西(kill switch)。
实现要点:60 的默认值只放在
knobs.ts的guardrailBashTimeout(),wireToolGuardrails保持纯透传(undefined=不注入)——否则=0映射成 undefined 后又会被内部兜底改回 60,显式关闭就失效了。测试同时钉住这两层契约。测试
tests/tool-guardrails-pi.test.ts40/40(新增:透传契约、knob 默认 60、0 端到端关闭、注入/不覆盖显式 timeout)tests/knobs-config-precedence.test.ts14/14(env > file > 默认 三层优先级)来自 #3331 区间审查(D-1)。