feat(retry): auto-retry Cloudflare 5xx from relays + user-configurable retry-error settings - #609
Merged
su-fen merged 1 commit intoAug 25, 2026
Conversation
StackCairn
marked this pull request as draft
August 25, 2026 04:17
Contributor
|
PR governance checks passed. Awaiting human review. |
YUZHEthefool
force-pushed
the
feat/retry-error-config-608
branch
2 times, most recently
from
August 25, 2026 05:11
bdba180 to
10a9ad6
Compare
YUZHEthefool
marked this pull request as ready for review
August 25, 2026 06:27
Member
|
这个好像放设置单开一页不太合适诶,适合放在供应商配置页面设置抽屉里 |
Contributor
Author
…e retry-error settings (Stack-Cairn#608) Relays/proxy stations intermittently surface Cloudflare 520/521/525 and similar transient 5xx. pi-ai's isRetryableAssistantError only covers 429/500/502/503/504/524, so these errors failed outright instead of retrying (Stack-Cairn#608). This layers a LiveAgent retry-error extension on top of pi-ai's classifier, applied to both withStreamRetry and withProviderFailover so a transient relay 5xx now retries with exponential backoff (matching 524) and can also trigger a provider switch. - Default the extension to every Cloudflare preset (520-527) on, so relays self-heal out of the box with zero configuration. - Add a global RetryErrorSettings (preset status-code toggles + custom substrings) persisted in localStorage. Surfaced as a card inside the Providers custom-settings drawer (alongside failover), per maintainer review, rather than a standalone settings page. - Sync settings into the runtime via a module-level extension, so all streaming paths (agent runs, text mode, titles, compaction, memory, cron, subagents) pick up the classification without per-call plumbing. - Preserve pi-ai's non-retryable quota/billing guard and the failover ineligible client-error guard as hard floors. Tests: - stream-retry: extension classifier (preset code match, word-boundary guard so "520" != "5200", case-insensitive substring, empty/undefined message, multi-code alternation, whitespace-only pattern dropped), withStreamRetry retrying 525/custom patterns via retryExtension and the module default (zero-config fix), preset-disabled not retried, quota error still not retried, failover eligibility (+ client-error still rejected), setRetryErrorExtension/getRetryErrorExtension round-trip. - retry-error-normalize: defaults, preset validation/dedup, empty-array opt-out, legacy fallback, custom-pattern trim/dedup, normalizeSettings wiring. - storage: retryErrorSettings localStorage round-trip — defaults when empty, read+normalize on load, legacy fallback to all presets. Closes Stack-Cairn#608.
YUZHEthefool
force-pushed
the
feat/retry-error-config-608
branch
from
August 25, 2026 09:34
10a9ad6 to
88a6ae2
Compare
su-fen
approved these changes
Aug 25, 2026
5 tasks
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
Relays/proxy stations (中转站) intermittently surface Cloudflare
520/521/525and similar transient 5xx. pi-ai'sisRetryableAssistantErroronly covers429 / 500 / 502 / 503 / 504 / 524, so these errors failed outright instead of retrying — #608.This layers a LiveAgent retry-error extension on top of pi-ai's classifier, applied to both
withStreamRetryandwithProviderFailover, so a transient relay 5xx now retries with exponential backoff (matching524) and can also trigger a provider switch.520-527) on, so relays self-heal out of the box.SSL handshake failedfor relay wording pi-ai doesn't recognize).Closes #608.
Changes
streamRetry.tsRetryErrorExtension+isExtensionRetryableError+setRetryErrorExtension; wired intowithStreamRetryproviderFailover.tsisFailoverEligibleAssistantError+ProviderFailoverStreamOptionsagent-ui/.../settings/types.tsRetryErrorSettings,RETRYABLE_PRESET_HTTP_STATUS_CODES,DEFAULT_RETRY_ERROR_SETTINGSagent-ui/.../settings/retryError.ts(new)normalizeRetryErrorSettingsagent-ui/.../settings/index.tsgetDefaultSettings/normalizeSettingsagent-gui/.../settings/storage.tsretryErrorSettingsin localStorage (local-only, not gateway-synced)agent-gui/src/App.tsxuseEffectpushes settings → runtime extensionagent-ui/.../RetryErrorSection.tsx(new)SettingsPage.tsx+pages/settings/types.tsretryError)enUSSettings.ts/zhCNSettings.tsDesign decisions
Verification
tsc --noEmitclean.pnpm --filter liveagent build(tsc && vite build) succeeds.stream-retry,provider-failover,retry-error-normalize, i18n parity.target/release/liveagent.exe, 62.7 MB) — launches and initializes correctly.Screenshot
Test plan
SSL handshake failed) → a matching relay error retries.Notes
preset scripts stay in sync,portalled select) exist onmainand are not introduced by this PR — verified by stashing all changes and re-running.