Skip to content

fix(weixin): add per-chunk retry with backoff for text delivery - #7932

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-905d6262
Apr 11, 2026
Merged

fix(weixin): add per-chunk retry with backoff for text delivery#7932
teknium1 merged 1 commit into
mainfrom
hermes/hermes-905d6262

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

When sending multi-chunk Weixin responses, individual chunks can fail due to transient iLink API errors. Previously a single failure aborted the entire message. Now each chunk retries with linear backoff before giving up, and the same client_id is reused across retries for server-side deduplication.

What changed

  • _send_text_chunk() — new retry wrapper around _send_message() with configurable attempts and backoff
  • Configurable pacing — replaces the hardcoded 0.3s delay from fix(weixin): keep multi-line messages in single bubble by default #7903 with send_chunk_delay_seconds (default 0.35s)
  • Config/env vars: send_chunk_delay_seconds, send_chunk_retries (default 2), send_chunk_retry_delay_seconds (default 1.0s)
  • Tests — inter-chunk delay test + flaky-send retry test with client_id dedup verification

Files changed (+105/-8)

  • gateway/platforms/weixin.py — config properties, _send_text_chunk() retry wrapper, updated send()
  • tests/gateway/test_weixin.py — 2 new tests (TestWeixinChunkDelivery)

Test results

20/20 weixin tests pass

Salvaged from PR #7899 by @corazzione. Contributor authorship preserved. Fixes #7836.

When sending multi-chunk responses, individual chunks can fail due to
transient iLink API errors. Previously a single failure would abort the
entire message. Now each chunk is retried with linear backoff before
giving up, and the same client_id is reused across retries for
server-side deduplication.

Configurable via config.yaml (platforms.weixin.extra) or env vars:
- send_chunk_delay_seconds (default 0.35s) — pacing between chunks
- send_chunk_retries (default 2) — max retry attempts per chunk
- send_chunk_retry_delay_seconds (default 1.0s) — base retry delay

Replaces the hardcoded 0.3s inter-chunk delay from #7903.

Salvaged from PR #7899 by @corazzione. Fixes #7836.
@teknium1
teknium1 merged commit 885123d into main Apr 11, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weixin: multi-part replies can drop trailing chunks while the agent believes all parts were delivered

2 participants