test: use synthetic agent infra fixtures

This commit is contained in:
Peter Steinberger
2026-04-21 01:46:33 +01:00
parent 442da01db4
commit 60a1f01a3e
9 changed files with 28 additions and 28 deletions

View File

@@ -896,7 +896,7 @@ describe("session_status tool", () => {
main: {
sessionId: "status-origin-provider",
updatedAt: 10,
origin: { provider: "discord" },
origin: { provider: "quietchat" },
},
});
@@ -906,9 +906,9 @@ describe("session_status tool", () => {
expect(resolveQueueSettingsMock).toHaveBeenCalledWith(
expect.objectContaining({
channel: "discord",
channel: "quietchat",
sessionEntry: expect.objectContaining({
origin: { provider: "discord" },
origin: { provider: "quietchat" },
}),
}),
);

View File

@@ -67,7 +67,7 @@ describe("sessions tools visibility", () => {
const tool = getSessionsHistoryTool();
const denied = await tool.execute("call1", {
sessionKey: "agent:main:discord:direct:someone-else",
sessionKey: "agent:main:quietchat:direct:someone-else",
});
expect(denied.details).toMatchObject({ status: "forbidden" });
@@ -86,10 +86,10 @@ describe("sessions tools visibility", () => {
const tool = getSessionsHistoryTool();
const result = await tool.execute("call3", {
sessionKey: "agent:main:discord:direct:someone-else",
sessionKey: "agent:main:quietchat:direct:someone-else",
});
expect(result.details).toMatchObject({
sessionKey: "agent:main:discord:direct:someone-else",
sessionKey: "agent:main:quietchat:direct:someone-else",
});
});

View File

@@ -19,7 +19,7 @@ describe("resolveSessionAgentIds", () => {
it("falls back to the configured default when sessionKey is non-agent", () => {
const { sessionAgentId } = resolveSessionAgentIds({
sessionKey: "telegram:slash:123",
sessionKey: "quietchat:slash:123",
config: cfg,
});
expect(sessionAgentId).toBe("beta");
@@ -35,7 +35,7 @@ describe("resolveSessionAgentIds", () => {
it("keeps the agent id for provider-qualified agent sessions", () => {
const { sessionAgentId } = resolveSessionAgentIds({
sessionKey: "agent:beta:slack:channel:c1",
sessionKey: "agent:beta:quietchat:channel:c1",
config: cfg,
});
expect(sessionAgentId).toBe("beta");
@@ -59,7 +59,7 @@ describe("resolveSessionAgentIds", () => {
it("prefers explicit agentId over non-agent session keys", () => {
const { sessionAgentId } = resolveSessionAgentIds({
sessionKey: "telegram:slash:123",
sessionKey: "quietchat:slash:123",
agentId: "main",
config: cfg,
});

View File

@@ -165,7 +165,7 @@ describe("subagent registry seam flow", () => {
runId: "run-1",
childSessionKey: "agent:main:subagent:child",
requesterSessionKey: "agent:main:main",
requesterOrigin: { channel: " discord ", accountId: " acct-1 " },
requesterOrigin: { channel: " quietchat ", accountId: " acct-1 " },
requesterDisplayKey: "main",
task: "finish the task",
cleanup: "delete",
@@ -187,7 +187,7 @@ describe("subagent registry seam flow", () => {
childSessionKey: "agent:main:subagent:child",
childRunId: "run-1",
requesterSessionKey: "agent:main:main",
requesterOrigin: { channel: "discord", accountId: "acct-1" },
requesterOrigin: { channel: "quietchat", accountId: "acct-1" },
task: "finish the task",
cleanup: "delete",
roundOneReply: "final completion reply",
@@ -390,7 +390,7 @@ describe("subagent registry seam flow", () => {
childSessionKey: "agent:main:subagent:killed",
requesterSessionKey: "agent:main:main",
requesterDisplayKey: "main",
requesterOrigin: { channel: "discord", accountId: "acct-1" },
requesterOrigin: { channel: "quietchat", accountId: "acct-1" },
task: "kill after init",
cleanup: "keep",
workspaceDir: "/tmp/killed-workspace",

View File

@@ -51,7 +51,7 @@ describe("sessions_spawn tool", () => {
it("uses subagent runtime by default", async () => {
const tool = createSessionsSpawnTool({
agentSessionKey: "agent:main:main",
agentChannel: "discord",
agentChannel: "quietchat",
agentAccountId: "default",
agentTo: "channel:123",
agentThreadId: "456",
@@ -209,7 +209,7 @@ describe("sessions_spawn tool", () => {
it("routes to ACP runtime when runtime=acp", async () => {
const tool = createSessionsSpawnTool({
agentSessionKey: "agent:main:main",
agentChannel: "discord",
agentChannel: "quietchat",
agentAccountId: "default",
agentTo: "channel:123",
agentThreadId: "456",
@@ -346,7 +346,7 @@ describe("sessions_spawn tool", () => {
it("rejects attachments for ACP runtime", async () => {
const tool = createSessionsSpawnTool({
agentSessionKey: "agent:main:main",
agentChannel: "discord",
agentChannel: "quietchat",
agentAccountId: "default",
agentTo: "channel:123",
agentThreadId: "456",

View File

@@ -78,7 +78,7 @@ describe("agent-events sequencing", () => {
test("omits sessionKey for runs hidden from Control UI", async () => {
resetAgentRunContextForTest();
registerAgentRunContext("run-hidden", {
sessionKey: "session-imessage",
sessionKey: "session-quietchat",
isControlUiVisible: false,
});
@@ -90,7 +90,7 @@ describe("agent-events sequencing", () => {
runId: "run-hidden",
stream: "assistant",
data: { text: "hi" },
sessionKey: "session-imessage",
sessionKey: "session-quietchat",
});
stop();

View File

@@ -24,14 +24,14 @@ describe("resolveApprovalOverGateway", () => {
approvalId: "approval-1",
decision: "allow-once",
gatewayUrl: "ws://gateway.example.test",
clientDisplayName: "Discord approval (default)",
clientDisplayName: "QuietChat approval (default)",
});
expect(hoisted.withOperatorApprovalsGatewayClient).toHaveBeenCalledWith(
{
config: { gateway: { auth: { token: "cfg-token" } } },
gatewayUrl: "ws://gateway.example.test",
clientDisplayName: "Discord approval (default)",
clientDisplayName: "QuietChat approval (default)",
},
expect.any(Function),
);

View File

@@ -1,12 +1,12 @@
import { describe, it, expect } from "vitest";
import { buildAgentSessionKey } from "./resolve-route.js";
describe("Discord Session Key Continuity", () => {
describe("Channel Session Key Continuity", () => {
const agentId = "main";
const channel = "discord";
const channel = "quietchat";
const accountId = "default";
function buildDiscordSessionKey(params: {
function buildChannelSessionKey(params: {
peer: { kind: "direct" | "channel"; id: string };
dmScope?: "main" | "per-peer";
}) {
@@ -23,22 +23,22 @@ describe("Discord Session Key Continuity", () => {
dmScope: "main" | "per-peer";
expectedDmKey: string;
}) {
const dmKey = buildDiscordSessionKey({
const dmKey = buildChannelSessionKey({
peer: { kind: "direct", id: "user123" },
dmScope: params.dmScope,
});
const groupKey = buildDiscordSessionKey({
const groupKey = buildChannelSessionKey({
peer: { kind: "channel", id: "channel456" },
});
expect(dmKey).toBe(params.expectedDmKey);
expect(groupKey).toBe("agent:main:discord:channel:channel456");
expect(groupKey).toBe("agent:main:quietchat:channel:channel456");
expect(dmKey).not.toBe(groupKey);
}
function expectUnknownChannelKeyCase(channelId: string) {
const missingIdKey = buildDiscordSessionKey({
const missingIdKey = buildChannelSessionKey({
peer: { kind: "channel", id: channelId },
});

View File

@@ -3,8 +3,8 @@ import { formatDocsLink } from "./links.js";
describe("formatDocsLink", () => {
it("prepends the docs root when given a relative path", () => {
const out = formatDocsLink("/channels/telegram", "telegram");
expect(out).toContain("https://docs.openclaw.ai/channels/telegram");
const out = formatDocsLink("/channels/quietchat", "quietchat");
expect(out).toContain("https://docs.openclaw.ai/channels/quietchat");
});
it("preserves an absolute http url", () => {