Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(openclaw): send peer_id for session messages (#3115)
huangruiteng092ec1db6d02
diff --git a/examples/openclaw-plugin/client.ts b/examples/openclaw-plugin/client.tsindex 6c87aaf1a..201b9f52a 100644--- a/examples/openclaw-plugin/client.ts+++ b/examples/openclaw-plugin/client.ts@@ -759,19 +759,19 @@ export class OpenVikingClient {}>,actorPeerId?: string,createdAt?: string,- roleId?: string,+ peerId?: string,): Promise<void> {const body: {role: string;- role_id?: string;+ peer_id?: string;parts: typeof parts;created_at?: string;} = { role, parts };if (createdAt) {body.created_at = createdAt;}- if (roleId) {- body.role_id = roleId;+ if (peerId) {+ body.peer_id = peerId;}await this.emitRoutingDebug("session message POST (with parts)",@@ -779,7 +779,7 @@ export class OpenVikingClient {path: `/api/v1/sessions/${encodeURIComponent(sessionId)}/messages`,sessionId,role,- role_id: roleId ?? null,+ peer_id: peerId ?? null,partCount: parts.length,created_at: createdAt ?? null,},diff --git a/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts b/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.tsindex 3b8c9b3a6..2194a9a59 100644--- a/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts+++ b/examples/openclaw-plugin/tests/ut/architecture-boundaries.test.ts@@ -515,7 +515,7 @@ describe("architecture boundaries", () => {it("keeps canonical namespace client tests on the injected transport seam", () => {const clientTestSource = readFileSync(join(rootDir, "tests/ut/client.test.ts"), "utf8");const start = clientTestSource.indexOf('describe("OpenVikingClient canonical namespace policy"');- const end = clientTestSource.indexOf(' it("includes role_id when addSessionMessage receives one"', start);+ const end = clientTestSource.indexOf(' it("includes peer_id when addSessionMessage receives one"', start);expect(start).toBeGreaterThanOrEqual(0);expect(end).toBeGreaterThan(start);@@ -527,7 +527,7 @@ describe("architecture boundaries", () => {it("keeps addSessionMessage client tests on the injected transport seam", () => {const clientTestSource = readFileSync(join(rootDir, "tests/ut/client.test.ts"), "utf8");- const start = clientTestSource.indexOf('it("includes role_id when addSessionMessage receives one"');+ const start = clientTestSource.indexOf('it("includes peer_id when addSessionMessage receives one"');const end = clientTestSource.indexOf('\n});', start);expect(start).toBeGreaterThanOrEqual(0);diff --git a/examples/openclaw-plugin/tests/ut/client.test.ts b/examples/openclaw-plugin/tests/ut/client.test.tsindex 90fccb3b5..e6bad24a3 100644--- a/examples/openclaw-plugin/tests/ut/client.test.ts+++ b/examples/openclaw-plugin/tests/ut/client.test.ts@@ -598,7 +598,7 @@ describe("OpenVikingClient canonical namespace policy", () => {expect(body.target_uri).toBe("viking://user/skills");});- it("includes role_id when addSessionMessage receives one", async () => {+ it("includes peer_id when addSessionMessage receives one", async () => {const transport = vi.fn().mockResolvedValue(okResponse({ session_id: "s1" }));const client = new OpenVikingClient("http://127.0.0.1:1933", "", "agent", 5000, "", "", undefined, false, true, { transport });@@ -613,6 +613,7 @@ describe("OpenVikingClient canonical namespace policy", () => {const [, init] = transport.mock.calls[0] as [string, RequestInit];const body = JSON.parse(String(init.body));- expect(body.role_id).toBe("telegram_12345");+ expect(body.peer_id).toBe("telegram_12345");+ expect(body).not.toHaveProperty("role_id");});});diff --git a/examples/openclaw-plugin/tests/ut/tools.test.ts b/examples/openclaw-plugin/tests/ut/tools.test.tsindex d04a344be..ffed2d702 100644--- a/examples/openclaw-plugin/tests/ut/tools.test.ts+++ b/examples/openclaw-plugin/tests/ut/tools.test.ts@@ -455,7 +455,7 @@ describe("Tool: memory_store (behavioral)", () => {expect(store!.description).toContain("threshold/commit dependent");});- it("uses requesterSenderId to populate role_id for user writes", async () => {+ it("uses requesterSenderId to populate peer_id for user writes", async () => {const openVikingTransport = vi.fn(async (url: string, init?: RequestInit) => {if (url.endsWith("/api/v1/system/status")) {return okResponse({ user: "default" });@@ -494,7 +494,8 @@ describe("Tool: memory_store (behavioral)", () => {const [, init] = messageCall as [string, RequestInit];const body = JSON.parse(String(init.body));expect(body.role).toBe("user");- expect(body.role_id).toBe("wx_user-01_abc");+ expect(body.peer_id).toBe("wx_user-01_abc");+ expect(body).not.toHaveProperty("role_id");});it("uses a temporary session by default instead of the current tool session", async () => {