Skip to content

Commit 94fb898

Browse files
committed
test(active-memory): cover UTF-16-safe log limits
1 parent b800454 commit 94fb898

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

extensions/active-memory/index.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4812,13 +4812,14 @@ describe("active-memory plugin", () => {
48124812
).not.toEqual([]);
48134813
});
48144814

4815-
it("caps active-memory log field lengths", async () => {
4815+
it("caps active-memory log field lengths without splitting surrogate pairs", async () => {
48164816
api.pluginConfig = {
48174817
agents: ["main"],
48184818
logging: true,
48194819
};
48204820
plugin.register(api as unknown as OpenClawPluginApi);
4821-
const hugeSession = `agent:main:${"x".repeat(500)}`;
4821+
const sessionPrefix = `agent:main:${"x".repeat(288)}`;
4822+
const hugeSession = `${sessionPrefix}😀tail`;
48224823

48234824
await hooks.before_prompt_build(
48244825
{ prompt: "what wings should i order? long log value", messages: [] },
@@ -4836,7 +4837,8 @@ describe("active-memory plugin", () => {
48364837
const startLine = infoLines.find((line: string) => line.includes(" start timeoutMs="));
48374838
const line = requireNonEmptyString(startLine, "active memory start log line missing");
48384839
expect(line.length).toBeLessThan(500);
4839-
expect(line).toContain("...");
4840+
expect(line).toContain(`session=${sessionPrefix}...`);
4841+
expect(line).not.toMatch(/[\uD800-\uDFFF]/u);
48404842
});
48414843

48424844
it("uses a canonical agent session key when only sessionId is available", async () => {

0 commit comments

Comments
 (0)