Repository navigation
fix(doctor): /doctor 检测 FUSION_* vs ANTHROPIC_* 环境变量冲突 (P4.2 §6) - #90
Merged
Merged
Conversation
enhance-0819.md §P4.2 spec #6 要求配置冲突检测 (FUSION_BASE_URL vs ANTHROPIC_BASE_URL 残留陷阱)。cli.tsx:30-49 有 6 对 FUSION_* -> ANTHROPIC_* 映射,模式 `if (FUSION_X && !ANTHROPIC_X)`,两者都设置时 FUSION_* 被静默忽略。 用户以为 FUSION_BASE_URL 生效实则用 ANTHROPIC_BASE_URL,无任何告警。 新增 detectFusionEnvConflicts() 纯同步 helper,挂入 detectConfigurationIssues warnings 数组,复用 Doctor.tsx:417 既有 render 路径 (不改 UI)。覆盖 6 对: API_KEY / BASE_URL / AUTH_TOKEN / BETAS / MODEL / LOG。warning {issue, fix} 文案明确指出 FUSION_* 被忽略 + unset 修复动作。 范围 surgical: +38/-0 prod (doctorDiagnostic.ts),1 新测试文件 6 用例。 MLX 端口/网关/模型加载/OOM (#1-4 async probe) 与一键修复 (#7) 延后单独 iteration。 验证: typecheck 0; 6 新测 pass; 122 单测无回归; build + build:dev:full pass; biome check 干净。Closes #89 Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Aug 20, 2026
dahai80
added a commit
that referenced
this pull request
Aug 20, 2026
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 #89.
enhance-0819.md§P4.2/doctor本地健康体检 spec #6 要求 配置冲突检测 (FUSION_BASE_URL vs ANTHROPIC_BASE_URL 残留陷阱)。审计结论
src/screens/Doctor.tsx渲染diagnostic.warnings,diagnostic来自getDoctorDiagnostic()(src/utils/doctorDiagnostic.ts)。detectConfigurationIssues()现仅检查 install-method / PATH / npm-leftover,不检查 env 冲突。src/entrypoints/cli.tsx:30-49有 6 对FUSION_* → ANTHROPIC_*映射,每对模式if (FUSION_X && !ANTHROPIC_X) ANTHROPIC_X = FUSION_X。两者都设置时 FUSION_ 被静默忽略* — 用户以为 FUSION_BASE_URL 生效实则用 ANTHROPIC_BASE_URL,无告警。spec 点名的 "残留陷阱"。改动
新增纯同步 helper
detectFusionEnvConflicts()(doctorDiagnostic.ts),挂入detectConfigurationIssueswarnings 数组,复用Doctor.tsx:417既有 render 路径 (不改 UI)。覆盖 6 对 (与 cli.tsx:30-49 一致):API_KEY / BASE_URL / AUTH_TOKEN / BETAS / MODEL / LOG。warning
{issue, fix}文案明确指出 FUSION_* 被忽略 +unset修复动作。范围 (surgical)
src/utils/doctorDiagnostic.ts: +38/-0 (纯插入,零 churn,匹配原 2-space/single-quote/no-semi 风格)src/__tests__/utils/doctorEnvConflicts.test.ts: 新文件,6 用例 (无 env / 仅 FUSION / 仅 ANTHROPIC / 单对冲突 / 全 6 对冲突 / 混合态),env snapshot+restore 隔离不在本 PR (后续 iteration)
checkClaudeMdFiles(doctorContextWarnings.ts) 覆盖 ✅验证
bun run typecheck— 0 errorbun test src/__tests__/utils/doctorEnvConflicts.test.ts— 6 pass / 0 failbun test src/__tests__/— 122 pass / 0 fail (无回归)bun run build+bun run build:dev:full— passbunx biome check— 干净git diff -w— +38/-0 prod, 零 churnCo-Authored-By: Claude Fable 5 [email protected]