Skip to content

fix(doctor): /doctor 应检测 FUSION_* vs ANTHROPIC_* 环境变量冲突 (P4.2 §6) #89

Closed

Description

@dahai80

背景

/Users/dahai/fusion/architecture/fusion-code-enhance-0819.md §P4.2 /doctor 本地健康体检 列出 7 项检查,其中 配置冲突检测:

配置冲突检测 (FUSION_BASE_URL vs ANTHROPIC_BASE_URL 残留陷阱)

审计结论 (2026-08-20)

src/screens/Doctor.tsx 渲染 diagnostic.warnings (:417),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 点名的 "残留陷阱"。

本次落地范围 (surgical, 单 PR)

补 spec #6 配置冲突检测:6 对 env 同时设置时在 /doctor 报 warning。

  • 新增纯同步 helper detectFusionEnvConflicts() 在 doctorDiagnostic.ts,挂入 detectConfigurationIssues 的 warnings 数组(复用现有 render 路径 Doctor.tsx:417,不改 UI)。
  • 覆盖 6 对:API_KEY / BASE_URL / AUTH_TOKEN / BETAS / MODEL / LOG。
  • warning { issue, fix } 文案明确指出 FUSION_* 被忽略 + 修复动作(unset 冗余项或统一到一个)。

不在本次范围 (后续 iteration)

验收

  • bun run typecheck 0 error
  • 新单测覆盖 6 对 + 仅一个设置 + 两个都未设置
  • bun run build + bun run build:dev:full pass
  • bunx biome check 新测试文件无 error

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions