fix(telegram): allow 12-option polls (#104303)

* fix(telegram): allow 12-option polls

* chore: keep release notes in pr body
This commit is contained in:
Peter Steinberger
2026-07-11 01:11:30 -07:00
committed by GitHub
parent 7bf80dc2c6
commit 7128e8ea2b
4 changed files with 18 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ import { loadTelegramSendModule, type TelegramSendModule } from "./send-runtime.
import { normalizeTelegramOutboundTarget, parseTelegramTarget } from "./targets.js";
export const TELEGRAM_TEXT_CHUNK_LIMIT = 4000;
const TELEGRAM_POLL_OPTION_LIMIT = 10;
const TELEGRAM_POLL_OPTION_LIMIT = 12;
type TelegramSendFn = typeof import("./send.js").sendMessageTelegram;
type TelegramSendOpts = Parameters<TelegramSendFn>[2];

View File

@@ -4425,6 +4425,21 @@ describe("editMessageTelegram", () => {
});
describe("sendPollTelegram", () => {
it("sends polls with 12 options", async () => {
const api = {
sendPoll: vi.fn(async () => ({ message_id: 123, chat: { id: 555 }, poll: { id: "p1" } })),
};
const options = Array.from({ length: 12 }, (_, index) => `Option ${index + 1}`);
await sendPollTelegram(
"123",
{ question: "Q", options },
{ cfg: TELEGRAM_TEST_CFG, token: "t", api: api as unknown as Bot["api"] },
);
expect(firstMockCall(api.sendPoll, "send poll call")[2]).toEqual(options);
});
it("propagates gateway client scopes when resolving legacy poll targets", async () => {
const api = {
getChat: vi.fn(async () => ({ id: -100321 })),

View File

@@ -2384,7 +2384,7 @@ async function sendPollTelegramWithContext(
});
// Normalize the poll input (validates question, options, maxSelections)
const normalizedPoll = normalizePollInput(poll, { maxOptions: 10 });
const normalizedPoll = normalizePollInput(poll, { maxOptions: 12 });
const threadParams = buildTelegramThreadReplyParams({
thread: resolveTelegramSendThreadSpec({

View File

@@ -30,7 +30,7 @@ describe("telegramPlugin outbound", () => {
expect(telegramOutbound.presentationCapabilities?.limits?.text?.markdownDialect).toBe(
"markdown",
);
expect(telegramOutbound.pollMaxOptions).toBe(10);
expect(telegramOutbound.pollMaxOptions).toBe(12);
});
it("strips assistant-visible tool traces before outbound delivery", () => {