Repository navigation
feat(api): item 15(a) MLX OOM 自动恢复 gc+重试 (CC 2.1.234, closes #128) - #129
Merged
Merged
Conversation
memory_guard 撞顶 (memory limit exceeded / Reduce context size) 原为确定性 失败: 同上下文重试必再 OOM → 标 x-should-retry:false 立即放弃。但若先 gc 释放显存, 同上下文可能装下。 本 PR: OOM 检测 → requestMlxGC() (POST /api/v1/gc, 同文件 :604) → 若 gc 成功, mlxFetchWithRetry (同文件 :372) 重发同 mlxBody 一次。成功则转既有 OK 路径 (流式/非流式分支原样复用); gc 失败/重发仍失败/重发异常 → fallback 既有 x-should-retry:false 错误 (防空转重试)。 mirror 既有 truncate-retry 模式 (非流式 max_tokens 升级 :1710), 同为 adapter 层透传恢复。仅 OOM case 触发, 不碰更高层 truncate/compact/熔断 路径。 重试一次不循环。infra (requestMlxGC/mlxFetchWithRetry) 同文件已有。 item 15(b) gateway reconnect+stream-resume 为 L-size 跨 3 文件框架, MLX SSE 无 resume cursor, 现无 stream-resume infra — 独立 defer (见 issue #128)。 测试: 5 新测覆盖 gc-retry 全分支 (成功/失败/重发仍 OOM/重发异常/非 OOM 不触发)。 门禁: typecheck 0 / 407 测 pass / lint 0 err / build:dev pass。 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]>
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 item 15: MLX OOM 自动恢复。
memory_guard 撞顶 (
memory limit exceeded/Reduce context size) 原为确定性失败 — 同上下文重试必再 OOM → 标x-should-retry:false立即放弃。但若先 gc 释放显存, 同上下文可能装下。改动 (surgical)
src/services/api/fusion-mlx-adapter.ts(1 文件):const mlxResponse→let(:1636) — gc-retry 成功时重赋值转 OK 路径requestMlxGC()(:604) → 若 gc 成功,mlxFetchWithRetry(:372) 重发同mlxBody一次。成功转既有 OK 路径 (流式/非流式分支原样复用); gc 失败 / 重发仍失败 / 重发异常 → fallback 既有x-should-retry:false错误 (防空转重试)mirror 既有 truncate-retry 模式 (非流式 max_tokens 升级 :1710)。仅 OOM case 触发, 不碰更高层 truncate/compact/熔断 路径。重试一次不循环。
requestMlxGC/mlxFetchWithRetry同文件已有。测试
tests/services/api/fusion-mlx-adapter.test.ts(+195, 5 新测):x-should-retry:false, 不重发x-should-retry:falsex-should-retry:false(异常被 catch 不传播)x-should-retry)门禁
bun run typecheck— 0 errorsbun test src/__tests__/— 407 pass / 0 failbun test tests/services/api/fusion-mlx-adapter.test.ts— 36 pass (5 新)bunx biome lint src/services/api/fusion-mlx-adapter.ts— 0 error (2 warn 4 info, 既有)bun run build:dev— pass范围说明
item 15(b) gateway reconnect+stream-resume 为 L-size 跨 3 文件框架 (MLX SSE 无 resume cursor, 现无 stream-resume infra), 独立 defer — 见 issue #128。
关联
Co-Authored-By: Claude Fable 5 [email protected]