mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:00:21 +00:00
fix(ci): harden telegram seams and cap job timeouts
This commit is contained in:
@@ -43,6 +43,8 @@ import {
|
||||
|
||||
const VOICE_FORBIDDEN_RE = /VOICE_MESSAGES_FORBIDDEN/;
|
||||
const CAPTION_TOO_LONG_RE = /caption is too long/i;
|
||||
const GrammyErrorCtor: typeof GrammyError | undefined =
|
||||
typeof GrammyError === "function" ? GrammyError : undefined;
|
||||
|
||||
type DeliveryProgress = ReplyThreadDeliveryProgress & {
|
||||
deliveredCount: number;
|
||||
@@ -175,14 +177,14 @@ async function sendPendingFollowUpText(params: {
|
||||
}
|
||||
|
||||
function isVoiceMessagesForbidden(err: unknown): boolean {
|
||||
if (err instanceof GrammyError) {
|
||||
if (GrammyErrorCtor && err instanceof GrammyErrorCtor) {
|
||||
return VOICE_FORBIDDEN_RE.test(err.description);
|
||||
}
|
||||
return VOICE_FORBIDDEN_RE.test(formatErrorMessage(err));
|
||||
}
|
||||
|
||||
function isCaptionTooLong(err: unknown): boolean {
|
||||
if (err instanceof GrammyError) {
|
||||
if (GrammyErrorCtor && err instanceof GrammyErrorCtor) {
|
||||
return CAPTION_TOO_LONG_RE.test(err.description);
|
||||
}
|
||||
return CAPTION_TOO_LONG_RE.test(formatErrorMessage(err));
|
||||
|
||||
@@ -15,6 +15,9 @@ import { resolveTelegramMediaPlaceholder } from "./helpers.js";
|
||||
import type { StickerMetadata, TelegramContext } from "./types.js";
|
||||
|
||||
const FILE_TOO_BIG_RE = /file is too big/i;
|
||||
const GrammyErrorCtor: typeof GrammyError | undefined =
|
||||
typeof GrammyError === "function" ? GrammyError : undefined;
|
||||
|
||||
function buildTelegramMediaSsrfPolicy(apiRoot?: string) {
|
||||
const hostnames = ["api.telegram.org"];
|
||||
if (apiRoot) {
|
||||
@@ -41,7 +44,7 @@ function buildTelegramMediaSsrfPolicy(apiRoot?: string) {
|
||||
* Unlike network errors, this is a permanent error and should not be retried.
|
||||
*/
|
||||
function isFileTooBigError(err: unknown): boolean {
|
||||
if (err instanceof GrammyError) {
|
||||
if (GrammyErrorCtor && err instanceof GrammyErrorCtor) {
|
||||
return FILE_TOO_BIG_RE.test(err.description);
|
||||
}
|
||||
return FILE_TOO_BIG_RE.test(formatErrorMessage(err));
|
||||
|
||||
@@ -9,9 +9,11 @@ import { buildTelegramThreadParams, type TelegramThreadSpec } from "./helpers.js
|
||||
const PARSE_ERR_RE = /can't parse entities|parse entities|find end of the entity/i;
|
||||
const EMPTY_TEXT_ERR_RE = /message text is empty/i;
|
||||
const THREAD_NOT_FOUND_RE = /message thread not found/i;
|
||||
const GrammyErrorCtor: typeof GrammyError | undefined =
|
||||
typeof GrammyError === "function" ? GrammyError : undefined;
|
||||
|
||||
function isTelegramThreadNotFoundError(err: unknown): boolean {
|
||||
if (err instanceof GrammyError) {
|
||||
if (GrammyErrorCtor && err instanceof GrammyErrorCtor) {
|
||||
return THREAD_NOT_FOUND_RE.test(err.description);
|
||||
}
|
||||
return THREAD_NOT_FOUND_RE.test(formatErrorMessage(err));
|
||||
|
||||
Reference in New Issue
Block a user