Skip to content

fix(memory): keep distinct mixed-script memories in search results - #164062

Merged
obviyus merged 1 commit into
openclaw:mainfrom
harshitgupta31415:harshitgupta31415/memory-mixed-script-snippets-ranked-as-duplicates
Oct 3, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
harshitgupta31415:harshitgupta31415/memory-mixed-script-snippets-ranked-as-duplicates

Conversation

@harshitgupta31415

@harshitgupta31415 harshitgupta31415 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes distinct mixed-script memories being ranked as duplicates when they share an English term. For example, server Москва резервная копия and server Берлин погода сегодня both became the single token server, suppressing the second note in search and REM previews.

Fixes #164053.

User Impact

Memory search and Dreaming retain distinct Cyrillic, Arabic, and Indic notes while continuing to remove actual duplicates. Existing ASCII and CJK tokenization is preserved. No configuration, dependency, schema, migration, or public API changes are needed.

Why This Change Was Made

Both consumers use the same similarity tokenizer, so the repair belongs there. The word lane now retains Unicode letters, numbers, and attached combining marks, with NFC normalization. CJK stays in its existing adjacent-bigram/unigram lane, using the original text and insertion order. Ranking weights and Dreaming thresholds are unchanged.

Production delta: +6 lines; tests: +23 lines. The extra word-lane preparation preserves the existing CJK contract while retaining previously discarded words. A direct Unicode substitution for the ASCII expression would also capture CJK whole words and change that contract.

Thanks to @jarimustonen for the earlier Unicode work in #38945. That proposal closed without merging; #150968 covers keyword queries and explicitly excludes MMR. The live upstream tokenizer was still unchanged immediately before publication, and no competing implementation was found.

Evidence

Base: be8190f2f8c4f63eb2a3831a32dfd3e127573fe7.
Head: f512c7cc7aeb0223e1f38469b038ca89707fc580.

  • Red before: the focused regression file had 9 failures and 12 passes on the original tokenizer. The real hybrid merge/selection flow selected the weaker English note instead of the distinct Russian note; REM kept only one distinct candidate.
  • Green after: 94 tests passed across mmr.test.ts, hybrid.test.ts, hybrid.project-ranking.test.ts, temporal-decay.test.ts, and dreaming-phases.test.ts (node scripts/run-vitest.mjs extensions/memory-core/src/memory/mmr.test.ts extensions/memory-core/src/memory/hybrid.test.ts extensions/memory-core/src/memory/hybrid.project-ranking.test.ts extensions/memory-core/src/memory/temporal-decay.test.ts extensions/memory-core/src/dreaming-phases.test.ts --maxWorkers=1). Coverage includes mixed Cyrillic/Arabic/Hindi ranking, accents and combining marks, Thai, CJK adjacency/order, punctuation-only negatives, disabled MMR, true duplicates, relevance, ties, project precedence, decay, and Dreaming policies.
  • Compatibility: 484 ASCII/CJK membership and insertion-order comparisons passed against the tokenizer shipped in v2026.9.7. Only the saved baseline file's SDK import was redirected to the current real helper for the comparison; its tokenizer logic was unchanged.
  • Types: full production extension graph passed with node scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental. The focused changed-test graph also passed, extending the repository's strict extension-test config and retaining its ambient declarations.
  • Lint: type-aware lint passed for both files against that source graph. The ordinary package-boundary preparation timed out generating SDK declarations after 300 seconds; that attempt is not a pass. The source-graph rerun used the wrapper's existing skip-prepare mode and retained type-aware rules.
  • Formatting: the pinned oxfmt 0.68.0 check passed on Linux with the repository config; Windows Application Control blocks the native formatter on this machine. git diff --check passed. The complete two-file diff was manually reviewed; independent review remains pending.

Runtime proof at the exact head, with no mocks:

{"head":"f512c7cc7aeb0223e1f38469b038ca89707fc580","similarity":0.14285714285714285,"selectedPaths":["memory/primary.md","memory/distinct.md"],"distinctRemCandidates":2,"trueDuplicateCount":1,"disabledOrderPreserved":true,"pass":true}
{"head":"f512c7cc7aeb0223e1f38469b038ca89707fc580","flow":"real note -> recordShortTermRecalls -> SQLite -> previewRemHarness","storedEntries":2,"recallCountPerEntry":6,"recallEntryCount":2,"distinctRemCandidates":2,"pass":true}

On the clean base, the persisted flow stored both entries with six recalls each but returned only one REM candidate, then failed the assertion (exit 1). At the exact head it returned both (exit 0).

The first receipt calls the real hybrid merge/selection and REM selection owners. The second writes real notes, records recalls through the real plugin state store, then calls the operator preview implementation against a fresh temporary state directory. Both processes closed successfully with exit 0.

Reproduce the ranking and persisted-preview receipts

Save each script outside the checkout and run it from the repository root with node --import ./scripts/tsx.mjs /absolute/path/to/script.mjs. The assertions fail on the base and pass on the head. The persisted script requires current runtime database-worker artifacts, creates its own temporary fixture, and never uses the operator's state directory.

Ranking/REM owner:

import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import fs from "node:fs/promises";
import path from "node:path";
import { pathToFileURL } from "node:url";

const root = process.cwd();
const load = (relative) => import(pathToFileURL(path.join(root, relative)));
const { mergeHybridResults, selectHybridSearchResults } = await load("extensions/memory-core/src/memory/hybrid.ts");
const { textSimilarity } = await load("extensions/memory-core/src/memory/tokenize.ts");
const { previewRemDreaming } = await load("extensions/memory-core/src/dreaming-phases.ts");
const snippets = ["server Москва резервная копия", "server Берлин погода сегодня", "database connection pool", "garden compost schedule"];
const vector = snippets.map((snippet, index) => ({
  id: ["primary", "distinct", "weak", "tail"][index],
  path: `memory/${["primary", "distinct", "weak", "tail"][index]}.md`,
  startLine: 1, endLine: 1, source: "memory", snippet,
  vectorScore: [1, 0.98, 0.9, 0.1][index],
}));
const merged = await mergeHybridResults({ vector, keyword: [], vectorWeight: 1, textWeight: 0, mmr: { enabled: true, lambda: 0.7 } });
const selected = selectHybridSearchResults({ merged, keyword: [], maxResults: 2, minScore: 0 });
const disabled = await mergeHybridResults({ vector, keyword: [], vectorWeight: 1, textWeight: 0, mmr: { enabled: false } });
const entries = snippets.slice(0, 2).map((snippet, index) => ({
  key: `entry-${index}`, path: "memory/notes.md", startLine: index + 1, endLine: index + 1,
  source: "memory", snippet, recallCount: 6, dailyCount: 0, groundedCount: 0,
  totalScore: 6, maxScore: 1, queryHashes: ["q1", "q2"], recallDays: ["2026-10-01", "2026-10-02", "2026-10-03"],
  conceptTags: [], firstRecalledAt: "2026-10-01T00:00:00.000Z", lastRecalledAt: "2026-10-03T00:00:00.000Z",
}));
const preview = previewRemDreaming({ entries, limit: 3, minPatternStrength: 0.5 });
const duplicatePreview = previewRemDreaming({ entries: [entries[0], { ...entries[1], snippet: snippets[0] }], limit: 3, minPatternStrength: 0.5 });
const expected = ["memory/primary.md", "memory/distinct.md"];
const selectedPaths = selected.map((entry) => entry.path);
const pass = JSON.stringify(selectedPaths) === JSON.stringify(expected) && preview.candidateTruths.length === 2 && duplicatePreview.candidateTruths.length === 1 && JSON.stringify(disabled.map((entry) => entry.path)) === JSON.stringify(vector.map((entry) => entry.path));
console.log(JSON.stringify({
  commit: execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim(),
  sourceSha256: createHash("sha256").update(await fs.readFile(path.join(root, "extensions/memory-core/src/memory/tokenize.ts"))).digest("hex"),
  mocks: [],
  flow: "actual mergeHybridResults -> selectHybridSearchResults, plus REM preview selection",
  similarity: textSimilarity(snippets[0], snippets[1]),
  selectedPaths, expected,
  remCandidates: preview.candidateTruths,
  trueDuplicateCount: duplicatePreview.candidateTruths.length,
  disabledOrderPreserved: JSON.stringify(disabled.map((entry) => entry.path)) === JSON.stringify(vector.map((entry) => entry.path)),
  pass,
}, null, 2));
assert.ok(pass, "Distinct mixed-script memories must survive ranking and REM selection; true duplicates must still collapse");

SQLite-backed operator preview:

import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";

const root = process.cwd();
const fixture = await fs.mkdtemp(path.join(os.tmpdir(), "memory-unicode-proof-"));
process.env.OPENCLAW_STATE_DIR = path.join(fixture, "state");
const load = (relative) => import(pathToFileURL(path.join(root, relative)));
const { recordShortTermRecalls, readShortTermRecallEntries } = await load("extensions/memory-core/src/short-term-promotion.ts");
const { configureMemoryCoreDreamingState } = await load("extensions/memory-core/src/dreaming-state.ts");
const { createPluginStateKeyedStore, closePluginStateDatabaseAsync } = await load("src/plugin-state/plugin-state-store.ts");
configureMemoryCoreDreamingState((options) => createPluginStateKeyedStore("memory-core", options));
const { previewRemHarness } = await load("extensions/memory-core/src/rem-harness.ts");
const workspaceDir = path.join(fixture, "workspace");
const snippets = ["server Москва резервная копия", "server Берлин погода сегодня"];
const nowMs = Date.UTC(2026, 9, 3, 12);
await fs.mkdir(path.join(workspaceDir, "memory"), { recursive: true });
await fs.writeFile(path.join(workspaceDir, "memory/2026-10-03.md"), snippets.join("\n") + "\n");
const results = snippets.map((snippet, index) => ({
  path: "memory/2026-10-03.md", startLine: index + 1, endLine: index + 1,
  source: "memory", snippet, score: 1,
}));
for (let index = 0; index < 6; index++) {
  await recordShortTermRecalls({ workspaceDir, query: `proof-query-${index}`, results, nowMs, timezone: "UTC" });
}
const stored = await readShortTermRecallEntries({ workspaceDir, nowMs });
const preview = await previewRemHarness({ workspaceDir, nowMs, remPreviewLimit: 3 });
const pass = stored.length === 2 && preview.recallEntryCount === 2 && preview.rem.candidateTruths.length === 2;
console.log(JSON.stringify({
  commit: execFileSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).trim(),
  mocks: [],
  flow: "real note -> recordShortTermRecalls -> canonical SQLite recall store -> previewRemHarness",
  storedEntries: stored.map(({ snippet, recallCount }) => ({ snippet, recallCount })),
  recallEntryCount: preview.recallEntryCount,
  candidateTruths: preview.rem.candidateTruths,
  pass,
}, null, 2));
// Retain the isolated fixture path only in the local proof directory for audit.
await fs.writeFile(path.join(path.dirname(fileURLToPath(import.meta.url)), "last-fixture-path.txt"), fixture);
await closePluginStateDatabaseAsync();
assert.ok(pass, "Both distinct persisted notes must appear in the operator's REM preview");

The repository-wide changed-file gate did not pass: conflict-marker, line-cap, max-lines, and assertion-SAFETY checks passed, then the SQLite inventory reported 1333 -> 2077 T1 calls. Running node --import ./scripts/tsx.mjs scripts/check-database-worker-ratchet.mts --base be8190f2f8c4f63eb2a3831a32dfd3e127573fe7 on the clean, detached base be8190f2f8c4f63eb2a3831a32dfd3e127573fe7 reproduced the same failure, with no local changes. Neither changed file adds SQLite access. The combined gate stopped there, so later combined-gate stages are not claimed as executed; the independent test/type/lint/format results above are the checks that completed.

The 94-test run and type/lint checks used the identical source bytes subsequently committed at the head above. Runtime receipts were rerun at that exact head. These exercise the changed ranking owner and a real isolated SQLite-backed operator preview; they do not claim a live model, embedding service, or full Gateway session was run. The full extension-test typegraph was not run locally.

Maintainer verification (exact head)

Verified f512c7cc7aeb0223e1f38469b038ca89707fc580 against current main d6b1cc8d1f7264bb7656da788204dbe874ce5047 in isolated Node 24.21.0 Docker containers. The contributor's code is unchanged. Thanks to @harshitgupta31415 for the report and fix.

Real Gateway path: built each runtime, seeded 15 Markdown notes (Cyrillic, English, CJK; distinct notes, distractors, and exact duplicates), indexed through openclaw --profile <isolated-profile> memory index --force --agent main, and started an isolated Gateway with memory-core. A scripted chat-completions model issued three memory_search tool calls with maxResults: 2 and minScore: 0.01. A local deterministic embeddings server supplied vectors; no paid embeddings were used. Normal builtin hybrid/MMR ranking remained enabled. State/config/index paths were printed by the actual CLI and confined to task-owned container directories.

Observed tool results (citation suffixes omitted):

Case Current main Candidate
Cyrillic server Москва резервная копия; database connection pool server Москва резервная копия; server Берлин погода сегодня
English server Moscow backup archive; server Berlin weather today Same pair and scores
CJK server 東京備份資料; server 北京天氣預報 Same pair and scores

Every group contained an exact copy of its primary note. Neither runtime allowed the copy to consume the second result slot. The Cyrillic primary scored 0.7, the distinct note 0.6860000133514403, and the weaker distractor 0.630000004172325; only current main demoted the distinct note out of the bounded results. The candidate's first harness assertion incorrectly assumed underscores survived tool-call ID normalization and that snippets lacked citation suffixes; the saved original Gateway output passed corrected offline assertions without rerunning the Gateway.

Regression: pnpm test extensions/memory-core/src/memory/mmr.test.ts --maxWorkers=1 passed all 21 tests on the exact head: 2.73 seconds wall time, 1.34 seconds Vitest duration. Running the same candidate regression file against unchanged current-main production source produced 9 failures / 12 passes (2.92 seconds wall time), including all three mixed-script ranking cases: actual primary → weak → distinct versus expected primary → distinct → weak.

Available CI seconds: the exact-head changed-extension job passed in 115 seconds elapsed, including 56 seconds for its Node test shard. Those are shared job/shard measurements, not an isolated per-file CI charge. The CI gate passed. No jobs were rerun.

Live gate: the exact built candidate completed a real Gateway turn with gpt-5-mini, reasoning low, and a 4096-token output budget. A passive proxy forwarded two requests unchanged; both returned HTTP 200. The model called memory_search once and quoted both Cyrillic snippets in its final reply. Embeddings remained local; heartbeat, cron, autonomous workshop, compaction memory flush and utility-model jobs were disabled. The task-only API-key file and live container were removed immediately afterward.

Storage boundary: only ephemeral snippet similarity tokens change. The consumers are MMR ranking and Dreaming snippet comparison. Stored Markdown, embeddings, FTS/index tokenization, index identity and schema are unchanged; no reindex or migration is needed.

No overlap with Pash/Sarah changes.

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@harshitgupta31415
harshitgupta31415 marked this pull request as ready for review October 3, 2026 05:55
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 3:24 AM ET / 07:24 UTC (Revision 3).

ClawSweeper review

What this changes

Memory Core’s shared similarity tokenizer retains Unicode words and combining marks so distinct mixed-script notes survive search ranking and Dreaming selection.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release still exhibit the reported limitation. The prior test-cost follow-up is resolved, real behavior proof is sufficient, and no actionable patch defect remains.

Priority: P2
Reviewed head: f512c7cc7aeb0223e1f38469b038ca89707fc580

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-owner repair has strong production-path evidence, useful regressions, and no remaining concrete blocker.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Exact-head output exercises the changed tokenizer through real Gateway memory_search and isolated SQLite-backed operator REM preview, retaining both distinct Cyrillic notes while suppressing duplicates and preserving English/CJK controls. The complete captured body was inspected; only ephemeral similarity tokens change, so no stored-data migration is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Exact-head output exercises the changed tokenizer through real Gateway memory_search and isolated SQLite-backed operator REM preview, retaining both distinct Cyrillic notes while suppressing duplicates and preserving English/CJK controls. The complete captured body was inspected; only ephemeral similarity tokens change, so no stored-data migration is required.
Evidence reviewed 8 items Verified introduced repair: The pinned introduction diff adds NFC-normalized Unicode word extraction while preserving the original CJK traversal and insertion order. Regression cases exercise mixed Cyrillic, Arabic, and Indic ranking alongside normalization and punctuation controls.
Current main still needs this change: Fetched main extracts only ASCII words plus separate CJK tokens. Both reported Russian snippets therefore reduce to their shared English term.
Latest release remains affected: The tokenizer at v2026.9.8 uses the same ASCII-only word expression; this repair has not already shipped in that release.
Findings None None.
Security None None.

How this fits together

Memory Core compares retrieved and recalled note snippets to reduce duplicate results. Its shared similarity tokenizer feeds both memory-search diversity ranking and Dreaming’s candidate selection.

flowchart TD
 A[Retrieved note snippets] --> C[Shared similarity tokenizer]
 B[Recalled note snippets] --> C
 C --> D[Unicode words and CJK tokens]
 D --> E[Search diversity ranking]
 D --> F[Dreaming duplicate comparison]
 E --> G[Bounded search results]
 F --> H[Distinct memory candidates]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +6, Tests +23. Total +29 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 4 +6
Tests 1 26 3 +23
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 36 7 +29

Review metrics

Metric Value Why it matters
Focused regression cost 21 tests; 2.73 seconds wall time The recorded focused run satisfies the prior test-cost request and stays below the documented file budget.
Available CI cost 115-second job; 56-second shared test shard The body supplies exact-head CI measurements without claiming an isolated per-file charge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #164053
Summary: This PR implements the paired mixed-script similarity repair; keyword-query normalization remains distinct work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep Unicode overlap handling in the shared tokenizer while preserving CJK token order, ranking policy, and stored note bytes.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source reduces both reported Russian snippets to the shared token server, and captured before/after Gateway and REM receipts demonstrate the resulting selection error. This read-only review did not execute target code.

Is this the best way to solve the issue?

Yes: repairing the existing shared tokenizer addresses both consumers without duplicating ranking logic or changing persisted data, configuration, or thresholds.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fea63b009bef.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs bounded memory-ranking and Dreaming selection errors for mixed-script notes without changing configuration or storage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Exact-head output exercises the changed tokenizer through real Gateway memory_search and isolated SQLite-backed operator REM preview, retaining both distinct Cyrillic notes while suppressing duplicates and preserving English/CJK controls. The complete captured body was inspected; only ephemeral similarity tokens change, so no stored-data migration is required.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head output exercises the changed tokenizer through real Gateway memory_search and isolated SQLite-backed operator REM preview, retaining both distinct Cyrillic notes while suppressing duplicates and preserving English/CJK controls. The complete captured body was inspected; only ephemeral similarity tokens change, so no stored-data migration is required.

Evidence

What I checked:

  • Verified introduced repair: The pinned introduction diff adds NFC-normalized Unicode word extraction while preserving the original CJK traversal and insertion order. Regression cases exercise mixed Cyrillic, Arabic, and Indic ranking alongside normalization and punctuation controls. (extensions/memory-core/src/memory/tokenize.ts:10, f512c7cc7aeb)
  • Current main still needs this change: Fetched main extracts only ASCII words plus separate CJK tokens. Both reported Russian snippets therefore reduce to their shared English term. (extensions/memory-core/src/memory/tokenize.ts:8, fea63b009bef)
  • Latest release remains affected: The tokenizer at v2026.9.8 uses the same ASCII-only word expression; this repair has not already shipped in that release. (extensions/memory-core/src/memory/tokenize.ts:8, fc23bc864e45)
  • Shared production consumers: Hybrid search applies the MMR ranking owner before bounded selection. Dreaming imports the same tokenizer’s text similarity and compares same-file recalled snippets before producing REM candidates; the operator preview reads real recall entries and invokes that selection. (extensions/memory-core/src/dreaming-phases.ts:988, f512c7cc7aeb)
  • Complete captured proof inspected: The fetched complete body matches captured SHA-256 416fc286953f3afb27843b8b2dd26da0485f36d5ce852d561f4d21686a285017, resolving the omitted ending. Exact-head receipts show real hybrid selection and note-to-SQLite-to-operator REM preview retaining both distinct notes. Additional isolated Node 24.21.0 Docker Gateway evidence records memory_search returning both Cyrillic notes, unchanged English/CJK controls, duplicate suppression, and a real model reply quoting both notes. Embedded scripts were inspected, never executed. (f512c7cc7aeb)
  • Prior requested measurements resolved: The complete body now reports the required focused pnpm test command passing 21 tests in 2.73 seconds wall time, with 1.34 seconds Vitest duration. It links the exact-head changed-extension CI job reporting 115 seconds elapsed and 56 seconds for its shared test shard, explicitly distinguishing shared CI cost from per-file cost. Public docs: docs/help/testing/writing-tests.md. (docs/help/testing/writing-tests.md:108, f512c7cc7aeb)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Rodrigo Uroz: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Christian Lallo: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-03T06:01:28.178Z sha f512c7c :: needs changes before merge. :: none
  • reviewed 2026-10-03T06:08:21.130Z sha f512c7c :: needs changes before merge. :: none

@obviyus

obviyus commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus
obviyus merged commit 4ec53d9 into openclaw:main Oct 3, 2026
203 of 205 checks passed
@obviyus

obviyus commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Landed as 4ec53d9. Thanks @harshitgupta31415!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…penclaw#164062)

Fixes openclaw#164053.

The memory diversity tokenizer kept only ASCII and CJK text, so mixed-script notes that share one English term reduced to the same tokens and were ranked as duplicates. A relevant note could then drop out of a bounded hybrid search, and Dreaming collapsed distinct snippets. Other scripts are now tokenized too. Only the in-memory MMR/diversity tokenization changes; nothing persisted changes and no reindex is needed.

Proof: on a real isolated Gateway with local stub embeddings, `memory_search` on main dropped the second of two unrelated Cyrillic notes that share "server", and this change returns both. English and CJK result paths, scores and snippets are unchanged, and true duplicates are still collapsed. The regression tests fail on base and pass here. In a live gpt-5-mini turn, `memory_search` returned both notes.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Oct 4, 2026
With MMR, memory search treated canonically equivalent Korean or Japanese snippets in different Unicode normalization forms (NFC vs NFD) as distinct, so duplicates crowded out a distinct relevant result. The shared memory tokenizer now normalizes to NFC, so equivalent text tokenizes the same way. This composes with the mixed-script tokenization from #164062. In Dreaming, the same tokenizer drives recall dedupe and diary coverage, so equivalent snippets now count as one candidate. Existing memory content is never deleted or rewritten, stored index and FTS tokenization are unchanged, and no reindex is needed.

Proof: in a real built Gateway, `memory_search` returned NFC/NFD duplicate pairs for Hangul and kana on base, and the primary snippet plus the distinct one with this change. The Cyrillic mixed-script case and English ordering and scores are unchanged. The Dreaming recall preview collapses the equivalent pair to one candidate and keeps an unrelated snippet. The regression tests fail on base and pass here. A live gpt-5-mini smoke call passed.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…164660)

With MMR, memory search treated canonically equivalent Korean or Japanese snippets in different Unicode normalization forms (NFC vs NFD) as distinct, so duplicates crowded out a distinct relevant result. The shared memory tokenizer now normalizes to NFC, so equivalent text tokenizes the same way. This composes with the mixed-script tokenization from openclaw#164062. In Dreaming, the same tokenizer drives recall dedupe and diary coverage, so equivalent snippets now count as one candidate. Existing memory content is never deleted or rewritten, stored index and FTS tokenization are unchanged, and no reindex is needed.

Proof: in a real built Gateway, `memory_search` returned NFC/NFD duplicate pairs for Hangul and kana on base, and the primary snippet plus the distinct one with this change. The Cyrillic mixed-script case and English ordering and scores are unchanged. The Dreaming recall preview collapses the equivalent pair to one candidate and keeps an unrelated snippet. The regression tests fail on base and pass here. A live gpt-5-mini smoke call passed.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mixed-script memory snippets sharing an English term are ranked as duplicates

2 participants