Skip to content

[PR] fix(hermes): prevent healthy proxy misdetection from disabling bili - #4657

Closed
yanhuojiyusheng wants to merge 1 commit into
ranxianglei:masterfrom
yanhuojiyusheng:2026-10-25_hermes-registry-ready
Closed

yanhuojiyusheng wants to merge 1 commit into
ranxianglei:masterfrom
yanhuojiyusheng:2026-10-25_hermes-registry-ready

Conversation

@yanhuojiyusheng

Copy link
Copy Markdown
Contributor

Fixes #4656

Hermes can completely lose bili compression for the lifetime of its host process even after its proxy has successfully started. When concurrent proxies overwrite the shared proxy-origin, ensure_origin sees a foreign launch token and never checks its own per-instance record. It eventually reports startup failure, terminates its healthy child, and leaves model traffic going direct/uncompressed. Long conversations can then exceed the upstream context window.

Scan the existing per-instance registry alongside the shared pointer during spawn polling. Accept only the current launch token with a live PID and successful health probe, and retain the instance ID. No extra proxy, timeout increase, storage change, or configuration surface is introduced. This addresses the Python counterpart of #3326 / #3327 and is independent of #4642's host-load-deadline repair and #4644's recovery work.

Evidence: local 0.1.206 logs show proxies listening at 15:33:48 CST while the plugin still timed out at 15:34:50. The exact pointer overwrite was not captured live; the deterministic fixture reproduces it. With the fix installed on top of #4642, the reporter confirmed startup recovered. Database size is not asserted as the cause.

Validation on this independent branch based on master 8b24d1f:

  • Runtime / MITM-domain suites: 28/28 passed, including own registry entry with foreign pointer, wrong-token rejection, and dead-PID rejection.
  • The new positive test failed before the fix; both negative cases passed.
  • npm run typecheck, npm run build, and diff whitespace checks passed.
  • Full Hermes file: one existing local environment failure in missing hermes CLI because the installed hermes executable remains discoverable through PATH; no unrelated fix is bundled.

Only two files change. Remote CI remains to run; no claim of full-suite green.

@ranxianglei ranxianglei changed the title fix(hermes): prevent healthy proxy misdetection from disabling bili [PR] fix(hermes): prevent healthy proxy misdetection from disabling bili Oct 25, 2026
@yanhuojiyusheng
yanhuojiyusheng force-pushed the 2026-10-25_hermes-registry-ready branch from eb5af8a to e31e51d Compare October 25, 2026 15:01
@yanhuojiyusheng
yanhuojiyusheng force-pushed the 2026-10-25_hermes-registry-ready branch from e31e51d to 16f4cf1 Compare October 26, 2026 01:33
@yanhuojiyusheng

Copy link
Copy Markdown
Contributor Author

诊断成立(#4656 的机制已按代码复核:ensure_origin 只读机器级 proxy-origin,launchToken 不匹配就在预算耗尽后 terminate() 那个健康子进程),但这个实现无法生效:

  • 新增候选循环的门是 candidate.get("launch_token") == token;
  • 生产环境的 per-instance registry marker 不含该字段:src/instance.ts:467-485 的 RegistryEntry 注释写明 “minus the launcher-private launchToken”,coerceEntry(src/instance.ts:521 起)也不拷贝它;
  • Python 侧 _normalize_instance(hermes-plugin/__init__.py:272-304)对缺失字段给 None,于是真实条目全部 continue,行为与改前一致。

三个新用例通过的原因是 tests/hermes-native.test.ts:359-367 的 inst_rec() 主动把 launchToken 写进了 registry 记录,fixture 形状与生产写入路径不一致,因此证明不了生产行为。

可靠的身份凭证是刚 spawn 的子进程 pid(并发写入方伪造不了),#4658 已按此实现并全绿。本 PR 关闭;机制与现场证据已转入 #4656 / #4658。

ranxianglei pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Oct 26, 2026
…ompression-channel comments (ranxianglei#4855)

All six comments added by this PR cite ranxianglei#4657, which is an unrelated closed PR (hermes proxy-misdetection fix, Fixes ranxianglei#4656). The anchor must point at the issue being fixed, ranxianglei#4855. Comment text otherwise untouched.
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Oct 27, 2026
…ompression-channel comments (ranxianglei#4855)

All six comments added by this PR cite ranxianglei#4657, which is an unrelated closed PR (hermes proxy-misdetection fix, Fixes ranxianglei#4656). The anchor must point at the issue being fixed, ranxianglei#4855. Comment text otherwise untouched.
@github-actions github-actions Bot mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1][Hermes] Healthy spawned proxy is missed after proxy-origin is overwritten, disabling bili for the host process

1 participant