Repository navigation
feat(doctor): #7 一键诊断修复 fixAction 框架 (warning 携带可调用 auto-fix) - #131
Merged
Merged
Conversation
doctorDiagnostic warnings 仅含 fix: string (人类可读指令, 不可调用),
无确定性可执行 auto-fix。扩展类型加 fixAction?: () => Promise<unknown>,
首个落地 = MLX OOM high/imminent attach fixAction: requestMlxGC
(POST /api/v1/gc, 同 adapter item 15 已验证安全)。env-conflict/MLX-start
/model-load 非进程内确定性 (需 shell 重启/跨 CLI), 保留人类可读 fix,
不 attach fixAction (Rule 2 最小)。Doctor.tsx UI 交互 (按 f 触发) 涉及
React-compiler-optimized state (\$[N] memo slots) 脆弱, 独立 defer。
本 PR 落框架 + 数据层可调用, UI 消费后续。
测试: doctorMlxHealth.test.ts 既有 2 OOM 测加 fixAction 函数断言,
新测 fixAction()→POST /api/v1/gc→{success:true,freed:5000}。
typecheck 0 errors, bun test src/__tests__/ 408 pass, build:dev pass,
biome lint src/utils/doctorDiagnostic.ts 0 error。
closes #130
Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 22, 2026
Patch release bundling 17 commits since v0.4.23: - item 15(a) MLX OOM auto-recovery gc+retry (#129) - #7 one-click diagnostic fixAction framework (#131) - 维度5 background-default spawn FUSION_SUBAGENT_DEFAULT_BACKGROUND (#127) - #4 proactive MLX OOM detection via /v1/health (#125) - item 17 fullscreen pre-compact history + :598 synthetic decouple (#123) - item 25B workflow stagger fan-out (#122) - item 21 auto-mode local rule classifier test coverage (#120) - item 23 archive plugin source + SHA-256 lock (#118) - item 24 marketplace command source (#116) - item 6 transcript disk trimming + crash-safe checkpoint (#114) - item 5 normalizeMessages secondary normalize cache (#112) - item 19 screen-reader plaintext render (#110) - item 16 compact retry countdown + stall hint (#108) - item 25A workflow execution runtime docs (#106) - item 25A minimal workflow execution runtime (#105) - item 12 subagent auto-background threshold (#103) - item 20 vimInsertModeRemaps dual-key INSERT sequence (#101) Co-Authored-By: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 26, 2026
…fix) (#140) PR #131 landed the fixAction framework in the data layer (warnings carry an optional callable fixAction, e.g. requestMlxGC for MLX OOM), but the Doctor.tsx UI only rendered the fix text — the callback was never invokable. The prior session deferred the UI wiring because Doctor.tsx is vendored React-Compiler output (_c/$[N] memo slots) and hand-editing the slots is fragile. Resolve by extracting the warnings render into a new hand-written child component (DoctorWarnings.tsx) that owns its own useInput. The parent's memo slot $[36] still depends only on the warnings array reference, so the compiler output is untouched except for swapping the render call. This neutralizes both defer reasons: (1) no hand-editing of memo slots, (2) no shared Confirmation context in Doctor (requestMlxGC is an in-process deterministic op needing no confirmation). Behavior: - Warnings render identically (Warning: <issue> / Fix: <fix>). - When >=1 warning has a fixAction, show "Press f to run auto-fix." hint. - Press f -> runAutoFix iterates actionable warnings, calls each fixAction, shows done/error feedback with per-warning results. Guards against double-trigger while running. No fixAction -> no hint, no useInput effect. - Matches repo convention: raw useInput with eslint-disable for letter-key prompts (same class as y/n in DesktopHandoff). Tests: 9 new (runAutoFix pure logic — all-success/singular wording, all-fail/partial/non-Error throw/empty/no-fixAction-skip/running-first/ mock-once). Repo has no ink render tests; pure logic is unit-tested and the Doctor.tsx wiring is typecheck-verified. Gates: typecheck 0, 469 tests pass, biome clean on new files, build:dev passes, default behavior byte-identical when no fixAction present. 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.
背景
enhance-0819.md #7: 一键诊断+修复。
/doctor的warnings当前仅含fix: string(人类可读指令, 不可调用)。无fixAction字段 → 无确定性的可执行 auto-fix。缺口 (surgical)
doctorDiagnostic.ts:69类型warnings: Array<{ issue: string; fix: string }>— fix 是指令字符串, 永不被调用。无 fixAction 字段。方案
fixAction?: () => Promise<unknown>(返回结果透传给消费者)fixAction: requestMlxGC(POST /api/v1/gc, 同 adapter 已有, item 15 已验证安全)fix字符串, 不 attach fixAction (Rule 2 最小)改动
src/utils/doctorDiagnostic.ts— 类型 + 3 local array decl + 3 函数 return type 加fixAction?: () => Promise<unknown>; 2 OOM case (imminent/high) attachfixAction: requestMlxGCsrc/__tests__/utils/doctorMlxHealth.test.ts— 既有 2 OOM 测加expect(typeof warnings[0].fixAction).toBe("function"); 新测 fixAction()→POST /api/v1/gc→{success:true,freed:5000}Gates
bun run typecheck— 0 errorsbun test src/__tests__/— 408 passbun run build:dev— passbunx biome lint src/utils/doctorDiagnostic.ts— 0 error (pre-existing node:protocol infos)关联
closes #130
enhance-0819.md #7 (§684)