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
bili 主程序 0.1.197(npm latest);Hermes 插件目录标记 0.1.196,其 __init__.py 与仓库 HEAD hermes-plugin/__init__.py 逐字节一致(SHA256 8f6b2c2dbef1da911682b9d8b7665bcaace23249a849f3e78fdf474c469f934e,35966 bytes),即 HEAD 代码复现。
Activity
ranxianglei commentedon Oct 15, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重: 不重复。检索了 open+closed issue(
hermes context window/sent no context window/runtime-info contextWindow/context-window header等关键词,0 命中);#2381/#2382 是 DSH 按 (provider, model) 键控的另一类根因,本 issue 是 Hermes 插件根本没有 contextWindow 通道,机制不同。已核实你的根因分析成立:
hermes-plugin/__init__.py全文件 grepcontext-window/contextWindow/context_window零命中——头盖章处(on_llm_request)只盖 plugin/conversation/model/max-output 四个头;report_runtime_info()的 body 只有{agent, model, source, maxOutput}。x-bili-plugin-context-window头(src/plugin.ts的pluginReportedContextWindow+pluginHeadersMatchModel门控)和 runtime-info 的contextWindow字段(handlePluginRuntimeInfo已解析并参与 native-window 链)都已实现——pi 正是走这两条路才正常的(src/agent/pi.ts从ctx.model.contextWindow取值盖章)。缺的只是 Hermes 插件侧「把宿主真值带上来」这一环。修复方案(纯 Python 插件侧改动,零 TS 变更):
HERMES_HOME/context_length_cache.yaml(你证据里宿主存真值的地方),复用插件既有的双 YAML 后端解析模式(PyYAML/ruamel,[Bug] mitm_domains_from_config() bare 'import yaml' returns [] when PyYAML is absent -> silent blind tunnel (ruamel.yaml fallback suggested) #2838),任何异常 fail-open 回退现状;<model>@<base_url>精确匹配;base_url 优先取 hook 上下文里现成的 URL 字段,否则用 hook 的provider参数从config.yamlproviders 表解析(与既有mitm_domains_from_config()同源同键名);base_url 未知时只有该模型所有条目指向同一数值才上报(宁可不上报也不报错窗口——报大导致 preflight 溢出、报小导致过度压缩,都比默认 200K 更糟的情况要避免);on_llm_request盖x-bili-plugin-context-window头 + runtime-info body 加contextWindow字段(去重键同步纳入窗口值,窗口变化会重新上报)。一个口径说明:缓存值若是宿主「扣输出预留后的可用输入预算」口径(你在备注里提过),bili 还会再预留输出空间,等于略偏保守地提前压缩——方向安全,但会在 PR 描述里写明。
开始实现,完成后带 PR 回复。
ranxianglei commentedon Oct 15, 2026
(ai: vllm-qwen/qwen3.8-27b)
修复完成 → **PR: https://github.com/ranxianglei/billion-context/pull/3262**(`Closes #3261`,CI 结果出来前先报状态:定向测试本地 30/30 全绿、typecheck 干净,全量回归以 CI 为准)。
结构化八问:
x-bili-plugin-context-window)和 runtime-info 的contextWindow字段本就完整可用([native] runtime-info protocol: plugins report real model config (model / contextWindow / maxOutput) to the proxy #955/feat: runtime-info protocol — plugins report real model config to the proxy (#955) #956 协议),但hermes-plugin/__init__.py只盖 model/max-output 两个通道,宿主真值没有任何一条路被带上来。自定义别名又不在注册表里,于是整条 native-window 链落到默认值。HERMES_HOME/context_length_cache.yaml(键<model>@<base_url>,复用既有双 YAML 后端模式),base URL 用 hook 现成字段或provider参数查 config.yaml 解析;匹配两级(归一化全 URL → origin 粒度,覆盖缓存带/v1而配置省略的差异);同模型多上游窗口冲突时宁缺毋报。查到后双通道上报:头 + runtime-info(去重键纳入窗口值,变化会重报)。任何缺失/解析失败/歧义一律 fail-open 回现状。on_pre_api_request里table变量只在 max_tokens 存在的分支内绑定却无条件读取——无 max_tokens 触发时 NameError 被吞掉、整条 runtime-info 静默丢失;已提升绑定。该修复只让原本丢失的上报恢复,无新风险面。bili plugin update hermes刷新插件副本即可。一个口径备注(已在 PR 描述披露):若宿主缓存值是「扣输出预留后的可用输入预算」口径,bili 再预留输出空间会略偏保守地提前压缩——方向安全。
发版合并后请在你机器上
bili plugin update hermes验证一下group/sol会话日志里的[window]行应显示source=client-config base=500000。ranxianglei commentedon Oct 15, 2026
(ai: vllm-qwen/qwen3.8-27b)
CI 全绿:PR #3262 的 39 个 check run 全部完成、零失败(ubuntu/windows × node 22/24 共 12 个 test shard + static-gates/kernel-guard/config-surface-guard/docs-sync 等全部门禁)。
合并判定:可合。合并后在你机器上
bili plugin update hermes,group/sol会话日志的[window]行应变为source=client-config base=500000(若宿主缓存值口径与预期不符,把那一行日志贴回来我再核)。Merge pull request #3262 from ranxianglei/2026-10-15_hermes-context-w…
fix: carry hermes' per-model context window onto both report channels (…