Repository navigation
[PR] Hermes lane: forward toolless structured-output requests verbatim instead of injecting ACP tools - #5090
ranxianglei wants to merge 13 commits into
Conversation
…injecting ACP tools (#5073) The Hermes native plugin routes model traffic through bili via inherited HTTP(S)_PROXY env vars; child processes (e.g. the Hindsight memory daemon) inherit those vars but never pass through the plugin's header middleware, so their toolless chat completions arrive unstamped -> proxy mode -> bili injects its six ACP tools next to response_format. Strict backends (PolyStrata) reject the tools+response_format pair with HTTP 400, failing every such call. A request with no tools that demands structured output (response_format json_object/json_schema, or Responses text.format) is a one-shot utility call, not an agent turn -- an agent turn always carries its action surface (#546). It now routes through the #388 verbatim side passthrough: nothing injected, the backend sees the clean toolless body it sent. The #546 rule still keeps any tool-carrying request a main turn and an explicit main persona still wins; toolless non-structured requests are unchanged. Also exclude these requests from restoreOutputBudget so their large max_tokens (e.g. 64000) cannot seed outputBudgetHighWater before the side-lane decision (#1897/#2500 class), and give the side-lane log line an honest reason label. Closes #5073
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10694-pr.5090.326548fThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5090.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 检索了 open+closed 的 issue/PR(structured output / 标签: 开始独立审核:已拉取分支 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 进度汇报(进程曾因长时间无输出被重启一次,工作未丢——分支已拉到本地 worktree,评审过半): 已完成
进行中
|
lane-guard (#2170 measure 5) fails when src/server/side-request.ts or the handle.ts lane region moves without a dedicated side-lane suite moving with it. The PR's new tests/issue5073-*.test.ts does not match the guard's suite list, and its handle.ts import of isStructuredOutputCall also tripped the pre-existing import-boundary allowlist in side-lane-invariants.test.ts (G) locally. - side-lane-truth-table.test.ts: row-driven pos/neg table for isStructuredOutputCall (both documented carriers, every veto) plus the isSideRequest interplay anchors (#546 tools veto, explicit main/title intent), following the TITLE_CARRIER_ROWS pattern. - side-lane-invariants.test.ts: add isStructuredOutputCall to the handle.ts import allowlist with its documented rationale (same category as the #2500/ #2503/#4438 entries: pure structural predicate, no threshold, no session state).
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复——本单是该 PR 的 CI 自动修复转发(lane-guard 红),非新问题报告;open/closed 中无同签名条目(同根因即本 PR 自身的套件配对缺失)。 红了什么:仅 根因(两层,同一机制):lane-guard(#2170 measure 5)要求 side-lane 判定逻辑( 修复(单 commit
验证:本地定向 5 个 side-lane 套件 70/70 绿(含本 PR 三条 e2e 车道);typecheck 干净;build 绿;lane-guard 脚本逻辑对新 head 本地复现 PASS。已推送,CI 新 head 八问:
结论:lane-guard 修复完成,新 head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 审核结论:可合(全量回归以新头 独立审核声明:未复用 issue 侧结论——diff 三文件对 master 逐行通读、触碰路径的既有行为逐项清点、lane-guard 失败本地复现并验证修复。查重与标签见首条回复(不重复;bug/hermes/scope/wiring/p2)。 结构化八问
测试有效性(④):断言有牙——单测 pos/neg 覆盖双载体×双类型+全部否决(含泄漏的 bili compress tool、bare-string、Gemini 越界);e2e 真起 proxy+mock upstream,断言线上 body 逐字(response_format/messages/max_tokens 未被改、tools 未注入)+ kernel state/stats/nudge baseline/high-water/请求计数全不变 + 双控制组证不过度降级。回归时抓得住,不是假测试。 diff 整洁度(⑤)/代码质量(⑤b):单一目的 diff,每行相关;命名达意、注释讲为什么、风格随文件、无死代码无新依赖——通过。 CI 配对守卫事件:原头 判定:可合 —— |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 补一条 CI 终态(镜像缓存对新头没刷新,单次只读拉取确认):merge ref 结论维持:可合,请 owner 合并。 |
…quest' (ci-fixes 002b5fa) into wt-5091-merge-guard-r1
(ai: vllm-qwen/qwen3.8-27b) 本轮 merge-guard behind 判定经核为误报:PR base == master@ |
Resolves the 3-way conflict on the side-lane surface: - handle.ts: union the side-request.js import (adds master's isClaudeCodeTitleRequest + isDshSingleShotSidecar alongside this PR's isStructuredOutputCall) and the sideLabel ternary (append the #5073 structured-output branch after master's #5656/#5135 branches). - side-lane-invariants.test.ts: union the (G) import allowlist (add isStructuredOutputCall) and the explanatory comment block.
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved and pushed. The PR branch What conflicted and how I resolved it — 2 files, 4 regions, all pure union merges (no logic change):
Verification: no conflict markers remain; all 13 imported symbols confirmed exported by Caveats (honest status):
八问(中文结论)
判定:合并冲突已解决并推送,PR 分支已与 master 同步;待 CI 在新 head |
Master advanced past the dc041dd merged earlier (web handoff rendering, anthropic trailing-system tails #5432/#5441, snapshot write lifecycle #6186, handoff-render #6260). Clean auto-merge — none of those commits touch the side-lane surface (handle.ts / side-request.ts / side-lane tests), so no conflicts and no logic change.
(ai: vllm-qwen/qwen3.8-27b) Re-synced the PR against the new This was a re-trigger, not a stale one — I verified live before touching anything:
What I did:
Notes (honest status):
八问(中文结论)
判定:PR 分支已与最新 |
[bot] (ai: vllm-qwen/qwen3.8-27b) 审核结论:可合 —— head 独立审核声明:未复用 issue 侧结论文本——本轮对当前 master 独立重读 5 文件 diff(2 产品代码文件 + 3 测试文件)、逐调用点清点触碰路径既有行为、核对重同步 merge 未引入逻辑变化。前轮「可合」出在旧头,CI 工程师两次重同步后 diff 内容与原意图一致,本轮在新头上重新验证。 结构化八问
测试有效性(④):断言有牙——truth-table 13 行钉新谓词双向(两载体×两类型全真;tools 否决/泄漏 bili compress 工具否决/裸串/非结构化 type/Gemini 越界/空 tools 全假)+ diff 整洁度(⑤)/代码质量(⑤b):5 文件 +435/-6,每行与 PR 目的相关;命名达意( CI 配对门禁:原头 lane-guard 红(#2170 要求 lane 逻辑变更必须伴随专用 side-lane 套件变更)已由配对提交 遗留一项(owner 裁决,非合并阻塞):#5074 是同一 #5073 的先达平行 PR,仍 open——保留哪个归 owner(floor 22/31/49 已三次报备);按先来后到 #5074 应保留、本 PR 让位,但关闭动作归 owner。 判定:可合 —— 请 owner 合并(或先裁决 #5074 去留,再合存活者)。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 审核已完成,完整八问审核结论已在 floor 57 贴出(本条为确认补发——前一条回复可能因缺少 🏷 前缀未被识别,内容不重复,以 floor 57 全文为准)。 结论:可合 —— head 遗留一项(owner 裁决,非合并阻塞):#5074 是同一 #5073 的先达平行 PR,仍 open——保留哪个归 owner(floor 22/31/49 已三次报备);按先来后到 #5074 应保留、本 PR 让位,但关闭动作归 owner。 请 owner 合并(或先裁决 #5074 去留,再合存活者)。 |
🔶 需要决策 This PR's merge conflict is no longer a mechanical text-union — What I verified live this run:
The two implementations are functionally equivalent for real traffic (a request carries either
What this means: Options:
Default if undecided: A — Applying the |
(ai: vllm-qwen/qwen3.8-27b) Post-restart check (the session was watchdog-restarted): state verified intact — worktree clean at PR head Still waiting on your A/B/C call (default rec: A — take |
Status (re-trigger, attempt 1/6): no change — the decision is still pending Re-verified live this run (nothing pushed, no branch change):
The decision (unchanged — full options at floor 65): A = take master's I'm stopping. This is a status re-confirmation, not a new decision request — the options are in floor 65. The auto-fix lane cannot resolve this without the owner's A/B/C (or a close of #5090). If re-triggered again before a decision, I'll only re-confirm if the state has actually changed (master's 八问
判定:阻塞于 owner 决策,本轮无动作(不推送、不改分支),等待 A/B/C 或关闭 #5090。 |
No change — this is my last re-confirmation; staying quiet going forward. Re-verified live (nothing pushed, no branch change): Per my note at floor 71, I will not keep re-posting on every re-trigger while the state is unchanged. The decision is yours: A / B / C (default rec A — take master's 八问
判定:阻塞于 owner 决策,本轮无动作(不推送、不改分支);状态未变,按 floor 71 承诺不再重复回帖,等待 A/B/C 或关闭 #5090。 |
Still pending — no change (liveness ping, honoring floor 74 stay-quiet). Re-triggered again (floors 76/77). No owner response to the decision request (floor 65, now pending ~3 days). Local refs show Per floor 74 I'm honoring my stay-quiet commitment — no action, no push, no branch change. The unblocking action is yours: A / B / C (default A) or close #5090. I will not post further on unchanged state. 八问
判定:阻塞于 owner 决策,本轮无动作(不推送、不改分支);状态未变,按 floor 74 承诺保持安静,等待 A/B/C 或关闭 #5090。 |
Still pending — no change (7th re-trigger; minimal liveness ping). No owner response since floor 65 (~3.5 days). Local refs: 八问(全部与上轮相同,未变)
判定:阻塞于 owner 决策,本轮无动作;状态未变,按 floor 74 承诺保持安静,等待 A/B/C 或关闭 #5090。 |
master independently landed the #5073 fix (isStructuredOutputCall + the handle.ts/side-request.ts wiring) via its own commit, plus #6548 (isResponsesServerToolSingleShot) and #6636 (isAudioOutputCall). The two isStructuredOutputCall implementations are functionally equivalent (both veto tools; both match response_format.type / text.format.type in {json_object, json_schema}). Conflict resolution (all in the side-lane surface): - src/server/handle.ts, src/server/side-request.ts: take master's version (the superset — it already carries the #5073 fix + #6548 + #6636). The PR's source edits were a redundant duplicate of what master already merged. - tests/side-lane-invariants.test.ts: take master's version (its allowlist already lists isStructuredOutputCall; a superset of the PR's 7-line add). - tests/side-lane-truth-table.test.ts: UNION — keep the PR's additive #5073 row table + 2 tests on top of master's #6880 purpose-state tests. - tests/issue5073-structured-output-side-request.test.ts: keep (PR's new dedicated regression file; master has no equivalent). Verified locally: typecheck clean, build OK, targeted tests (issue5073 + side-lane-truth-table + side-lane-invariants) 39/39 pass.
(ai: vllm-qwen/qwen3.8-27b) Merge-conflict resolved and pushed. The PR branch is now clean (no conflict) and ready for CI + human merge. What I did this run
|
…es test The 'negatives — every veto keeps the request on the main pipeline' test ended with a positive assertion (true), contradicting its own name; it belongs with the positives block above it. No semantic change — the assertion is identical, only relocated.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
REVIEW VERDICT: APPROVE / 可合 (posted as a comment because GitHub does not allow approving one's own PR — the token identity is the PR author).
APPROVE — the remaining diff is test-only and the assertions are correct against master.
State of the PR at head 9203230: the product fix described in the body (isStructuredOutputCall in src/server/side-request.ts:163, wired into isSideRequest after the #546 veto, imported/used at src/server/handle.ts:73/2459, plus the restoreOutputBudget skip) is already in master — it landed via the owner-driven #5074 union on 2026-11-13 plus the repair commit 6c818b3. The product code at this head is byte-identical to master, so merging changes zero product behavior; what this PR now delivers is the dedicated regression suite.
What the diff adds (2 files, +362/-1):
tests/issue5073-structured-output-side-request.test.ts(new, 325 lines): unit pos/neg for the predicate,isSideRequestinteraction pins (intent/#546/budget-heuristic interplay), theresolveSideLanelabel pin, and 3 e2e lanes — the fix direction plus control A (tool-carrying structured request stays a main turn, tools still injected) and control B (toolless non-structured 64K-budget request stays a main turn). The e2e also asserts the side request's 64000 budget never poisons the main session'soutputBudgetHighWaterand that main-turn continuation still works.tests/side-lane-truth-table.test.ts(+38/-1): 13-rowSTRUCTURED_OUTPUT_ROWStable + 2 interaction tests — the #2170 lane-guard pairing for the new predicate.
Verification done:
- Every assertion checked against master's implementation: the predicate's carrier/type/toolless semantics,
isSideRequestordering (structure after the #546 veto, before the budget heuristic), andresolveSideLane's reason string (sideIntent + sideLabel → reason=label) all match. - Coverage is genuinely additive over master's
tests/side-request-isolation.test.ts(which came from the #5074 union): the control lanes, the usage-baseline assertion, the main-turn-2 continuation check, and the extra unit rows are not in master. - CI on 9203230: 50 check runs = 37 success + 13 skipped, 0 failed.
- No
kernel/touch, no config/env surface, no wire-shape change.
Fixed on the spot: one positive assertion (responses carrier needs no top-level message array) was sitting as the last line of the test named "negatives — every veto keeps the request on the main pipeline", contradicting its own name; moved it into the positives block. Commit 6cb9147, no semantic change, both touched test files pass locally (23/23).
Verdict: mergeable. Merging this PR adds the #5073 regression coverage (fix + both controls) on top of the fix that is already shipping in master.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review of head 9203230 (2026-11-18): APPROVE / mergeable. What changed since the last review round: the head is now a merge commit syncing master (a259e0b) into the PR branch. The product fix this PR describes is already in master — it landed via the owner-driven #5074 union on 2026-11-13 (plus repair 6c818b3). The product code at this head is byte-identical to master, so the remaining diff is test-only (2 files, +362/-1):
Verification: every assertion checked against master's implementation (predicate carrier/type/toolless semantics, 已顺手修:新测试文件里名为 "negatives — every veto keeps the request on the main pipeline" 的测试最后一行是正向断言( 八问(中文):
判定:APPROVE / 可合。 合入后 #5073 的回归覆盖(修复方向 + 双向控制)落在已随 master 发布的产品修复之上,给这条车道补上 #3617 要求的双向钉死。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
REVIEW VERDICT (head 6cb9147): APPROVE / 可合 — unchanged from the previous round.
The only change since the last review is commit 6cb9147 itself: the responses carrier needs no top-level message array assertion moved from the end of the "negatives" test into the positives block — one line relocated within tests/issue5073-structured-output-side-request.test.ts, no semantic change. The diff vs master is still test-only (2 files, +362/-1): the product fix is already in master via the #5074 union, and this PR delivers the #5073 regression suite (unit pos/neg + isSideRequest interactions + resolveSideLane label pin + 3 e2e lanes: fix + control A + control B) plus the 13-row truth table.
CI on 6cb9147: 50 check runs = 37 success + 13 skipped, 0 failed. No kernel/ touch, no config/env surface, no wire-shape change. Verdict stands: mergeable.
(Posted as a comment again — GitHub does not allow approving one's own PR; the full review from the previous round is in this thread, review id 5946916589.)
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review round 2, head 6cb9147: APPROVE / mergeable — verdict unchanged. The only change since the previous review is my own fix commit 6cb9147 from that round: the
GitHub review comment posted on the PR thread (id 5947108716; again as a comment — GitHub does not allow approving one's own PR). 八问(中文):
判定:APPROVE / 可合(与上一轮一致;PR 仍等人工合并——GitHub 不允许我批准自己的 PR)。 |
Resolves the single conflict in tests/side-lane-truth-table.test.ts (import line): union keeps isStructuredOutputCall for the #5073 structured-output rows AND master's pluginAgentHeader/pluginRequestAgentHeader for the #6884 pi-sentinel row. Both test blocks coexist. No source changes from this branch — master already carries the #5073 fix (isStructuredOutputCall + handle.ts/side-request.ts wiring); the branch's remaining contribution is the additive test coverage.
[bot] 🏷 Conflict resolved and pushed — Re-woken with the same "PR conflicts with base (dirty)" task. I re-verified the live state first (did not assume from the prior run): What I found this run
What I did
Status-freshness note (honest): the mirror check-cache is stale — it was last fetched 2026-11-17 and still shows the pre-push head Bottom line for the human: the PR's source diff is now fully redundant with master; the branch = master + additive 八问(中文,供 reviewer)
附带说明:workdir 里发现一个 stray staged 改动,把 收工判定:冲突已解决并推送( |
Closes #5073
What & why
On the Hermes lane, bili's proxy adds its six ACP tools to requests that are not Hermes agent turns — including toolless structured-output utility calls made by child processes that inherit the plugin's
HTTP(S)_PROXYenv vars (the Hindsight memory daemon, other memory plugins, evaluators, terminal scripts). A strict backend that refusestoolstogether withresponse_formatanswers 400 (structured response_format with tools/MCP is not supported), failing every such call.Root cause is classification: a request with no tools that demands structured output (
response_formatjson_object/json_schema, or Responses-wiretext.format) is a one-shot utility call, not an agent turn — an agent turn always carries its action surface (#546). It was riding the full main pipeline and getting ACP tools injected next toresponse_format.Fix
isStructuredOutputCall()insrc/server/side-request.ts: toolless (any populatedtoolsvetoes) AND asks for a structured-output carrier. Matched carriers are exactly the two documented ones (OpenAI chatresponse_format, Responsestext.format), typesjson_object/json_schema. Deliberately NOT matched: legacy bare-stringresponse_format, GeminigenerationConfig.responseMimeType, other types (evidence-per-client discipline — no strict backend rejectstools+those pairs, so matching them would demote real turns with no defending bug).isSideRequest()after the [bug] bili dsh 长会话中 max_output_tokens 被压到 ≤200,主请求被误判为 side request 并绕过压缩 #546 veto, so any tool-carrying request stays a main turn and an explicitmainpersona still wins. These requests now route through the existing 标题生成等侧请求污染主会话状态:prepareAnthropic 缺 isTitleGen 守卫、快照无条件覆盖、survivedCount 每请求空转 #388 verbatim side passthrough — nothing injected, the backend sees the clean toolless body it sent (the same treatment title-gen / WebSearch-utility calls already get). No wire-shape or config change.handle.ts: exclude these fromrestoreOutputBudgetso their largemax_tokens(e.g. 64000) cannot seedoutputBudgetHighWaterbefore the side-lane decision (OMP extension injects tools and compression philosophy in helper prompts #1897/[bug] Claude Code 的 WebSearch 子请求被当成主对话:nudge 基准被搜索的 usage 重锚,导致提前折叠;每次搜索还被注入 bili 工具 #2500 class), and give the side-lane log line an honest reason label instead of the misleadingmax_tokens<=200.Behavior change (old → new)
response_formatjson_object/json_schema(or Responsestext.format) is now a side request forwarded verbatim. Previously it was classified as a main turn and bili injected its six ACP tools next toresponse_format, which strict backends reject with HTTP 400. Intentional — this is the fix.mainpersona still wins; toolless non-structured requests (including large-budget ones) stay main turns; declared side agents (opencode v2 title-gen requests get injected with compression philosophy (misclassified by isTitleGen) #1699) and server-tool-only utility calls ([bug] Claude Code 的 WebSearch 子请求被当成主对话:nudge 基准被搜索的 usage 重锚,导致提前折叠;每次搜索还被注入 bili 工具 #2500) unchanged.restoreOutputBudgetexclusion only prevents a new high-water poison without touching existing cache keys.Tests
tests/issue5073-structured-output-side-request.test.ts(new): unit pos/neg for the predicate +isSideRequestinterplay +resolveSideLanelabel, plus three e2e lanes (toolless structured → verbatim side passthrough with kernel state/high-water untouched; tool-carrying structured → stays main, injection intact; toolless non-structured large-budget → stays main, injection intact). Local: targeted suite 7/7, typecheck clean, adjacent side-request/lane-decision suites 138/138. Full regression = remote CI.(ai: vllm-qwen/qwen3.8-27b)