You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] captureRunner uses reflectLlm (skill-evolver) for batch reflection — should use main llm #2148
I have searched existing issues and this hasn't been mentioned before
I have read the project documentation and confirmed this issue doesn't already exist
This issue is specific to MemOS and not a general software issue
Bug Description
Summary
In core/pipeline/deps.ts, the captureRunner is wired with reflectLlm: deps.reflectLlm (the skill-evolver model). This means the capture pipeline's batch reflection — which requires JSON output — runs on the skill-evolver model instead of the main llm. When skillEvolver.enableThinking=true and llm.enableThinking=false (as configured for Qwen3), the capture reflection gets enable_thinking=true, producing malformed JSON with <think> tags that fail to parse.
Root Cause
// deps.ts line ~216constcaptureRunner=createCaptureRunner({
...
llm: deps.llm,reflectLlm: deps.reflectLlm,// ← BUG: should be deps.llm
...
});
Inside capture.ts (line ~286), the batch reflection prefers reflectLlm:
constrLlm=deps.reflectLlm??deps.llm;
So when reflectLlm is set (skill-evolver with enableThinking=true), the capture reflection runs on the wrong model.
Note: The dedicated l3Llm config slot (PR #1959) already addresses L3 abstraction routing. A similar approach could be considered for capture reflection if independent model control is desired.
Summary: Fixes issue #2148 by wiring the capture pipeline's batch reflection to the main llm instead of the skill-evolver reflectLlm client. In apps/memos-local-plugin/core/pipeline/deps.ts, createCaptureRunner({ ..., reflectLlm: deps.reflectLlm, ... }) was routing the JSON-output batch reflection pass to whichever model was configured under skillEvolver.*. When operators set skillEvolver.enableThinking=true alongside llm.enableThinking=false (the typical Qwen3 setup on SiliconFlow), the reflection call returned prose containing <think>...</think> blocks that broke JSON parsing and produced malformed JSON errors during capture summarisation.
The one-line wiring change now passes deps.llm into the capture runner's reflectLlm slot, matching the l3Llm-style routing rationale from PR #1959: JSON tasks stay on the non-thinking main model, and the dedicated reflectLlm client remains exposed on PipelineDeps for reward-evaluator metadata and the overview health endpoint (both unchanged). Inline comments in deps.ts explain the rationale so future edits can't reintroduce the regression.
A dedicated regression test at apps/memos-local-plugin/tests/unit/pipeline/capture-reflect-llm-wiring.test.ts intercepts createCaptureRunner via vi.mock, feeds distinguishable fake llm / reflectLlm clients into buildPipelineSubscribers, and asserts the capture runner receives the main llm in the reflectLlm slot in both normal and lightweight modes. The test was verified RED on the unfixed code and GREEN after the fix.
Activity
Memtensor-AI commentedon Jul 23, 2026
🤖 AutoDev has picked up this issue and started working on it.
Task ID:
7fd6a9dcc8cfb82eWorking branch:
bugfix/autodev-2148-20260723095748278Target branch:
latest dev* branchWorkflow: opsp (analysis → coding → testing → PR)
I will post the PR link here once done. If I need more information, I will ask in the comments.
fix(plugin): wire capture reflection to main llm (MemTensor#2148)
Memtensor-AI commentedon Jul 23, 2026
✅ AutoDev task
7fd6a9dcc8cfb82ecompleted.Summary: Fixes issue #2148 by wiring the capture pipeline's batch reflection to the main
llminstead of the skill-evolverreflectLlmclient. Inapps/memos-local-plugin/core/pipeline/deps.ts,createCaptureRunner({ ..., reflectLlm: deps.reflectLlm, ... })was routing the JSON-output batch reflection pass to whichever model was configured underskillEvolver.*. When operators setskillEvolver.enableThinking=truealongsidellm.enableThinking=false(the typical Qwen3 setup on SiliconFlow), the reflection call returned prose containing<think>...</think>blocks that broke JSON parsing and producedmalformed JSONerrors during capture summarisation.The one-line wiring change now passes
deps.llminto the capture runner'sreflectLlmslot, matching the l3Llm-style routing rationale from PR #1959: JSON tasks stay on the non-thinking main model, and the dedicatedreflectLlmclient remains exposed onPipelineDepsfor reward-evaluator metadata and the overview health endpoint (both unchanged). Inline comments indeps.tsexplain the rationale so future edits can't reintroduce the regression.A dedicated regression test at
apps/memos-local-plugin/tests/unit/pipeline/capture-reflect-llm-wiring.test.tsinterceptscreateCaptureRunnerviavi.mock, feeds distinguishable fakellm/reflectLlmclients intobuildPipelineSubscribers, and asserts the capture runner receives the main llm in thereflectLlmslot in both normal and lightweight modes. The test was verified RED on the unfixed code and GREEN after the fix.Verification:
pnpm exec vitest run tests/unit— 142 files / 1192 passed / 1 skipped.pnpm exec tsc -p tsconfig.json --noEmit— no errors. Branch pushed to origin. Reviewers: @whipser030, @hijzy.Base branch:
mainBranch:
bugfix/autodev-2148-20260723095748278Commit:
6cb5af1PR: #2151
Assigned to: @bittergreen
Reviewers: @whipser030, @hijzy
docs(plugin): clarify reflectLlm exposure comment (MemTensor#2148 OCR…
Fix #2148: [Bug] captureRunner uses reflectLlm (skill-evolver) for ba…
release: merge dev-v2.0.25 into main (MemTensor#2156)
fix(pipeline): wire attachSkillSubscriber with bgReflectLlm
release: merge dev-v2.0.25 into main (MemTensor#2156)