Skip to content

[PR] fix(hermes-plugin): report endpoint model output limits - #3934

Merged
ranxianglei merged 1 commit into
ranxianglei:masterfrom
yanhuojiyusheng:2026-10-20_fix-hermes-output-ceiling
Oct 20, 2026
Merged

ranxianglei merged 1 commit into
ranxianglei:masterfrom
yanhuojiyusheng:2026-10-20_fix-hermes-output-ceiling

Conversation

@yanhuojiyusheng

Copy link
Copy Markdown
Contributor

Hermes 未设置显式 max_tokens 时,原生插件只上报上下文窗口,没有读取端点声明的模型输出上限。group/... 等自定义模型无法命中 bili registry 兜底,导致已知 500K 窗口仍按 500K 输入预算计算,没有执行现有输出预留。

本补丁通过 Hermes 已有的 fetch_endpoint_model_metadata(base_url),按精确模型名读取 max_completion_tokens,在缺少显式预算时通过现有 header 和 runtime-info 上报。复用窗口查询的非阻塞 TTL memo,按模型、端点、限制类型隔离缓存;不新增配置,不改变 headroom 策略。

验证:

  • npm run typecheck 通过。
  • npm run build 通过;仍有既有 pi-host-stub 的 CONFIG_DIR_NAME 导出警告。
  • node --import tsx --test --test-name-pattern='python plugin runtime' tests/hermes-native.test.ts:21 项通过;其中两个既有窗口用例因所选 Python 缺少 YAML 库跳过内部正向断言。
  • 新增用例覆盖精确匹配、缺少上限、名称不匹配、跨端点隔离、接口异常、显式预算优先,以及 header/runtime-info 两个出口。
  • git diff --check 通过。

依赖与验证边界:当前 Hermes _extract_pricing 会被 Magpie modalities.input 列表触发 TypeError,导致 accessor 返回空元数据。该问题已有独立修复 PR:NousResearch/hermes-agent#140849、NousResearch/hermes-agent#137990。本 PR 修复插件未消费宿主输出元数据的缺口;尚未在修复后的真实 Hermes 链路验证,不能单独解决当前机器的完整问题。500K → 375K 是 bili 既有预留策略的结果,并非实测模型输入硬上限。

Closes #3933

@ranxianglei ranxianglei changed the title fix(hermes-plugin): report endpoint model output limits [PR] fix(hermes-plugin): report endpoint model output limits Oct 20, 2026
@ranxianglei
ranxianglei merged commit 1cec7ad into ranxianglei:master Oct 20, 2026
23 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.654-master.1cec7ad (rolling master tag).

npm install -g billion-context@0.0.654-master.1cec7ad  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants