Skip to content

Commit 5a1c4b0

Browse files
committed
fix(memory-host): use truncateUtf16Safe for QMD stderr context truncation
1 parent 9566ade commit 5a1c4b0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/memory-host-sdk/src/host/qmd-query-parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Memory Host SDK module implements qmd query parser behavior.
2+
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
23
import { formatErrorMessage } from "./error-utils.js";
34
import { normalizeLowercaseStringOrEmpty } from "./string-utils.js";
45

@@ -81,7 +82,7 @@ function isQmdNoResultsLine(line: string): boolean {
8182

8283
/** Bound stderr context included in parse errors. */
8384
function summarizeQmdStderr(raw: string): string {
84-
return raw.length <= 120 ? raw : `${raw.slice(0, 117)}...`;
85+
return raw.length <= 120 ? raw : `${truncateUtf16Safe(raw, 117)}...`;
8586
}
8687

8788
/** Parse and normalize a strict qmd JSON array payload. */

0 commit comments

Comments
 (0)