Skip to content

fix: 记忆巩固因 defaultEffort trap 反复失败(resolveDreamEffort 主动探测能力) - #96

Merged
modusensus merged 3 commits into
mainfrom
fix/dream-effort-trap
Sep 9, 2026
Merged

modusensus merged 3 commits into
mainfrom
fix/dream-effort-trap

Conversation

@modusensus

@modusensus modusensus commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

问题

UI「记忆巩固 · 失败」,报错 UNSUPPORTED_REASONING_EFFORT: provider "volcano-engine" model "deepseek-v4-flash-ga-260731" does not support reasoning effort "low"。

根因是 harness 的 defaultEffort trap:volcano 适配器声明 reasoning.defaultEffort = "low",但模型并不支持 "low",导致不管传不传 effort 字段,harness 都会代入 "low" → 必失败。v0.7.21 的「去掉字段重试」绕不过这个坑。

修复

新增 resolveDreamEffort(dream.js + sleep.js 共用),跑 LLM 前先调 ctx.llm.resolveModelInfo(provider, model) 查模型真实能力:

  • 配置的 effort 受支持 → 原样透传
  • 不支持 → 重映射到 defaultEffort / 第一个声明的 effort
  • 模型无推理能力 → 彻底不传该字段
  • 能力查询不可用或报错 → 退回配置值,withEffortFallback 仍兜底

第一次请求即携带合法 effort,不再触发 defaultEffort trap。

验证

新增 5 个回归测试(毒 default 重映射 / 无推理能力省略字段 / 支持值透传 / 查询失败回退 / sleep 路径),723/723 通过。

Summary by CodeRabbit

  • Bug Fixes

    • Improved reasoning-effort handling for dream and sleep operations.
    • Configured effort levels are now checked against the selected model’s supported capabilities.
    • Unsupported settings are omitted or replaced with a supported fallback, reducing failed requests.
    • Models without reasoning support continue to work without sending unsupported options.
    • Existing fallback behavior remains available when capability information cannot be retrieved.
  • Documentation

    • Added descriptions to dream and sleep provider, model, and reasoning-effort configuration settings.

…efaultEffort trap

resolveDreamEffort queries ctx.llm.resolveModelInfo for the exact dream/sleep
route up front and forwards an effort the model actually declares, instead of
relying on the withEffortFallback retry — which the harness's defaultEffort
substitution makes useless when the adapter's declared default (e.g. volcano
adapter defaultEffort "low") is itself rejected by the model.

- configured effort supported -> forwarded verbatim
- configured unsupported -> remapped to defaultEffort/first declared effort
- model declares no reasoning capability -> field omitted entirely
- capability query unavailable or throws -> configured value forwarded,
  withEffortFallback still guards the rejection path

5 regression tests cover all four branches plus the sleep path.
723 tests pass (718 + 5).

Co-Authored-By: Anans-Ivresse <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bafe64fc-1c01-4830-ad49-b16cff7d014b

📥 Commits

Reviewing files that changed from the base of the PR and between 81390e5 and 4e60468.

📒 Files selected for processing (3)
  • dsh-mneme/lib/config.js
  • dsh-mneme/src/config.js
  • dsh-mneme/test/client.test.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds capability-aware reasoning-effort resolution for dream and sleep LLM calls. It selects supported efforts, omits unsupported settings, preserves configured values on lookup failure, and adds configuration metadata and tests.

Changes

Reasoning effort resolution

Layer / File(s) Summary
Capability-aware effort resolver
dsh-mneme/{lib,src}/dream.js
Exports resolveDreamEffort. The helper queries model capabilities, selects a supported effort, omits effort when reasoning is unsupported, and preserves the configured value when lookup fails.
Dream and sleep call integration
dsh-mneme/{lib,src}/dream.js, dsh-mneme/{lib,src}/dream/sleep.js
Dream consolidation and summary calls, plus sleep conflict and pattern phases, use the shared resolver.
Reasoning effort behavior tests
dsh-mneme/test/reasoning-effort.test.js
Tests cover unsupported defaults, absent reasoning support, supported configured values, capability-query failures, retry behavior, and sleep phases.
Configuration schema metadata
dsh-mneme/{lib,src}/config.js
Adds descriptions to dream and sleep route and reasoning-effort schema fields without changing validation or defaults.
Client assertion cleanup
dsh-mneme/test/client.test.js
Removes a no-op string replacement from the class name assertion.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 4e604

Memory consolidation and sleep requests now select only model-supported reasoning-effort values or omit the field for non-reasoning models, preventing unsupported-effort failures while retaining fallback behavior. The covered behavior presents no remaining merge-readiness risk.

Sequence Diagram(s)

sequenceDiagram
  participant Dream or Sleep Flow
  participant resolveDreamEffort
  participant Model Capability API
  participant LLM
  Dream or Sleep Flow->>resolveDreamEffort: Provide route and configured effort
  resolveDreamEffort->>Model Capability API: Query model reasoning capabilities
  Model Capability API-->>resolveDreamEffort: Return supported efforts or failure
  resolveDreamEffort-->>Dream or Sleep Flow: Return resolved effort or null
  Dream or Sleep Flow->>LLM: Send request with resolved effort
Loading

Suggested reviewers: anans-ivresse

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary fix: preventing repeated memory-consolidation failures caused by the unsupported defaultEffort value through resolveDreamEffort capability detection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dream-effort-trap

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
dsh-mneme/src/dream.js 98.21% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

modusensus and others added 2 commits September 9, 2026 08:19
…thinking models)

The DSH settings panel renders from the exported Config schema, so attaching
schemastery .description() to dreamProvider/dreamModel/dreamReasoningEffort/
sleepProvider/sleepModel/sleepReasoningEffort surfaces the consolidation-model
guidance in the UI itself — no panel-frontend change needed. Points users at
non-thinking models for consolidation and notes that unsupported reasoning
efforts are auto-remapped (v0.7.26+).

Co-Authored-By: Anans-Ivresse <[email protected]>
…replacement)

The assertion replaced "${nativeCls} mneme-topentry-native" with the identical
literal — a no-op flagged by CodeQL. The check is the raw string presence test;
the replace never did anything. Removed; behavior unchanged.

Co-Authored-By: Anans-Ivresse <[email protected]>
@modusensus
modusensus merged commit 9e3edef into main Sep 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant