Summary
MemWalMock.recall accepts RecallOptions.sort but ignores it. Two equally matching memories are returned oldest-first even with sort: "recent", limit: 1. This makes offline tests of newest-wins memory handoffs differ from the relayer.
Environment
- dev commit:
3e0534e6a7099893515e447033e37f1ea34aa9ca
- SDK: 0.1.8; Node v26.10.0; macOS
- Deterministic offline mock; no LLM, wallet, or production service involved.
Reproduction
const mock = MemWalMock.create();
await mock.rememberAndWait("project release version one");
await mock.rememberAndWait("project release version two");
const result = await mock.recall({
query: "project release",
sort: "recent",
limit: 1,
});
console.log(result.results[0].text);
Actual: project release version one
Expected: project release version two
Default / explicit relevance ordering should retain its existing semantic tie behavior.
Cause and proposed fix
In packages/sdk/src/mock.ts, recall sorts by distance then ascending sequence and truncates immediately, without reading options.sort.
The relayer's RecallSort::candidate_limit uses max(limit, min(5 * limit, 50)) for recent, then select_hits_for_sort selects newest candidates before truncation. The mock can mirror this bounded candidate window and use its deterministic insertion sequence as write-time ordering.
A local patch implementing this passes all 15 mock tests. Three new regressions cover:
- Newest selection before limit, retaining relevance behavior.
- Bounded semantic candidate window.
- Namespace filtering and token budgeting.
Original source: 12 pass / 3 new regressions fail. Patched source: 15 pass / 0 fail. Tests ran offline against TypeScript stripped with Node module hooks; full compiled SDK suite and typecheck have not been run.
This report and proposed patch were prepared with AI assistance. No production requests, credentials, or mainnet writes were used.
Summary
MemWalMock.recallacceptsRecallOptions.sortbut ignores it. Two equally matching memories are returned oldest-first even withsort: "recent", limit: 1. This makes offline tests of newest-wins memory handoffs differ from the relayer.Environment
3e0534e6a7099893515e447033e37f1ea34aa9caReproduction
Actual: project release version one
Expected: project release version two
Default / explicit relevance ordering should retain its existing semantic tie behavior.
Cause and proposed fix
In
packages/sdk/src/mock.ts, recall sorts by distance then ascending sequence and truncates immediately, without readingoptions.sort.The relayer's
RecallSort::candidate_limitusesmax(limit, min(5 * limit, 50))for recent, thenselect_hits_for_sortselects newest candidates before truncation. The mock can mirror this bounded candidate window and use its deterministic insertion sequence as write-time ordering.A local patch implementing this passes all 15 mock tests. Three new regressions cover:
Original source: 12 pass / 3 new regressions fail. Patched source: 15 pass / 0 fail. Tests ran offline against TypeScript stripped with Node module hooks; full compiled SDK suite and typecheck have not been run.
This report and proposed patch were prepared with AI assistance. No production requests, credentials, or mainnet writes were used.