From 93844e2adbcbd3660fd0b521b865d9a53a15e87c Mon Sep 17 00:00:00 2001
From: Dmitrii Zhukov
Date: Tue, 3 Nov 2026 23:29:29 +0700
Subject: [PATCH 01/91] fix(hooks): keep truncation from splitting a surrogate
pair (#1598)
subagent-stop, post-tool-failure, task-completed, session-end and
truncateCaptureOutput, which post-tool-use applies to tool output, cut
captured text with slice(0, n). An emoji at the limit was split, and the
hook sent a lone high surrogate.
The cut now goes through truncateText, which steps back one unit when it
would land inside a pair, as stop.ts and the server-side truncation
already do. Text within the limit is unchanged.
Signed-off-by: Dmitrii Zhukov
Co-authored-by: Rohit Ghumare
---
plugin/scripts/post-tool-failure.mjs | 9 +-
plugin/scripts/post-tool-use.mjs | 9 +-
plugin/scripts/session-end.mjs | 11 +-
plugin/scripts/subagent-stop.mjs | 9 +-
plugin/scripts/task-completed.mjs | 9 +-
src/hooks/_capture-filter.ts | 10 +-
src/hooks/post-tool-failure.ts | 10 +-
src/hooks/session-end.ts | 5 +-
src/hooks/subagent-stop.ts | 3 +-
src/hooks/task-completed.ts | 3 +-
test/capture-filter.test.ts | 15 +++
test/hook-truncation.test.ts | 162 +++++++++++++++++++++++++++
12 files changed, 236 insertions(+), 19 deletions(-)
create mode 100644 test/hook-truncation.test.ts
diff --git a/plugin/scripts/post-tool-failure.mjs b/plugin/scripts/post-tool-failure.mjs
index acb2d67a80..85cf906e5c 100755
--- a/plugin/scripts/post-tool-failure.mjs
+++ b/plugin/scripts/post-tool-failure.mjs
@@ -43,6 +43,11 @@ function shouldCaptureTool(toolName) {
if (allow) return matchesAny(toolName, allow);
return !matchesAny(toolName, [...DEFAULT_DENY_PATTERNS, ...parseEnvList(process.env["AGENTMEMORY_CAPTURE_DENY"]) ?? []]);
}
+function truncateText(value, max) {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
//#endregion
//#region src/hooks/_project.ts
function resolveProject(cwd) {
@@ -116,8 +121,8 @@ async function main() {
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
data: {
tool_name: toolName,
- tool_input: typeof toolInput === "string" ? toolInput.slice(0, 4e3) : JSON.stringify(toolInput ?? "").slice(0, 4e3),
- error: typeof error === "string" ? error.slice(0, 4e3) : JSON.stringify(error ?? "").slice(0, 4e3)
+ tool_input: typeof toolInput === "string" ? truncateText(toolInput, 4e3) : truncateText(JSON.stringify(toolInput ?? ""), 4e3),
+ error: typeof error === "string" ? truncateText(error, 4e3) : truncateText(JSON.stringify(error ?? ""), 4e3)
}
}, data), OBSERVE_TIMEOUT_MS);
setTimeout(() => process.exit(0), EXIT_CAP_MS).unref();
diff --git a/plugin/scripts/post-tool-use.mjs b/plugin/scripts/post-tool-use.mjs
index 7cdb56ab61..08c542899a 100755
--- a/plugin/scripts/post-tool-use.mjs
+++ b/plugin/scripts/post-tool-use.mjs
@@ -49,16 +49,21 @@ function captureOutputMax() {
const parsed = Number.parseInt(raw, 10);
return Number.isFinite(parsed) && parsed > 0 ? parsed : 8e3;
}
+function truncateText(value, max) {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
function truncateCaptureOutput(value, max) {
if (typeof value === "string" && value.length > max) {
const suffix = "\n[...truncated]";
- return max <= 15 ? suffix.slice(0, max) : value.slice(0, max - 15) + suffix;
+ return max <= 15 ? suffix.slice(0, max) : truncateText(value, max - 15) + suffix;
}
if (typeof value === "object" && value !== null) {
const str = JSON.stringify(value);
if (str.length > max) {
const suffix = "...[truncated]";
- return max <= 14 ? suffix.slice(0, max) : str.slice(0, max - 14) + suffix;
+ return max <= 14 ? suffix.slice(0, max) : truncateText(str, max - 14) + suffix;
}
return value;
}
diff --git a/plugin/scripts/session-end.mjs b/plugin/scripts/session-end.mjs
index 2e3b64f6ca..41da8868bb 100755
--- a/plugin/scripts/session-end.mjs
+++ b/plugin/scripts/session-end.mjs
@@ -3,6 +3,13 @@ import { readFileSync, realpathSync } from "node:fs";
import { execSync } from "node:child_process";
import { basename, dirname, resolve } from "node:path";
import { REST_URL, authHeaders, captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.mjs";
+//#region src/hooks/_capture-filter.ts
+function truncateText(value, max) {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
+//#endregion
//#region src/hooks/_project.ts
function resolveProject(cwd) {
const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
@@ -85,7 +92,7 @@ function extractTranscriptPrompts(data) {
if (prompts.length >= 50) return prompts;
const match = msg.content.match(/\n?([\s\S]*?)\n?<\/USER_REQUEST>/);
const text = (match ? match[1] : msg.content).trim();
- if (text) prompts.push({ prompt: text.slice(0, 8e3) });
+ if (text) prompts.push({ prompt: truncateText(text, 8e3) });
continue;
}
if (!isUserTurn(msg)) continue;
@@ -95,7 +102,7 @@ function extractTranscriptPrompts(data) {
for (const text of promptId ? [texts.join("\n\n")].filter(Boolean) : texts) {
if (prompts.length >= 50) return prompts;
prompts.push({
- prompt: text.slice(0, 8e3),
+ prompt: truncateText(text, 8e3),
promptId,
timestamp
});
diff --git a/plugin/scripts/subagent-stop.mjs b/plugin/scripts/subagent-stop.mjs
index b67517f9fa..77bd223db3 100755
--- a/plugin/scripts/subagent-stop.mjs
+++ b/plugin/scripts/subagent-stop.mjs
@@ -3,6 +3,13 @@ import { execSync } from "node:child_process";
import { realpathSync } from "node:fs";
import { basename, dirname, resolve } from "node:path";
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.mjs";
+//#region src/hooks/_capture-filter.ts
+function truncateText(value, max) {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
+//#endregion
//#region src/hooks/_project.ts
function resolveProject(cwd) {
const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
@@ -63,7 +70,7 @@ async function main() {
const sessionId = data.session_id || data.sessionId || data.conversation_id || "unknown";
const agentId = data.agent_id || data.agentName;
const agentType = data.agent_type || data.agentDisplayName || data.agentName;
- const lastMsg = typeof data.last_assistant_message === "string" ? data.last_assistant_message.slice(0, 4e3) : "";
+ const lastMsg = typeof data.last_assistant_message === "string" ? truncateText(data.last_assistant_message, 4e3) : "";
const cwd = hookCwd(data) || process.cwd();
const body = {
hookType: "subagent_stop",
diff --git a/plugin/scripts/task-completed.mjs b/plugin/scripts/task-completed.mjs
index 2b4aab2cc8..d92bb7240e 100755
--- a/plugin/scripts/task-completed.mjs
+++ b/plugin/scripts/task-completed.mjs
@@ -3,6 +3,13 @@ import { execSync } from "node:child_process";
import { realpathSync } from "node:fs";
import { basename, dirname, resolve } from "node:path";
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.mjs";
+//#region src/hooks/_capture-filter.ts
+function truncateText(value, max) {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
+//#endregion
//#region src/hooks/_project.ts
function resolveProject(cwd) {
const explicit = process.env["AGENTMEMORY_PROJECT_NAME"];
@@ -71,7 +78,7 @@ async function main() {
data: {
task_id: data.task_id,
task_subject: data.task_subject,
- task_description: typeof data.task_description === "string" ? data.task_description.slice(0, 2e3) : "",
+ task_description: typeof data.task_description === "string" ? truncateText(data.task_description, 2e3) : "",
teammate_name: data.teammate_name,
team_name: data.team_name
}
diff --git a/src/hooks/_capture-filter.ts b/src/hooks/_capture-filter.ts
index 4c57a70908..762f52420e 100644
--- a/src/hooks/_capture-filter.ts
+++ b/src/hooks/_capture-filter.ts
@@ -60,12 +60,18 @@ export function captureOutputMax(): number {
return Number.isFinite(parsed) && parsed > 0 ? parsed : 8000;
}
+export function truncateText(value: string, max: number): string {
+ if (value.length <= max) return value;
+ const end = /[\uD800-\uDBFF]/.test(value[max - 1] ?? "") ? max - 1 : max;
+ return value.slice(0, end);
+}
+
export function truncateCaptureOutput(value: unknown, max: number): unknown {
if (typeof value === "string" && value.length > max) {
const suffix = "\n[...truncated]";
return max <= suffix.length
? suffix.slice(0, max)
- : value.slice(0, max - suffix.length) + suffix;
+ : truncateText(value, max - suffix.length) + suffix;
}
if (typeof value === "object" && value !== null) {
const str = JSON.stringify(value);
@@ -73,7 +79,7 @@ export function truncateCaptureOutput(value: unknown, max: number): unknown {
const suffix = "...[truncated]";
return max <= suffix.length
? suffix.slice(0, max)
- : str.slice(0, max - suffix.length) + suffix;
+ : truncateText(str, max - suffix.length) + suffix;
}
return value;
}
diff --git a/src/hooks/post-tool-failure.ts b/src/hooks/post-tool-failure.ts
index 5b26bb4826..372da6b1a7 100644
--- a/src/hooks/post-tool-failure.ts
+++ b/src/hooks/post-tool-failure.ts
@@ -1,5 +1,5 @@
#!/usr/bin/env node
-import { shouldCaptureTool } from "./_capture-filter.js";
+import { shouldCaptureTool, truncateText } from "./_capture-filter.js";
import { resolveProject, hookCwd } from "./_project.js";
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.js";
@@ -51,12 +51,12 @@ async function main() {
tool_name: toolName,
tool_input:
typeof toolInput === "string"
- ? toolInput.slice(0, 4000)
- : JSON.stringify(toolInput ?? "").slice(0, 4000),
+ ? truncateText(toolInput, 4000)
+ : truncateText(JSON.stringify(toolInput ?? ""), 4000),
error:
typeof error === "string"
- ? error.slice(0, 4000)
- : JSON.stringify(error ?? "").slice(0, 4000),
+ ? truncateText(error, 4000)
+ : truncateText(JSON.stringify(error ?? ""), 4000),
},
},
data,
diff --git a/src/hooks/session-end.ts b/src/hooks/session-end.ts
index f39a9b6a86..a6a1a1fedb 100644
--- a/src/hooks/session-end.ts
+++ b/src/hooks/session-end.ts
@@ -1,5 +1,6 @@
#!/usr/bin/env node
import { readFileSync } from "node:fs";
+import { truncateText } from "./_capture-filter.js";
import { resolveProject, hookCwd } from "./_project.js";
import { REST_URL, authHeaders, captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.js";
@@ -75,7 +76,7 @@ function extractTranscriptPrompts(data: Record): TranscriptProm
if (prompts.length >= 50) return prompts;
const match = msg.content.match(/\n?([\s\S]*?)\n?<\/USER_REQUEST>/);
const text = (match ? match[1] : msg.content).trim();
- if (text) prompts.push({ prompt: text.slice(0, 8000) });
+ if (text) prompts.push({ prompt: truncateText(text, 8000) });
continue;
}
if (!isUserTurn(msg)) continue;
@@ -84,7 +85,7 @@ function extractTranscriptPrompts(data: Record): TranscriptProm
const timestamp = typeof msg.timestamp === "string" ? msg.timestamp : undefined;
for (const text of promptId ? [texts.join("\n\n")].filter(Boolean) : texts) {
if (prompts.length >= 50) return prompts;
- prompts.push({ prompt: text.slice(0, 8000), promptId, timestamp });
+ prompts.push({ prompt: truncateText(text, 8000), promptId, timestamp });
}
}
return prompts;
diff --git a/src/hooks/subagent-stop.ts b/src/hooks/subagent-stop.ts
index 181f7bf176..f2e7d248e5 100644
--- a/src/hooks/subagent-stop.ts
+++ b/src/hooks/subagent-stop.ts
@@ -1,4 +1,5 @@
#!/usr/bin/env node
+import { truncateText } from "./_capture-filter.js";
import { resolveProject, hookCwd } from "./_project.js";
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.js";
@@ -33,7 +34,7 @@ async function main() {
const agentType = data.agent_type || data.agentDisplayName || data.agentName;
const lastMsg =
typeof data.last_assistant_message === "string"
- ? data.last_assistant_message.slice(0, 4000)
+ ? truncateText(data.last_assistant_message, 4000)
: "";
const cwd = hookCwd(data) || process.cwd();
diff --git a/src/hooks/task-completed.ts b/src/hooks/task-completed.ts
index 25550c4b99..691401611c 100644
--- a/src/hooks/task-completed.ts
+++ b/src/hooks/task-completed.ts
@@ -1,4 +1,5 @@
#!/usr/bin/env node
+import { truncateText } from "./_capture-filter.js";
import { resolveProject, hookCwd } from "./_project.js";
import { captureObservation, isDrainChild, runDrainChild, withEventId } from "./_capture.js";
@@ -44,7 +45,7 @@ async function main() {
task_id: data.task_id,
task_subject: data.task_subject,
task_description: typeof data.task_description === "string"
- ? data.task_description.slice(0, 2000)
+ ? truncateText(data.task_description, 2000)
: "",
teammate_name: data.teammate_name,
team_name: data.team_name,
diff --git a/test/capture-filter.test.ts b/test/capture-filter.test.ts
index 28869ff24f..0d576103b7 100644
--- a/test/capture-filter.test.ts
+++ b/test/capture-filter.test.ts
@@ -5,6 +5,7 @@ import {
preCompactBudget,
shouldCaptureTool,
truncateCaptureOutput,
+ truncateText,
} from "../src/hooks/_capture-filter.js";
describe("bareToolName", () => {
@@ -101,6 +102,20 @@ describe("captureOutputMax", () => {
});
});
+describe("truncateText", () => {
+ it("returns text within the limit unchanged", () => {
+ expect(truncateText("ab\u{1F600}", 4)).toBe("ab\u{1F600}");
+ });
+
+ it("keeps a surrogate pair that ends exactly at the limit", () => {
+ expect(truncateText("ab\u{1F600}c", 4)).toBe("ab\u{1F600}");
+ });
+
+ it("drops a surrogate pair that the limit would split", () => {
+ expect(truncateText("ab\u{1F600}c", 3)).toBe("ab");
+ });
+});
+
describe("truncateCaptureOutput", () => {
it("leaves short strings alone", () => {
expect(truncateCaptureOutput("hello", 20)).toBe("hello");
diff --git a/test/hook-truncation.test.ts b/test/hook-truncation.test.ts
new file mode 100644
index 0000000000..b14f3ce11e
--- /dev/null
+++ b/test/hook-truncation.test.ts
@@ -0,0 +1,162 @@
+import { describe, it, expect, beforeAll, afterAll } from "vitest";
+import { spawn } from "node:child_process";
+import { createServer, type Server } from "node:http";
+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+
+const HOOKS_DIR = join(import.meta.dirname, "..", "plugin", "scripts");
+const SESSION = "ses_hook_truncation";
+const SMILE = "\u{1F600}";
+const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(? Record;
+ field: (data: Record) => unknown;
+};
+
+const base = { session_id: SESSION, cwd: "/work/hook-truncation" };
+let home = "";
+let transcripts = 0;
+
+const sites: Site[] = [
+ {
+ name: "subagent-stop reply",
+ script: "subagent-stop.mjs",
+ payload: (text) => ({ ...base, agent_id: "a1", last_assistant_message: text }),
+ field: (data) => data.last_message,
+ },
+ {
+ name: "task-completed description",
+ script: "task-completed.mjs",
+ payload: (text) => ({ ...base, task_id: "t1", task_description: text }),
+ field: (data) => data.task_description,
+ },
+ {
+ name: "post-tool-failure string input",
+ script: "post-tool-failure.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: text, error: "exit 1" }),
+ field: (data) => data.tool_input,
+ },
+ {
+ name: "post-tool-failure object input",
+ script: "post-tool-failure.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: { command: text }, error: "exit 1" }),
+ field: (data) => data.tool_input,
+ },
+ {
+ name: "post-tool-failure error",
+ script: "post-tool-failure.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: "ls", error: text }),
+ field: (data) => data.error,
+ },
+ {
+ name: "post-tool-failure object error",
+ script: "post-tool-failure.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: "ls", error: { message: text } }),
+ field: (data) => data.error,
+ },
+ {
+ name: "post-tool-use string output",
+ script: "post-tool-use.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: { command: "ls" }, tool_response: text }),
+ field: (data) => data.tool_output,
+ },
+ {
+ name: "post-tool-use object output",
+ script: "post-tool-use.mjs",
+ payload: (text) => ({ ...base, tool_name: "Bash", tool_input: { command: "ls" }, tool_response: { stdout: text } }),
+ field: (data) => data.tool_output,
+ },
+ {
+ name: "session-end transcript prompt",
+ script: "session-end.mjs",
+ payload: (text) => {
+ const transcript = join(home, `transcript-${++transcripts}.jsonl`);
+ writeFileSync(transcript, JSON.stringify({ type: "user", message: { role: "user", content: text } }) + "\n");
+ return { ...base, transcript_path: transcript };
+ },
+ field: (data) => data.prompt,
+ },
+ {
+ name: "session-end explicit user input",
+ script: "session-end.mjs",
+ payload: (text) => {
+ const transcript = join(home, `transcript-${++transcripts}.jsonl`);
+ const content = `\n${text}\n`;
+ writeFileSync(transcript, JSON.stringify({ type: "USER_INPUT", source: "USER_EXPLICIT", content }) + "\n");
+ return { ...base, transcript_path: transcript };
+ },
+ field: (data) => data.prompt,
+ },
+];
+
+describe("hook truncation at a surrogate pair", () => {
+ let server: Server;
+ let received: Array<{ path: string; body: Record }>;
+ let env: Record;
+
+ beforeAll(async () => {
+ received = [];
+ server = createServer((req, res) => {
+ let raw = "";
+ req.on("data", (c) => (raw += c));
+ req.on("end", () => {
+ try {
+ received.push({ path: req.url ?? "", body: JSON.parse(raw) });
+ } catch {}
+ res.writeHead(201, { "content-type": "application/json" });
+ res.end(JSON.stringify({ status: "accepted" }));
+ });
+ });
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", () => resolve()));
+ const addr = server.address();
+ const port = typeof addr === "object" && addr ? addr.port : 0;
+ home = mkdtempSync(join(tmpdir(), "am-hook-truncation-"));
+ env = {
+ PATH: process.env["PATH"] ?? "",
+ HOME: home,
+ AGENTMEMORY_URL: `http://127.0.0.1:${port}`,
+ AGENTMEMORY_CAPTURE_SPOOL_DIR: join(home, "spool"),
+ };
+ });
+
+ afterAll(async () => {
+ await new Promise((resolve) => server.close(() => resolve()));
+ rmSync(home, { recursive: true, force: true });
+ });
+
+ async function sent(site: Site, text: string): Promise {
+ const before = received.length;
+ await new Promise((resolve, reject) => {
+ const child = spawn(process.execPath, [join(HOOKS_DIR, site.script)], { env, stdio: ["pipe", "ignore", "ignore"] });
+ child.on("error", reject);
+ child.on("close", () => resolve());
+ child.stdin.end(JSON.stringify(site.payload(text)));
+ });
+ const observed = received.slice(before).filter((r) => r.path === "/agentmemory/observe");
+ expect(observed, site.name).toHaveLength(1);
+ const value = site.field(observed[0]!.body.data as Record);
+ expect(typeof value, site.name).toBe("string");
+ return value as string;
+ }
+
+ const count = (value: string, ch: string) => value.split(ch).length - 1;
+
+ it.each(sites.map((site) => [site.name, site] as const))("%s steps back from a split pair", async (_name, site) => {
+ const kept = count(await sent(site, "x".repeat(LONG)), "x");
+ expect(kept, site.name).toBeLessThan(LONG);
+
+ const split = await sent(site, "x".repeat(kept - 1) + SMILE + "x".repeat(LONG));
+ expect(split).not.toMatch(LONE_SURROGATE);
+ expect(split).not.toContain(SMILE);
+ expect(count(split, "x")).toBe(kept - 1);
+
+ const whole = await sent(site, "x".repeat(kept - 2) + SMILE + "x".repeat(LONG));
+ expect(whole).toContain(SMILE);
+ expect(count(whole, "x")).toBe(kept - 2);
+ });
+});
From 7c73b9caa64adb4b0cce87b9f92a00cc6dcd53ae Mon Sep 17 00:00:00 2001
From: Dmitrii Zhukov
Date: Tue, 3 Nov 2026 23:29:48 +0700
Subject: [PATCH 02/91] fix(sessions): skip session rows without an id in the
sweep (#1645)
* fix(sessions): skip session rows without an id in the sweep
isStaleActive did not look at id, so a stale active row without a string
id reached kv.get(KV.sessions, candidate.id). The engine rejects a
state::get with no key, the row was counted as failed, and since the sweep
can never abandon it, every hourly run reported success: false.
The sweep now skips rows without a non-empty string id, the same check the
sessions endpoint and memory_sessions apply.
Signed-off-by: Dmitrii Zhukov
* test(sessions): drop the any casts from the id-less sweep test
The override matches mockKV's own get signature and the typed sdk.trigger needs no cast, so the new test follows the no-any rule in CONTRIBUTING.
Signed-off-by: Dmitrii Zhukov
---------
Signed-off-by: Dmitrii Zhukov
---
src/functions/session-sweep.ts | 1 +
test/session-sweep.test.ts | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/functions/session-sweep.ts b/src/functions/session-sweep.ts
index 3422eb106f..8f3caf5660 100644
--- a/src/functions/session-sweep.ts
+++ b/src/functions/session-sweep.ts
@@ -24,6 +24,7 @@ export interface SessionSweepResult {
function isStaleActive(session: Session | null, cutoff: number): session is Session {
if (!session || session.status !== "active") return false;
+ if (typeof session.id !== "string" || session.id.length === 0) return false;
const freshness = session.updatedAt ?? session.startedAt;
if (!freshness) return false;
const ts = new Date(freshness).getTime();
diff --git a/test/session-sweep.test.ts b/test/session-sweep.test.ts
index 43dda03466..3f31587172 100644
--- a/test/session-sweep.test.ts
+++ b/test/session-sweep.test.ts
@@ -223,6 +223,29 @@ describe("mem::session-sweep", () => {
expect((await kv.get(KV.sessions, "s-bad"))!.status).toBe("active");
});
+ it("skips stale active rows without a non-empty string id and abandons the rest", async () => {
+ kv.set(KV.sessions, "s-old", session({ id: "s-old", updatedAt: new Date(nowMs - 30 * H).toISOString() }));
+ const { id: _id, ...noId } = session({ updatedAt: new Date(nowMs - 30 * H).toISOString() });
+ const unusable = [noId, { ...noId, id: null }, { ...noId, id: 42 }, { ...noId, id: "" }];
+ unusable.forEach((row, i) => kv.set(KV.sessions, `row-${i}`, row));
+ const realGet = kv.get;
+ const sessionGetKeys: unknown[] = [];
+ kv.get = async (scope: string, key: unknown): Promise => {
+ if (scope === KV.sessions) sessionGetKeys.push(key);
+ if (typeof key !== "string") {
+ throw new Error("deserialization_error: Failed to deserialize input for state::get: missing field `key`");
+ }
+ return realGet(scope, key);
+ };
+ const sweep = await sdk.trigger({ function_id: "mem::session-sweep", payload: {} });
+ expect(sweep).toMatchObject({ success: true, abandoned: 1, failed: 0 });
+ expect(sessionGetKeys.filter((key) => typeof key !== "string" || key === "")).toEqual([]);
+ expect((await realGet(KV.sessions, "s-old"))!.status).toBe("abandoned");
+ for (const i of unusable.keys()) {
+ expect((await realGet(KV.sessions, `row-${i}`))!.status).toBe("active");
+ }
+ });
+
it("writes one audit entry into the current month scope listing the abandoned sessions", async () => {
kv.set(KV.sessions, "s-a", session({ id: "s-a", updatedAt: new Date(nowMs - 30 * H).toISOString() }));
kv.set(KV.sessions, "s-b", session({ id: "s-b", startedAt: new Date(nowMs - 40 * H).toISOString() }));
From e8f010024d287ef482a4fbedacf2ebcd1fe94cb6 Mon Sep 17 00:00:00 2001
From: Junpei Zhang <1259636180@qq.com>
Date: Wed, 4 Nov 2026 00:31:16 +0800
Subject: [PATCH 03/91] fix(cli): verify compose daemon process identity during
reconcile (#1615) (#1622)
* fix(cli): verify compose daemon process identity during reconcile (#1615)
Signed-off-by: pei711 <199601925+pei711@users.noreply.github.com>
* fix(cli): keep Compose state unless the recorded PID is a foreign process
Reconcile cleared the lifecycle state whenever the identity check did
not return a match, so a live daemon lost its record when ps failed or
its binary was replaced while REST was still unready. Identity is now
match, foreign or unknown, and the state is cleared only for a PID
whose command positively belongs to another process. Unknown keeps the
existing error and the saved state.
---------
Signed-off-by: pei711 <199601925+pei711@users.noreply.github.com>
Co-authored-by: pei711 <199601925+pei711@users.noreply.github.com>
Co-authored-by: Rohit Ghumare
---
src/cli.ts | 22 ++++++++++++----------
src/cli/compose-process.ts | 16 ++++++++++++++++
test/cli-engine-startup.test.ts | 9 +++++++++
test/compose-process.test.ts | 30 +++++++++++++++++++++++++++++-
4 files changed, 66 insertions(+), 11 deletions(-)
diff --git a/src/cli.ts b/src/cli.ts
index ee794db4e5..d938636916 100644
--- a/src/cli.ts
+++ b/src/cli.ts
@@ -83,7 +83,7 @@ import {
} from "./cli/engine-config.js";
import { SHUTDOWN_HARD_EXIT_MS, registerStartupCleanup, runStartupCleanup } from "./shutdown.js";
import { processStatIsRunning } from "./cli/process-state.js";
-import { readUnixProcessExecutable, sameResolvedExecutable } from "./cli/compose-process.js";
+import { classifyComposeProcess, readUnixProcessExecutable, type ComposeProcessIdentity } from "./cli/compose-process.js";
import { renderSplash } from "./cli/splash.js";
import { isFirstRun, readPrefs, resetPrefs, writePrefs } from "./cli/preferences.js";
import { runOnboarding } from "./cli/onboarding.js";
@@ -1102,6 +1102,14 @@ function printComposeStartupLogs(): void {
}
function composePidMatches(pid: number, state: ComposeEngineState): boolean {
+ return composePidIdentity(pid, state) === "match";
+}
+
+function composePidIdentity(pid: number, state: ComposeEngineState): ComposeProcessIdentity {
+ return classifyComposeProcess(inspectComposeProcess(pid), state, IS_WINDOWS);
+}
+
+function inspectComposeProcess(pid: number): { command: string; executable: string } | null {
try {
let command = "";
let executable = "";
@@ -1120,15 +1128,9 @@ function composePidMatches(pid: number, state: ComposeEngineState): boolean {
command = execFileSync("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
executable = readUnixProcessExecutable(pid, "linux");
}
- const expectedCommand = command.includes("compose") &&
- command.includes("compose --namespace") &&
- command.includes(state.namespace) &&
- command.includes(state.file);
- if (!expectedCommand) return false;
- if (!executable) return false;
- return sameResolvedExecutable(executable, state.binPath, IS_WINDOWS);
+ return { command, executable };
} catch {
- return false;
+ return null;
}
}
@@ -1510,7 +1512,7 @@ async function reconcilePersistedComposeEngine(): Promise {
const state = readEngineState();
if (state?.kind !== "compose") return false;
if (!(await isEngineRunning())) {
- if (state.composePid && pidAlive(state.composePid)) {
+ if (state.composePid && pidAlive(state.composePid) && composePidIdentity(state.composePid, state) !== "foreign") {
p.log.error(`Worker Compose daemon ${state.composePid} is alive but REST ${state.restPort} is not ready. Inspect ${state.logFile}; use agentmemory stop to reconcile.`);
process.exit(1);
}
diff --git a/src/cli/compose-process.ts b/src/cli/compose-process.ts
index 8fcad387d9..bb5139fd7f 100644
--- a/src/cli/compose-process.ts
+++ b/src/cli/compose-process.ts
@@ -44,6 +44,22 @@ export function sameResolvedExecutable(actual: string, expected: string, windows
}
}
+export type ComposeProcessIdentity = "match" | "foreign" | "unknown";
+
+export function classifyComposeProcess(
+ inspected: { command: string; executable: string } | null,
+ expected: { namespace: string; file: string; binPath: string },
+ windows = false,
+): ComposeProcessIdentity {
+ if (!inspected || !inspected.command) return "unknown";
+ const ownedCommand = inspected.command.includes("compose --namespace") &&
+ inspected.command.includes(expected.namespace) &&
+ inspected.command.includes(expected.file);
+ if (!ownedCommand) return "foreign";
+ if (inspected.executable && sameResolvedExecutable(inspected.executable, expected.binPath, windows)) return "match";
+ return "unknown";
+}
+
export function readUnixProcessExecutable(pid: number, os: "darwin" | "linux"): string {
if (!Number.isSafeInteger(pid) || pid <= 0) return "";
if (os === "darwin") return readMacProcessExecutable(pid);
diff --git a/test/cli-engine-startup.test.ts b/test/cli-engine-startup.test.ts
index 584ba0ee30..329d335536 100644
--- a/test/cli-engine-startup.test.ts
+++ b/test/cli-engine-startup.test.ts
@@ -113,4 +113,13 @@ describe("fresh native engine startup", () => {
expect(source).toContain("function printCapturedStartupStderr()");
expect(source).toContain("redactCredentialUrls(activeStartupStderr.text().trim())");
});
+
+ it("clears unready Compose state only for a PID positively identified as foreign", () => {
+ const reconcileStart = source.indexOf("async function reconcilePersistedComposeEngine");
+ const reconcileEnd = source.indexOf("async function main()", reconcileStart);
+ const reconcileBody = source.slice(reconcileStart, reconcileEnd);
+ expect(reconcileBody).toContain(
+ 'if (state.composePid && pidAlive(state.composePid) && composePidIdentity(state.composePid, state) !== "foreign")',
+ );
+ });
});
diff --git a/test/compose-process.test.ts b/test/compose-process.test.ts
index 2b31cf00ca..ac63421ae8 100644
--- a/test/compose-process.test.ts
+++ b/test/compose-process.test.ts
@@ -3,7 +3,7 @@ import { mkdtempSync, rmSync, symlinkSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
-import { readUnixProcessExecutable, sameResolvedExecutable } from "../src/cli/compose-process.js";
+import { classifyComposeProcess, readUnixProcessExecutable, sameResolvedExecutable } from "../src/cli/compose-process.js";
const children: ChildProcess[] = [];
const temporaryDirectories: string[] = [];
@@ -40,3 +40,31 @@ describe("Compose process executable identity", () => {
expect(sameResolvedExecutable(process.execPath, link)).toBe(true);
});
});
+
+describe("Compose process identity classification", () => {
+ const expected = {
+ namespace: "agentmemory-3111",
+ file: "/home/u/.agentmemory/compose/worker-compose.yaml",
+ binPath: process.execPath,
+ };
+ const ownedCommand = `iii compose --namespace ${expected.namespace} --up --file ${expected.file}`;
+
+ it("matches the recorded daemon command and executable", () => {
+ expect(classifyComposeProcess({ command: ownedCommand, executable: process.execPath }, expected)).toBe("match");
+ });
+
+ it("reports a reused PID running an unrelated command as foreign", () => {
+ expect(classifyComposeProcess({ command: "/bin/sleep 300", executable: "/bin/sleep" }, expected)).toBe("foreign");
+ expect(classifyComposeProcess({ command: "iii compose --namespace agentmemory-3211 --up --file /other.yaml", executable: process.execPath }, expected)).toBe("foreign");
+ });
+
+ it("stays unknown when process inspection fails", () => {
+ expect(classifyComposeProcess(null, expected)).toBe("unknown");
+ expect(classifyComposeProcess({ command: "", executable: "" }, expected)).toBe("unknown");
+ });
+
+ it("stays unknown when the daemon command matches but its executable no longer resolves to the saved binary", () => {
+ expect(classifyComposeProcess({ command: ownedCommand, executable: "" }, expected)).toBe("unknown");
+ expect(classifyComposeProcess({ command: ownedCommand, executable: "/nonexistent/iii (deleted)" }, expected)).toBe("unknown");
+ });
+});
From 7a9d1c079d2f6b4a1e30ce35408f00ab6c8a0f75 Mon Sep 17 00:00:00 2001
From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com>
Date: Tue, 3 Nov 2026 22:07:22 +0530
Subject: [PATCH 04/91] fix(compose): start Worker Compose workers on native
Windows (#1641)
* fix(compose): render cmd-safe worker commands and canonicalized paths on Windows
* test(windows): keep compose evidence when the Windows smoke gate fails
* test(windows): run npm via npm-cli.js and record smoke step outcomes
* fix(compose): match daemon-reported file paths across platforms and provision the Windows smoke engine
* ci(windows): build with bash and smoke-test the packed tarball under cmd
* fix(compose): match 8.3 short paths when verifying the owned Windows project
The Windows smoke gate failed on the second start: Worker Compose reports
the project as \\?\C:\Users\runneradmin\...\worker-compose.yaml while the
CLI holds C:\Users\RUNNER~1\... (an 8.3 short name taken from TEMP).
Stripping the verbatim prefix and lowercasing is not enough, so the CLI
exited with "Compose daemon does not report the owned worker-compose.yaml
project".
sameComposeFile now falls back to realpathSync.native on Windows, which
expands short names, before it normalizes both sides. The POSIX branch
called realpathSync without importing it, so the ReferenceError was
swallowed and symlinked data directories never matched; it is now
imported. Tests cover the short-name match and a POSIX symlink.
* test(windows): assert status lists compose workers and bound smoke subprocesses
The status step wrote agentmemory status output but never checked it, so
the empty "Compose workers:" list from the Windows path mismatch passed
the gate. It now runs after the workers are ready and requires state,
http and agentmemory in the listing.
Also from review: spawnSync calls get a 15 minute timeout and the engine
download a 300 second cap, so a stalled step still records results.json;
the leftover-process probe excludes its own PowerShell process; and a
Windows run without --tarball fails fast with a clear message unless
npm_config_script_shell points at a POSIX shell.
* fix(compose): wait long enough for compose::down to stop every worker
On Windows Worker Compose cannot stop a worker gracefully, so each one
waits out the full 20 second stop_timeout before it is killed. With three
containers compose::down needs about 60 seconds, which is the fixed
timeout agentmemory stop used. The smoke gate showed all three containers
reach "stopped" while the CLI had already reported
"compose::down failed ... TIMEOUT" and exited 1.
The stop timeout is now one constant shared by the render and the CLI,
and the down call waits stop_timeout times the container count plus 30
seconds. A test keeps the two in step.
---
.github/workflows/release-gate.yml | 37 +++
AGENTS.md | 4 +-
README.md | 4 +-
READMEs/README.ar-SA.md | 4 +-
READMEs/README.bn-BD.md | 4 +-
READMEs/README.cs-CZ.md | 4 +-
READMEs/README.da-DK.md | 4 +-
READMEs/README.de-DE.md | 4 +-
READMEs/README.el-GR.md | 4 +-
READMEs/README.es-ES.md | 4 +-
READMEs/README.fi-FI.md | 4 +-
READMEs/README.fr-FR.md | 4 +-
READMEs/README.he-IL.md | 4 +-
READMEs/README.hi-IN.md | 4 +-
READMEs/README.hu-HU.md | 4 +-
READMEs/README.id-ID.md | 4 +-
READMEs/README.it-IT.md | 4 +-
READMEs/README.ja-JP.md | 4 +-
READMEs/README.ko-KR.md | 4 +-
READMEs/README.nb-NO.md | 4 +-
READMEs/README.nl-NL.md | 4 +-
READMEs/README.pl-PL.md | 4 +-
READMEs/README.pt-BR.md | 4 +-
READMEs/README.pt-PT.md | 4 +-
READMEs/README.ro-RO.md | 4 +-
READMEs/README.ru-RU.md | 4 +-
READMEs/README.sv-SE.md | 4 +-
READMEs/README.th-TH.md | 4 +-
READMEs/README.tl-PH.md | 4 +-
READMEs/README.tr-TR.md | 4 +-
READMEs/README.uk-UA.md | 4 +-
READMEs/README.ur-PK.md | 4 +-
READMEs/README.vi-VN.md | 4 +-
READMEs/README.zh-CN.md | 4 +-
READMEs/README.zh-TW.md | 4 +-
assets/tags/light/stat-tests.svg | 4 +-
assets/tags/stat-tests.svg | 4 +-
scripts/docs-sync.state.json | 2 +-
scripts/release-gate/windows-smoke.mjs | 306 +++++++++++++++++++++++++
src/cli.ts | 4 +-
src/cli/compose-control.ts | 41 +++-
src/cli/compose-project.ts | 71 ++++--
test/compose-project.test.ts | 10 +-
test/compose-windows.test.ts | 109 +++++++++
44 files changed, 619 insertions(+), 105 deletions(-)
create mode 100644 scripts/release-gate/windows-smoke.mjs
create mode 100644 test/compose-windows.test.ts
diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.yml
index 05ee45938c..fb929712a4 100644
--- a/.github/workflows/release-gate.yml
+++ b/.github/workflows/release-gate.yml
@@ -86,3 +86,40 @@ jobs:
${{ runner.temp }}/graph-index-gate
if-no-files-found: ignore
retention-days: 14
+
+ windows-smoke:
+ name: windows smoke
+ runs-on: windows-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@v6
+ with:
+ node-version: 22
+ - run: npm install --legacy-peer-deps --no-audit --no-fund
+ - name: Build and pack with the POSIX build script
+ shell: pwsh
+ env:
+ npm_config_script_shell: C:\Program Files\Git\bin\bash.exe
+ run: |
+ New-Item -ItemType Directory -Force -Path "$env:RUNNER_TEMP\windows-smoke-pack" | Out-Null
+ npm run build
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ npm pack --pack-destination "$env:RUNNER_TEMP\windows-smoke-pack"
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - name: Install and run the packed CLI under Windows Worker Compose
+ shell: pwsh
+ run: |
+ $tarballs = @(Get-ChildItem "$env:RUNNER_TEMP\windows-smoke-pack\agentmemory-agentmemory-*.tgz")
+ if ($tarballs.Count -ne 1) { throw "expected one packed tarball, found $($tarballs.Count)" }
+ node scripts/release-gate/windows-smoke.mjs --tarball $tarballs[0].FullName --out "$env:RUNNER_TEMP\windows-smoke"
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ - if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: windows-smoke
+ path: ${{ runner.temp }}/windows-smoke
+ if-no-files-found: ignore
+ retention-days: 14
diff --git a/AGENTS.md b/AGENTS.md
index 6c88f558e2..c53122c1e1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -101,7 +101,7 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).
## Testing
-- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,000+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests.
+- Before every commit run, in order: `npm run build`, `npm run skills:gen`, `npm run docs:sync`, `npm run skills:check`, `npm test` (4,100+ tests). Commit anything the generators changed. CI runs the same build, skills check and tests.
- Before any npm publish: `npm run release:gate` must pass. It installs the packed tarballs into a clean home and runs capture, recovery, restart, export/import, MCP and status checks against the installed CLI (see CONTRIBUTING.md, Release process)
- Mock pattern: `vi.mock("iii-sdk")` with mock `sdk.trigger`, `kv.get/set/list`
- Test files go in `test/` with `.test.ts` extension
@@ -114,4 +114,4 @@ Hook scripts in `src/hooks/` are standalone Node.js scripts (no iii-sdk import).
- 6 MCP resources, 3 MCP prompts
- 12 hooks, 17 skills
- 322+ iii functions
-- 4,000+ tests
+- 4,100+ tests
diff --git a/README.md b/README.md
index 0cc41b258a..b371b080e4 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,7 @@
-
+
@@ -1307,7 +1307,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ar-SA.md b/READMEs/README.ar-SA.md
index 3199b8a8d7..432c2446ec 100644
--- a/READMEs/README.ar-SA.md
+++ b/READMEs/README.ar-SA.md
@@ -71,7 +71,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.bn-BD.md b/READMEs/README.bn-BD.md
index 8fe8425a88..8a85ba1375 100644
--- a/READMEs/README.bn-BD.md
+++ b/READMEs/README.bn-BD.md
@@ -69,7 +69,7 @@
-
+
@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.cs-CZ.md b/READMEs/README.cs-CZ.md
index d0960e654a..6733e9778b 100644
--- a/READMEs/README.cs-CZ.md
+++ b/READMEs/README.cs-CZ.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.da-DK.md b/READMEs/README.da-DK.md
index 0c124bb1b3..986f11e1c0 100644
--- a/READMEs/README.da-DK.md
+++ b/READMEs/README.da-DK.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.de-DE.md b/READMEs/README.de-DE.md
index 25d246df90..7a7aee598b 100644
--- a/READMEs/README.de-DE.md
+++ b/READMEs/README.de-DE.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.el-GR.md b/READMEs/README.el-GR.md
index 9fdaf0a8ed..da436a98c1 100644
--- a/READMEs/README.el-GR.md
+++ b/READMEs/README.el-GR.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.es-ES.md b/READMEs/README.es-ES.md
index 9e646f18ae..9a2add4427 100644
--- a/READMEs/README.es-ES.md
+++ b/READMEs/README.es-ES.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.fi-FI.md b/READMEs/README.fi-FI.md
index 0af45964b9..f0d7093a4f 100644
--- a/READMEs/README.fi-FI.md
+++ b/READMEs/README.fi-FI.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.fr-FR.md b/READMEs/README.fr-FR.md
index 6e8a3510ae..60ed0f017a 100644
--- a/READMEs/README.fr-FR.md
+++ b/READMEs/README.fr-FR.md
@@ -69,7 +69,7 @@
-
+
@@ -1250,7 +1250,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.he-IL.md b/READMEs/README.he-IL.md
index 6cd626a723..580e9069b0 100644
--- a/READMEs/README.he-IL.md
+++ b/READMEs/README.he-IL.md
@@ -71,7 +71,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.hi-IN.md b/READMEs/README.hi-IN.md
index c8fbebef85..04eb563111 100644
--- a/READMEs/README.hi-IN.md
+++ b/READMEs/README.hi-IN.md
@@ -69,7 +69,7 @@
-
+
@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.hu-HU.md b/READMEs/README.hu-HU.md
index 864dbdb03c..2951739da5 100644
--- a/READMEs/README.hu-HU.md
+++ b/READMEs/README.hu-HU.md
@@ -69,7 +69,7 @@
-
+
@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.id-ID.md b/READMEs/README.id-ID.md
index 37ee206858..b9b300ebfc 100644
--- a/READMEs/README.id-ID.md
+++ b/READMEs/README.id-ID.md
@@ -69,7 +69,7 @@
-
+
@@ -1256,7 +1256,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.it-IT.md b/READMEs/README.it-IT.md
index 8bf8a07fc9..76c4267bd3 100644
--- a/READMEs/README.it-IT.md
+++ b/READMEs/README.it-IT.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ja-JP.md b/READMEs/README.ja-JP.md
index ce2d9dee07..5f3bd8dd2d 100644
--- a/READMEs/README.ja-JP.md
+++ b/READMEs/README.ja-JP.md
@@ -69,7 +69,7 @@
-
+
@@ -1255,7 +1255,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ko-KR.md b/READMEs/README.ko-KR.md
index 9958760be9..75ea0ac701 100644
--- a/READMEs/README.ko-KR.md
+++ b/READMEs/README.ko-KR.md
@@ -69,7 +69,7 @@
-
+
@@ -1254,7 +1254,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.nb-NO.md b/READMEs/README.nb-NO.md
index 56ebebc6ba..59f55f0809 100644
--- a/READMEs/README.nb-NO.md
+++ b/READMEs/README.nb-NO.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.nl-NL.md b/READMEs/README.nl-NL.md
index 569d1fb29c..d5f8c62a3d 100644
--- a/READMEs/README.nl-NL.md
+++ b/READMEs/README.nl-NL.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pl-PL.md b/READMEs/README.pl-PL.md
index bdbe4eea32..d20aa558c1 100644
--- a/READMEs/README.pl-PL.md
+++ b/READMEs/README.pl-PL.md
@@ -69,7 +69,7 @@
-
+
@@ -1239,7 +1239,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pt-BR.md b/READMEs/README.pt-BR.md
index b076d8d82e..c6c37e69f3 100644
--- a/READMEs/README.pt-BR.md
+++ b/READMEs/README.pt-BR.md
@@ -69,7 +69,7 @@
-
+
@@ -1247,7 +1247,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.pt-PT.md b/READMEs/README.pt-PT.md
index 36ff810e19..0b57b1b8db 100644
--- a/READMEs/README.pt-PT.md
+++ b/READMEs/README.pt-PT.md
@@ -69,7 +69,7 @@
-
+
@@ -1243,7 +1243,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ro-RO.md b/READMEs/README.ro-RO.md
index 890afccaef..3e1f4c5870 100644
--- a/READMEs/README.ro-RO.md
+++ b/READMEs/README.ro-RO.md
@@ -69,7 +69,7 @@
-
+
@@ -1235,7 +1235,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ru-RU.md b/READMEs/README.ru-RU.md
index af94d55bbb..3ea4e5de29 100644
--- a/READMEs/README.ru-RU.md
+++ b/READMEs/README.ru-RU.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.sv-SE.md b/READMEs/README.sv-SE.md
index a130b39bd2..3c3e72e866 100644
--- a/READMEs/README.sv-SE.md
+++ b/READMEs/README.sv-SE.md
@@ -69,7 +69,7 @@
-
+
@@ -1249,7 +1249,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.th-TH.md b/READMEs/README.th-TH.md
index b549a34e6a..76671822b6 100644
--- a/READMEs/README.th-TH.md
+++ b/READMEs/README.th-TH.md
@@ -69,7 +69,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.tl-PH.md b/READMEs/README.tl-PH.md
index 2d4dcfe47d..ff68ebdba6 100644
--- a/READMEs/README.tl-PH.md
+++ b/READMEs/README.tl-PH.md
@@ -69,7 +69,7 @@
-
+
@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.tr-TR.md b/READMEs/README.tr-TR.md
index 0b08152ae9..a5d36b5299 100644
--- a/READMEs/README.tr-TR.md
+++ b/READMEs/README.tr-TR.md
@@ -69,7 +69,7 @@
-
+
@@ -1241,7 +1241,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.uk-UA.md b/READMEs/README.uk-UA.md
index ad26bff5c1..4033a79f17 100644
--- a/READMEs/README.uk-UA.md
+++ b/READMEs/README.uk-UA.md
@@ -69,7 +69,7 @@
-
+
@@ -1242,7 +1242,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.ur-PK.md b/READMEs/README.ur-PK.md
index 62602b9130..53f941522e 100644
--- a/READMEs/README.ur-PK.md
+++ b/READMEs/README.ur-PK.md
@@ -71,7 +71,7 @@
-
+
@@ -1246,7 +1246,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.vi-VN.md b/READMEs/README.vi-VN.md
index 3a7879a3f5..2be083144f 100644
--- a/READMEs/README.vi-VN.md
+++ b/READMEs/README.vi-VN.md
@@ -69,7 +69,7 @@
-
+
@@ -1251,7 +1251,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.zh-CN.md b/READMEs/README.zh-CN.md
index b12e7fe2fd..a96226f914 100644
--- a/READMEs/README.zh-CN.md
+++ b/READMEs/README.zh-CN.md
@@ -69,7 +69,7 @@
-
+
@@ -1252,7 +1252,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/READMEs/README.zh-TW.md b/READMEs/README.zh-TW.md
index bfd866fee0..5ed8dc3dce 100644
--- a/READMEs/README.zh-TW.md
+++ b/READMEs/README.zh-TW.md
@@ -69,7 +69,7 @@
-
+
@@ -1244,7 +1244,7 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization:
```bash
npm run dev # Hot reload
npm run build # Production build
-npm test # 4,000+ tests
+npm test # 4,100+ tests
npm run test:integration # API tests (requires running services)
```
diff --git a/assets/tags/light/stat-tests.svg b/assets/tags/light/stat-tests.svg
index 915e1bab9d..7248bfad00 100644
--- a/assets/tags/light/stat-tests.svg
+++ b/assets/tags/light/stat-tests.svg
@@ -1,5 +1,5 @@
-