Repository navigation
feat(div-anthropic): /doctor MLX 网关连通 + 模型加载探测 (P4.2 #1+#3) - #92
Merged
Merged
Conversation
enhance-0819.md §P4.2 定 7 项 /doctor 本地健康检查。审计 (iter #9/#10): - ✅ #5 CLAUDE.md 裁剪 (已覆盖) - ✅ #6 配置冲突 (PR #90) - ⏳ #4 OOM/内存 (跨仓: MLX 无 memory 端点, 仅 POST /api/v1/gc mutating) - ⏳ #7 一键修复 (远期) - **真 gap = #1 MLX 网关连通 + #3 模型加载状态** — /doctor 此前完全不探 MLX 落地 detectMlxHealth(): 复用 model-status.ts 的 fetchMlxStatus (/api/tags) + fetchMlxPs (/api/ps), 3s timeout。Gating: 仅当 shouldAutoUseFusionMlx() (MLX 配置 provider) — cloud-active 时跳过 避免 3s 浪费 + 噪音。两 warning: 不可达 (含 URL + 起服命令) / 已连通 但无模型 loaded (含可用模型名截断 + load 命令)。 不改 Doctor.tsx — diagnostic.warnings 已数据驱动渲染。#4 OOM 跨仓 延后 (fusion-mlx 需加 status 端点, 遵循 "上游问题先提 issue")。 验证: typecheck 0, 6 单测 pass, 122 全测 pass 无回归, build + build:dev:full pass, git diff -w +62/-0 纯插入零 churn。 Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 20, 2026
追 CC 2.1.196→2.1.234 Tier-1 特性批量落地 (13 PR): 变更自 v0.4.22: - WS1 DirectoryAdded hook + Notification agent_* 类型 (#73) - WS2 堆叠 slash-skill 调用, 最多 5 前导 (#74) - LSP+filecache 内存泄漏 cap, 对齐 CC 2.1.208 (#76) - skill body-defer 懒加载, item 9 (#78) - SessionStart source "fork" 区分 fork 与 resume (#80) - P2.1 子代理护栏 — 并发/会话/深度三限 (#82) - P1.1 大输出 tool_result tail 预览 (#84) - P4.1 --ax-screen-reader 入口点对齐 — env 别名 + settings key (#86) - item 13 WebSearch per-session 搜索次数上限 (#88) - P4.2 §6 /doctor FUSION_* vs ANTHROPIC_* 环境变量冲突检测 (#90) - P4.2 #1+#3 /doctor MLX 网关连通 + 模型加载探测 (#92) - item 4 MCP 工具自动后台化 FUSION_MCP_AUTO_BACKGROUND_MS (#94) - item 22 审计日志凭证脱敏 (#96) - package.json: version 0.4.22 → 0.4.23 Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Closes #91
enhance-0819.md §P4.2 定 7 项 /doctor 本地健康检查。审计 (iter #9/#10):
checkClaudeMdFiles)detectFusionEnvConflicts)/api/tags//api/ps//v1/models仅暴露 model list + loaded names, 无 memory 字段;MLXHealthResponsetype 已定义但 adapter 从未 fetch; 唯一暴露 memory 的是POST /api/v1/gc(mutating action, 不适合只读诊断). 真 OOM status 需 fusion-mlx 加端点 → 单独跨仓 issue/doctor此前完全不探 MLX改动
src/utils/doctorDiagnostic.ts(+62/-0, 纯插入, 匹配原 2-space/single-quote/no-semi 风格):detectMlxHealth()async fn — 复用model-status.ts的fetchMlxStatus(/api/tags, 3s timeout) +fetchMlxPs(/api/ps)shouldAutoUseFusionMlx()(MLX 配置 provider) — cloud-active 跳过, 避免 3s 浪费 + 噪音fusion service start mlx起服命令; (2) 已连通但无模型 loaded — 含可用模型名截断 (前 3 + …) +fusion model load命令getDoctorDiagnostic()内detectLinuxGlobPatternWarnings之后 push — runtime health 独立于 config correctness, dev 模式也运行MLX_GATEWAY_URL复算 model-status.ts:3 env 表达式 (error msg 需 URL,fetchMlxStatus返回值不含) — 注释标 "keep in sync"src/__tests__/utils/doctorMlxHealth.test.ts(新, 169 行, 6 单测):[]不探 (验证 fetch 未调)/api/tagsthrow) → 1 warning 含 URL + ECONNREFUSED + 起服命令[](健康)spyOn(globalThis, 'fetch')route by URL + env 快照/恢复 (shouldAutoUseFusionMlx env-gated)不改
diagnostic.warnings已数据驱动渲染 (Doctor.tsx:413-419.map)fetchMlxStatus/fetchMlxPs已 export, 仅 import 消费验证
bun run typecheck— 0 errorsbun test src/__tests__/utils/doctorMlxHealth.test.ts— 6 passbun test src/__tests__/— 122 pass, 0 fail (无回归)bun run build+bun run build:dev:full— passgit diff -w— +62/-0 纯插入, 零 churnsrc/utils/)Co-Authored-By: Claude Fable 5 [email protected]