Skip to content
This repository was archived by the owner on Oct 9, 2026. It is now read-only.

fix: a Telegram edit refusal is permanent - #29

Merged
mekjr1 merged 2 commits into
mainfrom
fix/telegram-edit-refusal
Oct 7, 2026
Merged

mekjr1 merged 2 commits into
mainfrom
fix/telegram-edit-refusal

Conversation

@mekjr1

@mekjr1 mekjr1 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

When a reply should replace the "Thinking…" placeholder, the manager edits the placeholder; if the edit fails, it sends the reply as a new message. It deletes the placeholder first only when the edit was refused (ErrSendFailed): after another error the edit may have landed. Telegram's EditMessage returned every error unclassified, so on Telegram a refused edit left the placeholder in the chat next to the reply.

EditMessage now classifies its errors as Send does (classifySendError): a 4xx refusal is ErrSendFailed, a 429 a rate limit with Telegram's retry-after, a 5xx or network failure ErrTemporary. "Message is not modified" still counts as success, and a dropped connection after the request was sent is still swallowed.

The same function updates tool progress messages, whose errors go back to the manager: a refused update is no longer retried three times, and a rate-limited one waits as Telegram asks.

Test: TestEditMessage_ClassifiesRefusals (fails without the fix).

mekjr1 added 2 commits October 7, 2026 11:57
EditMessage returned Telegram's refusals unclassified, so the manager kept the placeholder it couldn't edit (it deletes one only after ErrSendFailed) and retried refused progress updates. Edit errors are now classified as send errors: 4xx is ErrSendFailed, 429 a rate limit, 5xx and network failures temporary.
The animator re-edits a progress message every three seconds for up to ten minutes and ignored the edit's error, so a message Telegram refused to edit (now ErrSendFailed) was edited again and again, and a rate limit was ignored. Such an edit now ends the animation; the message stays tracked.
@mekjr1
mekjr1 force-pushed the fix/telegram-edit-refusal branch from 1f2af07 to 10e10ea Compare October 7, 2026 17:59
@mekjr1
mekjr1 merged commit 33d9565 into main Oct 7, 2026
12 checks passed
@mekjr1
mekjr1 deleted the fix/telegram-edit-refusal branch October 7, 2026 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant