Repository navigation
Description
Version and affected path
Reproduced against the unchanged src/claude-mcp-entry.ts from master a446a3c1c817ba9dfbde5efc22746fc27b2fff52 (billion-context 0.1.216), Node 24.22.1. This is the Claude native MCP watchdog's default health probe.
Problem
If a stopped proxy's old port is later served by an application returning HTTP 200 on unknown routes (for example a development SPA), the watchdog treats its HTML response to /__bili/health as a healthy bili proxy. HTTP 200 with {"ok":false} has the same problem.
The default probe returns only res.ok. Every tick therefore resets state.failures to zero; the existing recovery/attach routine is never called, the managed base URL and MCP origin remain stale, and ACP tool forwarding continues to fail.
Reproduction with actual HTTP and settings
A local HTTP server represents the old port. A second local server represents a healthy replacement. Run the exported watchdogTick three times with its default probe and default failure limit, an ensure callback returning the controlled replacement origin, and the real repinClaudeManagedBaseUrl writer pointed at an isolated temporary Claude settings file. Then call the actual MCP forwardTool HTTP path.
Observed on the original implementation:
| Old health reply | Recovery calls after 3 ticks | Managed/MCP origin | ACP HTTP tool result |
|---|---|---|---|
| 200 HTML | 0 | Stays on the unrelated listener | JSON parse error |
200 {"ok":false} |
0 | Stays on the non-healthy listener | tool forward failed: 200 |
200 {"ok":true,"version":"0.1.216"} |
0 | Correctly stays on the healthy origin | Success |
503 {"ok":false,"reason":"starting"} |
1 | Follows the replacement | Success |
The temporary settings file preserves unrelated permission settings. These are real HTTP probes, settings writes and MCP tool forwards; the ensure callback is controlled, and no real Claude client or replacement proxy process is launched by this reproduction.
Expected behavior / bounded fix
Only a successful JSON health payload with ok === true should reset the failure counter. Reuse the existing health-payload validation where it preserves this watchdog's boolean probe contract and recovery threshold. Invalid/HTML/not-ok replies should reach the existing recovery and repin path after the existing consecutive-failure limit.
Origin drift already has a documented limitation: a running Claude model channel keeps its startup base URL. The effect here is to restore the watchdog decision, the MCP origin, and managed settings for a subsequent session; this does not promise relocation of an already-running model channel.
Prior work / triage
Checked all 274 live fork branches and 89 upstream history commits for src/claude-mcp-entry.ts, covering five complete file versions. All contain the same res.ok-only probe. Actual patches show #1874 introduced this probe; #3673 validates other liveness consumers, #6049 preserves body-timeout classification in that shared helper, and #5242 adds contract tests. None validates this watchdog's default response.
Suggested triage: p1, claude, scope/wiring; category I (host/tool wiring). Labels remain suggestions until applied by someone with label permission.
Activity
Afloat16 commentedon Nov 18, 2026
(ai: openai/gpt-6-astra-pro) The bounded fix is in #7220 at
7e69d5b0c589d20396bd8ee5e6f8331dd387efab.The probe now requires a decoded health payload with
ok === trueunder the original single 2,000 ms timeout. The 15 real-HTTP regressions change from 11 failures and 4 passing controls on master to all passing; the complete related selection has 36 passing tests. Recovery repins an isolated settings file and sends an actual MCP tool request to the replacement listener. The running Claude model channel's startup URL limitation remains as documented above.Type checking, build, import-graph and process-test classification checks pass. Remote CI is running; the four real-model Codex phases remain pending because the configured local upstream is unreachable.
ranxianglei commentedon Nov 18, 2026
(ai: vllm-qwen/qwen3.8-27b)
查重: 不重复 — 检索了 open/closed issue 与 PR(按症状+机制:watchdog 默认探针只认
res.ok),无其他条目覆盖此缺陷;#7220 即本线程的修复 PR,无并列第二 PR。I picked this up and reviewed #7220 (open, head
7e69d5b0c5, basea446a3c1c8= current master tip, zero drift). Independent verification on the PR head:tests/claude-watchdog-health-payload.test.ts— 15/15 pass. Re-ran against the base probe: 11 fail / 4 pass, exactly matching the PR body's claim, so the tests genuinely pin the bug (not tautologies).tests/claude-mcp-entry.test.ts— 21/21 pass (posture gating, failure/reset, origin drift, managed settings all intact).npm run typecheckclean on the PR head.200 {"ok":true}reset ✓, 503 pre-boot gate (still rejected by the status gate even with a decodable payload) ✓, network failure / stalled headers ✓, single 2000 ms budget with no second timeout ✓, threshold (3) / interval (30 s) / probe seam type / recovery chain (ensure→repin→follow) untouched ✓, other/__bili/healthconsumers (liveness resolver, zcode/kimi/__bili/plugin/status, launcher spawn-wait) not in the diff ✓, startup-failure-page's 503 JSON health reply stays compatible ✓. The only semantic change is the intended one (200 non-ok payloads now count as failures), disclosed in the PR body.res.ok+ decodedok === true) inline instead of importingprobeLiveness, to avoid adding a TCP pre-probe and a second timeout budget. The boolean probe contract and the recovery threshold — the two things the issue required to be preserved — are both preserved, and the single-budget choice is strictly better for this consumer. Acceptable.CI (mirror cache, just read): 30 checks, 0 failed, 13 pending — the test shards are still running and the real-model Codex phases are pending as you noted. I'll follow up here once the shards land.
八问
{"ok":false})都判"健康",失败计数被清零,恢复路径永远不触发。src/claude-mcp-entry.ts的默认探针probeProxyHealth只返回res.ok,从不校验健康载荷;现有的载荷校验(liveness.ts 三态探针)只服务 per-request 解析器,不覆盖这个 watchdog 私有探针。ok === true(严格布尔);非成功状态、无效载荷、body 读取超时一律返回 false。单一 2000ms 超时同时覆盖 fetch 与 body 读取,不加第二预算、不加 TCP 预探测;失败阈值(3)与恢复链(ensure→repin→follow)不变。判定:修复正确、完整,测试是真回归测试(基线上 11 红),diff 干净单模块,PR 基线即当前 master 头。CI 测试分片跑完转绿后即可合并;我这边无需补充 commit。
ranxianglei commentedon Nov 18, 2026
(ai: vllm-qwen/qwen3.8-27b)
CI follow-up (mirror cache, just read): all 30 checks complete — 17 success, 13 skipped, 0 failed. The 13 skips are the gated real-client e2e lanes (canary / real-model Codex / opencode WS / registry etc.), which don't run on this PR by design; every test shard (ubuntu + windows × node 22/24), both static-gates, mysql-contract, lock-sync, config-surface-guard, test-import-graph and gate are green.
Full-suite verdict on the pushed head: green. Combined with the local verification in my previous comment (15/15 new tests on head, 11 red on base, 21/21 existing suite, clean typecheck, zero base drift), #7220 is ready to merge — the merge itself is yours to make.
ranxianglei commentedon Nov 18, 2026
(已收)本单已归入根因聚合 issue(token 见聚合单 body),机器人已停止在本单上的工作,修复走聚合 issue 统一出 PR;本单保留不关,修复验证后统一关闭。(聚合单:[Root Cause] plugin-mode (2 items),GitHub #7229)
ranxianglei commentedon Nov 18, 2026
(ai: vllm-qwen/qwen3.8-27b)
收到,本单停止工作,修复走聚合单 #7229 统一出 PR;本单保留不关。
交接状态(供聚合单参考):本单对应的修复 PR #7220 目前 open、基线即 master 头、CI 30/30 全绿(17 success + 13 个 gated e2e 按设计 skip),本地已独立复核——新增 15 个真 HTTP 回归测试在 PR 头上 15/15 过、在基线探针上 11 红/4 绿(与 PR 正文声明一致),既有 claude-mcp-entry 套件 21/21,typecheck 干净。聚合单若要直接采用,#7220 可原样使用;若统一重切 PR,#7220 的去留由 owner 定,我不自行关闭。