惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
WordPress大学
WordPress大学
小众软件
小众软件
云风的 BLOG
云风的 BLOG
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
宝玉的分享
宝玉的分享
博客园 - Franky
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
D
Docker
博客园 - 聂微东
C
Check Point Blog
H
Help Net Security

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(memory-wiki): truncate import insights safely · openc...
mushuiyu886 · 2026-06-29 · via Recent Commits to openclaw:main

@@ -8,6 +8,24 @@ import { createMemoryWikiTestHarness } from "./test-helpers.js";

8899

const { createVault } = createMemoryWikiTestHarness();

101011+

function hasLoneSurrogate(value: string): boolean {

12+

for (let index = 0; index < value.length; index += 1) {

13+

const code = value.charCodeAt(index);

14+

if (code >= 0xd800 && code <= 0xdbff) {

15+

const next = value.charCodeAt(index + 1);

16+

if (!(next >= 0xdc00 && next <= 0xdfff)) {

17+

return true;

18+

}

19+

index += 1;

20+

continue;

21+

}

22+

if (code >= 0xdc00 && code <= 0xdfff) {

23+

return true;

24+

}

25+

}

26+

return false;

27+

}

28+1129

describe("listMemoryWikiImportInsights", () => {

1230

it("clusters ChatGPT import pages by topic and extracts digest fields", async () => {

1331

const { rootDir, config } = await createVault({

@@ -139,4 +157,57 @@ describe("listMemoryWikiImportInsights", () => {

139157

expect(healthItem?.lastUserLine).toBeUndefined();

140158

expect(healthItem?.assistantOpener).toBeUndefined();

141159

});

160+161+

it("truncates import insight summaries without leaving lone surrogates", async () => {

162+

const { rootDir, config } = await createVault({

163+

prefix: "memory-wiki-import-insights-surrogate-",

164+

initialize: true,

165+

});

166+

await fs.mkdir(path.join(rootDir, "sources"), { recursive: true });

167+

const assistantOpener = `${"a".repeat(178)}😀${"b".repeat(20)}`;

168+

await fs.writeFile(

169+

path.join(rootDir, "sources", "chatgpt-emoji.md"),

170+

renderWikiMarkdown({

171+

frontmatter: {

172+

pageType: "source",

173+

id: "source.chatgpt.emoji",

174+

title: "ChatGPT Export: Emoji truncation",

175+

sourceType: "chatgpt-export",

176+

riskLevel: "low",

177+

riskReasons: [],

178+

labels: ["domain/work", "area/memory", "topic/memory"],

179+

updatedAt: "2026-02-01T12:00:00.000Z",

180+

},

181+

body: [

182+

"# ChatGPT Export: Emoji truncation",

183+

"",

184+

"## Auto Digest",

185+

"- User messages: 1",

186+

"- Assistant messages: 1",

187+

"- First user line: summarize this",

188+

"- Last user line: summarize this",

189+

"- Preference signals:",

190+

" - prefers emoji-safe summaries",

191+

"",

192+

"## Active Branch Transcript",

193+

"### User",

194+

"",

195+

"summarize this",

196+

"",

197+

"### Assistant",

198+

"",

199+

assistantOpener,

200+

"",

201+

].join("\n"),

202+

}),

203+

"utf8",

204+

);

205+206+

const result = await listMemoryWikiImportInsights(config);

207+208+

const item = result.clusters[0]?.items[0];

209+

expect(item?.summary).toBe(`${"a".repeat(178)}…`);

210+

expect(hasLoneSurrogate(item?.summary ?? "")).toBe(false);

211+

expect(item?.summary).not.toContain("�");

212+

});

142213

});