fix(channels): add 429 retry-with-backoff and Telegram send_status#6100
Merged
Conversation
Extract Discord's existing 429 retry-with-backoff into a shared common::http_retry::send_with_retry helper and wire it into Telegram's raw API extension client and Slack's Web API client, which previously surfaced a rate-limit response as a hard error on the first attempt. Also implement TelegramChannel::send_status, mirroring the Discord/Slack pattern, so Telegram users get the same visibility into background/implicit agent operations as their peers. Closes #5949 Closes #5923
bug-ops
enabled auto-merge (squash)
July 11, 2026 21:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send_with_retry, fix(channels): Discord REST client missing 429 rate-limit handling #4728) into a sharedcrates/zeph-channels/src/common/http_retry.rshelper and wire it into Telegram's raw API extension client (TelegramApiClient::post) and all fourSlackApimethods (auth_test,post_message,update_message,download_file), which previously surfaced a rate-limited response as a hard error on the first attempt.TelegramChannel::send_status, mirroring the existing Discord/Slack pattern, so Telegram users get the same visibility into background/implicit agent operations (skill reload, MCP elicitation, memory recall, etc.) that Discord/Slack users already see.Closes #5949
Closes #5923
Details
SlackApigained abase_urlfield (#[cfg(test)]-only override) for wiremock testability, and its previous per-calltokio::time::timeout(15s)was replaced with a per-attempt.timeout(15s)on theRequestBuilder, since an outer timeout is incompatible with a retry loop that can legitimately run longer than one request when backing off. Worst-case wall-clock under sustained 429 is documented on the shared helper.TelegramChannel::send_statusposts the status text as a plain-text message and no-ops when the text is empty, there is no active chat, or the channel is in a Guest Mode context (a guest reply can only be sent once viaanswerGuestQuery).reqwest::Errortext (necessary to reconcile per-call timeouts with the retry loop); signatures are unchanged, and no external consumer depends on the old text (verified by grep).Follow-ups filed during review
send_statusinprepare_context) — pre-existing shape for Discord, now shared by Slack; worth a dedicated fix outside this PR's scope.send_message/edit_message/trigger_typingretry-wiring itself isn't tested end-to-end (only the extracted helper is) — pre-existing gap, not introduced here.Test plan
cargo nextest run --config-file .github/nextest.toml -p zeph-channels --features "discord,slack"— 275/275 pass (34 new/changed tests: shared retry helper, Telegram retry, Slack retry + host-check-reject + debug-redaction, 4send_statustests)cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— cleancargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 12945/12945 passcargo +nightly fmt --check— cleanRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"— cleanRUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked— cleancargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"— cleanRUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --features "discord,slack" -p zeph-channels— clean[Unreleased]/Fixed).local/testing/playbooks/telegram-channel.mdand.local/testing/playbooks/slack.mdupdated with new scenarios (429 retry, send_status).local/testing/coverage-status.mdupdated with new rows (status: Untested — not yet live-session-verified against real Telegram/Slack APIs)