Fix #1514: Auto-recall hardcodes maxResults: 10, ignoring recall.maxResultsDefault config#1986
Open
Memtensor-AI wants to merge 1 commit into
Open
Fix #1514: Auto-recall hardcodes maxResults: 10, ignoring recall.maxResultsDefault config#1986Memtensor-AI wants to merge 1 commit into
Memtensor-AI wants to merge 1 commit into
Conversation
The `before_prompt_build` auto-recall hook in `apps/memos-local-openclaw/index.ts` hardcoded `maxResults: 10` for both the local `engine.search` and `hubSearchMemories` calls, so the configured `recall.maxResultsDefault` was effectively ignored on the auto-recall path. Users who lowered `maxResultsDefault` (e.g. 3 or 5) to reduce auto-injected token cost still got ~10+10 candidates per turn. Adds a new optional `recall.autoRecallMaxResults` config key (per issue #1514 option 2) with the resolution order: autoRecallMaxResults -> maxResultsDefault -> 10 (defensive). This is a strict superset of the simpler "just read maxResultsDefault" fix — when `autoRecallMaxResults` is not set the hook falls through to `maxResultsDefault`, while operators who want a richer `memory_search` result set and a leaner auto-recall set can configure them separately. Tests: new resolveConfig cases cover default-undefined / explicit override / independent control alongside maxResultsDefault. The hook change is a literal-to-variable substitution covered by the type and resolver contract. Refs: #1514 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Description
Fixed issue #1514 — the
before_prompt_buildauto-recall hook inapps/memos-local-openclaw/index.tshardcodedmaxResults: 10for both the localengine.searchand the HubhubSearchMemoriescalls, sorecall.maxResultsDefaultwas effectively ignored on the auto-recall path.The fix introduces a new optional
recall.autoRecallMaxResultsconfig field (option 2 from the issue) and replaces both literal10values withrecallCfg.autoRecallMaxResults ?? recallCfg.maxResultsDefault ?? 10. This is a strict superset of the simpler "just read maxResultsDefault" fix: when the new field is unset the hook falls through tomaxResultsDefault(which defaults to 6), so the effective behaviour for users with no config changes from 10 → 6 — exactly what the issue requests. Operators who want a richermemory_searchset and a leaner auto-recall set can now configure them independently.Touched files:
apps/memos-local-openclaw/index.ts(hook resolution chain + comment),src/config.ts(carry the new field throughresolveConfig),src/types.ts(type declaration with doc comment referencing issue #1514),README.md(Advanced Configuration entry), andtests/config.test.ts(3 new resolveConfig tests: undefined default, explicit override, independent control alongsidemaxResultsDefault).Tests:
npx vitest run tests/config.test.ts tests/integration.test.ts tests/recall.test.ts tests/worker-lifecycle.test.ts→ 39 passed / 0 failed.tsc --noEmitclean. The 5 unrelated failures acrossaccuracy.test.ts/skill-auto-install.test.ts/task-processor.test.ts/update-install.test.tsreproduce identically on the unmodified baseline (verified viagit stashround-trip), so they are pre-existing and out of scope.Related Issue (Required): Fixes #1514
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Automated tests are pending.
Checklist
@MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller please review this PR.
Reviewer Checklist