惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
罗磊的独立博客
The GitHub Blog
The GitHub Blog
V
V2EX
Last Week in AI
Last Week in AI
博客园 - 聂微东
MyScale Blog
MyScale Blog
美团技术团队
L
LangChain Blog
博客园 - Franky
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
S
SegmentFault 最新的问题
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Stack Overflow Blog
Stack Overflow Blog
量子位
小众软件
小众软件
宝玉的分享
宝玉的分享
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(googlechat): support spaceType field for DM vs Space ...
Starhappysh · 2026-06-22 · via Recent Commits to openclaw:main

@@ -30,6 +30,34 @@ beforeEach(() => {

3030

accessMocks.applyGoogleChatInboundAccessPolicy.mockReset();

3131

});

323233+

function createInboundClassificationHarness() {

34+

const resolveAgentRoute = vi.fn(() => ({

35+

agentId: "agent-1",

36+

accountId: "work",

37+

sessionKey: "session-1",

38+

}));

39+

const buildContext = vi.fn((payload: unknown) => payload);

40+

const runTurn = vi.fn();

41+

const core = {

42+

logging: { shouldLogVerbose: () => false },

43+

channel: {

44+

routing: { resolveAgentRoute },

45+

session: {

46+

resolveStorePath: () => "/tmp/openclaw-googlechat-test",

47+

readSessionUpdatedAt: () => undefined,

48+

recordInboundSession: vi.fn(),

49+

},

50+

reply: {

51+

resolveEnvelopeFormatOptions: () => ({}),

52+

formatAgentEnvelope: ({ body }: { body: string }) => body,

53+

dispatchReplyWithBufferedBlockDispatcher: vi.fn(),

54+

},

55+

inbound: { buildContext, run: runTurn },

56+

},

57+

} as unknown as GoogleChatCoreRuntime;

58+

return { buildContext, core, resolveAgentRoute, runTurn };

59+

}

60+3361

describe("googlechat monitor bot loop protection", () => {

3462

it("maps accepted bot-authored messages to shared channel-turn facts", () => {

3563

expect(

@@ -159,6 +187,74 @@ describe("googlechat monitor bot loop protection", () => {

159187

});

160188

});

161189190+

describe("googlechat monitor inbound space classification", () => {

191+

const cases = [

192+

{ name: "legacy DM", space: { type: "DM" }, peerKind: "direct" },

193+

{ name: "modern direct message", space: { spaceType: "DIRECT_MESSAGE" }, peerKind: "direct" },

194+

{ name: "single-user bot DM", space: { singleUserBotDm: true }, peerKind: "direct" },

195+

{ name: "modern space", space: { spaceType: "SPACE" }, peerKind: "group" },

196+

{ name: "modern group chat", space: { spaceType: "GROUP_CHAT" }, peerKind: "group" },

197+

{

198+

name: "modern space over legacy DM",

199+

space: { type: "DM", spaceType: "SPACE" },

200+

peerKind: "group",

201+

},

202+

] as const;

203+204+

it.each(cases)("$name uses the expected access and route branch", async ({ space, peerKind }) => {

205+

const { buildContext, core, resolveAgentRoute, runTurn } = createInboundClassificationHarness();

206+

const account = {

207+

accountId: "work",

208+

config: {},

209+

credentialSource: "inline",

210+

} as ResolvedGoogleChatAccount;

211+

const event = {

212+

type: "MESSAGE",

213+

space: { name: "spaces/CLASSIFY", ...space },

214+

message: {

215+

name: "spaces/CLASSIFY/messages/1",

216+

text: "hello",

217+

sender: { name: "users/alice", displayName: "Alice", type: "HUMAN" },

218+

},

219+

} satisfies GoogleChatEvent;

220+221+

accessMocks.applyGoogleChatInboundAccessPolicy.mockResolvedValue({

222+

ok: true,

223+

commandAuthorized: undefined,

224+

effectiveWasMentioned: undefined,

225+

groupBotLoopProtection: undefined,

226+

groupSystemPrompt: undefined,

227+

});

228+229+

await testing.processMessageWithPipeline({

230+

event,

231+

account,

232+

config: {},

233+

runtime: { error: vi.fn(), log: vi.fn() },

234+

core,

235+

mediaMaxMb: 10,

236+

});

237+238+

const isGroup = peerKind === "group";

239+

expect(accessMocks.applyGoogleChatInboundAccessPolicy).toHaveBeenCalledWith(

240+

expect.objectContaining({ isGroup }),

241+

);

242+

expect(resolveAgentRoute).toHaveBeenCalledWith({

243+

cfg: {},

244+

channel: "googlechat",

245+

accountId: "work",

246+

peer: { kind: peerKind, id: "spaces/CLASSIFY" },

247+

});

248+

expect(buildContext).toHaveBeenCalledWith(

249+

expect.objectContaining({

250+

conversation: expect.objectContaining({ kind: isGroup ? "channel" : "direct" }),

251+

extra: expect.objectContaining({ ChatType: isGroup ? "channel" : "direct" }),

252+

}),

253+

);

254+

expect(runTurn).toHaveBeenCalledOnce();

255+

});

256+

});

257+162258

describe("googlechat monitor direct messages", () => {

163259

it("creates typing messages by default", async () => {

164260

const runTurn = vi.fn();