fix: carry room event gateway actions · openclaw/openclaw@f1351bc
steipete
·
2026-05-16
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -138,6 +138,28 @@ describe("telegram bot message processor", () => {
|
138 | 138 | ); |
139 | 139 | }); |
140 | 140 | |
| 141 | +it("does not send early typing cues for room events", async () => { |
| 142 | +const sendTyping = vi.fn().mockResolvedValue(undefined); |
| 143 | +buildTelegramMessageContext.mockResolvedValue( |
| 144 | +createMessageContext({ |
| 145 | + sendTyping, |
| 146 | +ctxPayload: { |
| 147 | +From: "telegram:123", |
| 148 | +To: "telegram:123", |
| 149 | +ChatType: "group", |
| 150 | +RawBody: "ambient", |
| 151 | +InboundTurnKind: "room_event", |
| 152 | +}, |
| 153 | +}), |
| 154 | +); |
| 155 | + |
| 156 | +const processMessage = createTelegramMessageProcessor(baseDeps); |
| 157 | +await processSampleMessage(processMessage); |
| 158 | + |
| 159 | +expect(sendTyping).not.toHaveBeenCalled(); |
| 160 | +expect(dispatchTelegramMessage).toHaveBeenCalledTimes(1); |
| 161 | +}); |
| 162 | + |
141 | 163 | it("skips dispatch when no context is produced", async () => { |
142 | 164 | buildTelegramMessageContext.mockResolvedValue(null); |
143 | 165 | const processMessage = createTelegramMessageProcessor(baseDeps); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -155,9 +155,11 @@ export const createTelegramMessageProcessor = (deps: TelegramMessageProcessorDep
|
155 | 155 | (options?.ingressBuffer ? ` buffer=${options.ingressBuffer}` : ""), |
156 | 156 | ); |
157 | 157 | } |
158 | | -void context.sendTyping().catch((err) => { |
159 | | -logVerbose(`telegram early typing cue failed for chat ${context.chatId}: ${String(err)}`); |
160 | | -}); |
| 158 | +if (context.ctxPayload.InboundTurnKind !== "room_event") { |
| 159 | +void context.sendTyping().catch((err) => { |
| 160 | +logVerbose(`telegram early typing cue failed for chat ${context.chatId}: ${String(err)}`); |
| 161 | +}); |
| 162 | +} |
161 | 163 | telegramInboundLog.info( |
162 | 164 | formatTelegramInboundLogLine({ |
163 | 165 | from: context.ctxPayload.From, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -79,6 +79,7 @@ export const MessageActionParamsSchema = Type.Object(
|
79 | 79 | senderIsOwner: Type.Optional(Type.Boolean()), |
80 | 80 | sessionKey: Type.Optional(Type.String()), |
81 | 81 | sessionId: Type.Optional(Type.String()), |
| 82 | +inboundTurnKind: Type.Optional(Type.String({ enum: ["user_request", "room_event"] })), |
82 | 83 | agentId: Type.Optional(Type.String()), |
83 | 84 | toolContext: Type.Optional(MessageActionToolContextSchema), |
84 | 85 | idempotencyKey: NonEmptyString, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1265,6 +1265,7 @@ describe("gateway send mirroring", () => {
|
1265 | 1265 | emoji: "✅", |
1266 | 1266 | }, |
1267 | 1267 | requesterSenderId: "trusted-user", |
| 1268 | +inboundTurnKind: "room_event", |
1268 | 1269 | toolContext: { |
1269 | 1270 | currentGraphChannelId: "graph:team/chan", |
1270 | 1271 | currentChannelProvider: "whatsapp", |
@@ -1291,6 +1292,9 @@ describe("gateway send mirroring", () => {
|
1291 | 1292 | undefined, |
1292 | 1293 | { channel: "whatsapp" }, |
1293 | 1294 | ); |
| 1295 | +expect(mocks.dispatchChannelMessageAction).toHaveBeenCalledWith( |
| 1296 | +expect.objectContaining({ inboundTurnKind: "room_event" }), |
| 1297 | +); |
1294 | 1298 | }); |
1295 | 1299 | |
1296 | 1300 | it("passes agent-scoped media roots to gateway message actions", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -287,6 +287,7 @@ export const sendHandlers: GatewayRequestHandlers = {
|
287 | 287 | senderIsOwner?: boolean; |
288 | 288 | sessionKey?: string; |
289 | 289 | sessionId?: string; |
| 290 | +inboundTurnKind?: "user_request" | "room_event"; |
290 | 291 | agentId?: string; |
291 | 292 | toolContext?: { |
292 | 293 | currentChannelId?: string; |
@@ -364,6 +365,7 @@ export const sendHandlers: GatewayRequestHandlers = {
|
364 | 365 | senderIsOwner, |
365 | 366 | sessionKey: normalizeOptionalString(request.sessionKey) ?? undefined, |
366 | 367 | sessionId: normalizeOptionalString(request.sessionId) ?? undefined, |
| 368 | +inboundTurnKind: request.inboundTurnKind, |
367 | 369 | agentId: normalizeOptionalString(request.agentId) ?? undefined, |
368 | 370 | mediaLocalRoots: getAgentScopedMediaLocalRoots( |
369 | 371 | cfg, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。