From b13ff68e224da294ad56e8cb66acd780c971cac1 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Sun, 1 Mar 2026 08:04:55 -0600 Subject: [PATCH] fix(api): use generic mosaic-* naming in OpenClawGateway schema and tests Replaces all jarvis-* references with mosaic-* for generic multi-user deployment. --- .mosaic/orchestrator/mission.json | 4 +- .mosaic/orchestrator/session.lock | 8 ---- apps/api/prisma/schema.prisma | 6 +-- .../openclaw-gateway.service.spec.ts | 44 +++++++++---------- 4 files changed, 27 insertions(+), 35 deletions(-) delete mode 100644 .mosaic/orchestrator/session.lock diff --git a/.mosaic/orchestrator/mission.json b/.mosaic/orchestrator/mission.json index 45fc5a4..9368c98 100644 --- a/.mosaic/orchestrator/mission.json +++ b/.mosaic/orchestrator/mission.json @@ -80,8 +80,8 @@ "session_id": "sess-002", "runtime": "unknown", "started_at": "2026-02-28T20:30:13Z", - "ended_at": "", - "ended_reason": "", + "ended_at": "2026-03-01T14:04:00Z", + "ended_reason": "completed", "milestone_at_end": "", "tasks_completed": [], "last_task_id": "" diff --git a/.mosaic/orchestrator/session.lock b/.mosaic/orchestrator/session.lock deleted file mode 100644 index cfdae6f..0000000 --- a/.mosaic/orchestrator/session.lock +++ /dev/null @@ -1,8 +0,0 @@ -{ - "session_id": "sess-002", - "runtime": "unknown", - "pid": 3178395, - "started_at": "2026-02-28T20:30:13Z", - "project_path": "/tmp/ms21-ui-001", - "milestone_id": "" -} diff --git a/apps/api/prisma/schema.prisma b/apps/api/prisma/schema.prisma index f93a37c..6467b40 100644 --- a/apps/api/prisma/schema.prisma +++ b/apps/api/prisma/schema.prisma @@ -1409,10 +1409,10 @@ model Instance { model OpenClawAgent { id String @id @default(cuid()) - name String @unique // "jarvis-main", "jarvis-projects", etc. - displayName String // "Jarvis (Main)", etc. + name String @unique // "mosaic-main", "mosaic-projects", etc. + displayName String // "Main Orchestrator", "Projects", etc. role String // "orchestrator" | "developer" | "researcher" | "operations" - gatewayUrl String // "http://jarvis-main:18789" + gatewayUrl String // "http://mosaic-main:18789" agentId String @default("main") // OpenClaw agent id within that instance model String // "zai/glm-5", "ollama/cogito" isActive Boolean @default(true) diff --git a/apps/api/src/openclaw-gateway/openclaw-gateway.service.spec.ts b/apps/api/src/openclaw-gateway/openclaw-gateway.service.spec.ts index cc5049b..df3f1ac 100644 --- a/apps/api/src/openclaw-gateway/openclaw-gateway.service.spec.ts +++ b/apps/api/src/openclaw-gateway/openclaw-gateway.service.spec.ts @@ -26,7 +26,7 @@ describe("OpenClawGatewayService", () => { }, }; - const tokenEnvKey = "OPENCLAW_TOKEN_JARVIS_MAIN"; + const tokenEnvKey = "OPENCLAW_TOKEN_MOSAIC_MAIN"; beforeEach(async () => { vi.clearAllMocks(); @@ -52,10 +52,10 @@ describe("OpenClawGatewayService", () => { mockPrisma.openClawAgent.findUnique.mockResolvedValue({ id: "agent-1", - name: "jarvis-main", - displayName: "Jarvis (Main)", + name: "mosaic-main", + displayName: "Main Orchestrator", role: "orchestrator", - gatewayUrl: "http://jarvis-main:18789", + gatewayUrl: "http://mosaic-main:18789", agentId: "main", model: "zai/glm-5", isActive: true, @@ -72,13 +72,13 @@ describe("OpenClawGatewayService", () => { }); const chunks: string[] = []; - for await (const chunk of service.streamChat("jarvis-main", messages)) { + for await (const chunk of service.streamChat("mosaic-main", messages)) { chunks.push(chunk); } expect(chunks).toEqual(["Hello", " world"]); expect(mockHttpService.axiosRef.post).toHaveBeenCalledWith( - "http://jarvis-main:18789/v1/chat/completions", + "http://mosaic-main:18789/v1/chat/completions", { model: "openclaw:main", messages, @@ -109,10 +109,10 @@ describe("OpenClawGatewayService", () => { it("throws ServiceUnavailableException when agent is inactive", async () => { mockPrisma.openClawAgent.findUnique.mockResolvedValue({ id: "agent-1", - name: "jarvis-main", - displayName: "Jarvis (Main)", + name: "mosaic-main", + displayName: "Main Orchestrator", role: "orchestrator", - gatewayUrl: "http://jarvis-main:18789", + gatewayUrl: "http://mosaic-main:18789", agentId: "main", model: "zai/glm-5", isActive: false, @@ -122,7 +122,7 @@ describe("OpenClawGatewayService", () => { await expect( (async () => { - for await (const _chunk of service.streamChat("jarvis-main", [])) { + for await (const _chunk of service.streamChat("mosaic-main", [])) { // no-op } })() @@ -134,10 +134,10 @@ describe("OpenClawGatewayService", () => { mockPrisma.openClawAgent.findUnique.mockResolvedValue({ id: "agent-1", - name: "jarvis-main", - displayName: "Jarvis (Main)", + name: "mosaic-main", + displayName: "Main Orchestrator", role: "orchestrator", - gatewayUrl: "http://jarvis-main:18789", + gatewayUrl: "http://mosaic-main:18789", agentId: "main", model: "zai/glm-5", isActive: true, @@ -147,7 +147,7 @@ describe("OpenClawGatewayService", () => { await expect( (async () => { - for await (const _chunk of service.streamChat("jarvis-main", [])) { + for await (const _chunk of service.streamChat("mosaic-main", [])) { // no-op } })() @@ -157,10 +157,10 @@ describe("OpenClawGatewayService", () => { it("throws UnauthorizedException when OpenClaw returns 401", async () => { mockPrisma.openClawAgent.findUnique.mockResolvedValue({ id: "agent-1", - name: "jarvis-main", - displayName: "Jarvis (Main)", + name: "mosaic-main", + displayName: "Main Orchestrator", role: "orchestrator", - gatewayUrl: "http://jarvis-main:18789", + gatewayUrl: "http://mosaic-main:18789", agentId: "main", model: "zai/glm-5", isActive: true, @@ -175,7 +175,7 @@ describe("OpenClawGatewayService", () => { await expect( (async () => { - for await (const _chunk of service.streamChat("jarvis-main", [])) { + for await (const _chunk of service.streamChat("mosaic-main", [])) { // no-op } })() @@ -185,10 +185,10 @@ describe("OpenClawGatewayService", () => { it("throws ServiceUnavailableException when gateway is offline", async () => { mockPrisma.openClawAgent.findUnique.mockResolvedValue({ id: "agent-1", - name: "jarvis-main", - displayName: "Jarvis (Main)", + name: "mosaic-main", + displayName: "Main Orchestrator", role: "orchestrator", - gatewayUrl: "http://jarvis-main:18789", + gatewayUrl: "http://mosaic-main:18789", agentId: "main", model: "zai/glm-5", isActive: true, @@ -203,7 +203,7 @@ describe("OpenClawGatewayService", () => { await expect( (async () => { - for await (const _chunk of service.streamChat("jarvis-main", [])) { + for await (const _chunk of service.streamChat("mosaic-main", [])) { // no-op } })()