From edda0608ac91c1fb0398b06bce460f5d5bf4ee43 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 28 May 2026 21:51:21 -0400 Subject: [PATCH] fix: advertise telegram poll duration integer --- .../telegram/src/channel-actions.test.ts | 19 +++++++++++++++++++ .../telegram/src/message-tool-schema.ts | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/extensions/telegram/src/channel-actions.test.ts b/extensions/telegram/src/channel-actions.test.ts index c08295d09f0..fbcde4bc903 100644 --- a/extensions/telegram/src/channel-actions.test.ts +++ b/extensions/telegram/src/channel-actions.test.ts @@ -367,6 +367,25 @@ describe("telegramMessageActions", () => { expect(discovery?.actions).not.toContain("react"); }); + it("advertises poll duration as a positive integer in message tool schema", () => { + const cfg = { + channels: { + telegram: { + botToken: "tok", + actions: { poll: true }, + }, + }, + } as OpenClawConfig; + + const discovery = telegramMessageActions.describeMessageTool?.({ cfg }); + const schema = Array.isArray(discovery?.schema) ? discovery.schema[0] : undefined; + + expect(schema?.properties.pollDurationSeconds).toMatchObject({ + type: "integer", + minimum: 1, + }); + }); + it("matches runtime account-key normalization during SecretRef-tolerant discovery", () => { const cfg = { channels: { diff --git a/extensions/telegram/src/message-tool-schema.ts b/extensions/telegram/src/message-tool-schema.ts index 1956d9cc9f9..94f27216a1f 100644 --- a/extensions/telegram/src/message-tool-schema.ts +++ b/extensions/telegram/src/message-tool-schema.ts @@ -1,8 +1,9 @@ +import { optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions"; import { Type } from "typebox"; export function createTelegramPollExtraToolSchemas() { return { - pollDurationSeconds: Type.Optional(Type.Number()), + pollDurationSeconds: optionalPositiveIntegerSchema(), pollAnonymous: Type.Optional(Type.Boolean()), pollPublic: Type.Optional(Type.Boolean()), };