
























@@ -56,6 +56,7 @@ type TelegramQaScenarioRun = {
5656input: string;
5757expectedTextIncludes?: string[];
5858matchText?: string;
59+replyToLatestSutMessage?: boolean;
5960};
60616162type TelegramQaScenarioDefinition = LiveTransportScenarioDefinition<TelegramQaScenarioId> & {
@@ -276,6 +277,7 @@ const TELEGRAM_QA_SCENARIOS: TelegramQaScenarioDefinition[] = [
276277allowAnySutReply: true,
277278expectReply: true,
278279input: `@${sutUsername} Telegram QA mention routing check. Reply with a short acknowledgement.`,
280+replyToLatestSutMessage: true,
279281}),
280282},
281283{
@@ -613,11 +615,24 @@ async function flushTelegramUpdates(token: string) {
613615throw new Error("timed out after 15000ms draining Telegram updates");
614616}
615617616-async function sendGroupMessage(token: string, groupId: string, text: string) {
618+async function sendGroupMessage(
619+token: string,
620+groupId: string,
621+text: string,
622+opts: { replyToMessageId?: number } = {},
623+) {
617624return await callTelegramApi<TelegramSendMessageResult>(token, "sendMessage", {
618625chat_id: groupId,
619626 text,
620627disable_notification: true,
628+ ...(opts.replyToMessageId !== undefined
629+ ? {
630+reply_parameters: {
631+message_id: opts.replyToMessageId,
632+allow_sending_without_reply: true,
633+},
634+}
635+ : {}),
621636});
622637}
623638@@ -1228,6 +1243,7 @@ export async function runTelegramQaLive(params: {
12281243try {
12291244await waitForTelegramChannelRunning(gatewayHarness.gateway, sutAccountId);
12301245assertLeaseHealthy();
1246+let latestSutMessageId: number | undefined;
12311247try {
12321248writeTelegramQaProgress(progressEnabled, "canary start");
12331249const canaryTiming = await runCanary({
@@ -1238,6 +1254,7 @@ export async function runTelegramQaLive(params: {
12381254timeoutMs: resolveTelegramQaCanaryTimeoutMs(),
12391255 observedMessages,
12401256});
1257+latestSutMessageId = canaryTiming.responseMessageId;
12411258scenarioResults.push({
12421259id: "telegram-canary",
12431260title: "Telegram canary",
@@ -1291,6 +1308,9 @@ export async function runTelegramQaLive(params: {
12911308runtimeEnv.driverToken,
12921309runtimeEnv.groupId,
12931310scenarioRun.input,
1311+scenarioRun.replyToLatestSutMessage
1312+ ? { replyToMessageId: latestSutMessageId }
1313+ : undefined,
12941314);
12951315const requestStartedAt = new Date(requestStartedAtMs).toISOString();
12961316const matched = await waitForObservedMessage({
@@ -1333,6 +1353,7 @@ export async function runTelegramQaLive(params: {
13331353responseMessageId: redactPublicMetadata ? undefined : matched.message.messageId,
13341354} satisfies TelegramQaScenarioResult;
13351355scenarioResults.push(result);
1356+latestSutMessageId = matched.message.messageId;
13361357writeTelegramQaProgress(
13371358progressEnabled,
13381359`scenario pass ${scenarioIndexLabel}: ${scenarioIdForLog}`,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。