mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 21:36:07 +00:00
fix(telegram): add missing "edit" retry context for editMessageTelegram (#100543)
This commit is contained in:
@@ -140,13 +140,14 @@ describe("isRecoverableTelegramNetworkError", () => {
|
||||
expect(isRecoverableTelegramNetworkError(undiciSnippetErr, { context: "polling" })).toBe(true);
|
||||
});
|
||||
|
||||
it("treats delete/react (idempotent) contexts like polling, not send", () => {
|
||||
it("treats delete/react/edit (idempotent) contexts like polling, not send", () => {
|
||||
const undiciSnippetErr = new Error("Undici: socket failure");
|
||||
// delete and react are idempotent Telegram operations; a transient
|
||||
// delete, react, and edit are idempotent Telegram operations; a transient
|
||||
// snippet-only error must be retried (allowMessageMatch defaults true),
|
||||
// matching polling/webhook. send stays strict as the regression guard.
|
||||
expect(isRecoverableTelegramNetworkError(undiciSnippetErr, { context: "delete" })).toBe(true);
|
||||
expect(isRecoverableTelegramNetworkError(undiciSnippetErr, { context: "react" })).toBe(true);
|
||||
expect(isRecoverableTelegramNetworkError(undiciSnippetErr, { context: "edit" })).toBe(true);
|
||||
expect(isRecoverableTelegramNetworkError(undiciSnippetErr, { context: "send" })).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ export type TelegramNetworkErrorContext =
|
||||
| "webhook"
|
||||
| "delete"
|
||||
| "react"
|
||||
| "edit"
|
||||
| "unknown";
|
||||
export type TelegramNetworkErrorOrigin = {
|
||||
method?: string | null;
|
||||
|
||||
@@ -1807,8 +1807,7 @@ export async function editMessageTelegram(
|
||||
retry: opts.retry,
|
||||
verbose: opts.verbose,
|
||||
shouldRetry: (err) =>
|
||||
isRecoverableTelegramNetworkError(err, { allowMessageMatch: true }) ||
|
||||
isTelegramServerError(err),
|
||||
isRecoverableTelegramNetworkError(err, { context: "edit" }) || isTelegramServerError(err),
|
||||
});
|
||||
const requestWithEditShouldLog = <T>(
|
||||
fn: () => Promise<T>,
|
||||
|
||||
Reference in New Issue
Block a user