feat: guard new 504/524 status remaps with risk confirmation

This commit is contained in:
Seefs
2026-02-22 20:03:46 +08:00
parent 06fc6015bb
commit 50ffa639a2
11 changed files with 419 additions and 2 deletions

View File

@@ -1949,6 +1949,19 @@
"自动重试状态码": "Auto-retry status codes",
"自动重试状态码格式不正确": "Invalid auto-retry status code format",
"支持填写单个状态码或范围(含首尾),使用逗号分隔": "Supports single status codes or inclusive ranges; separate with commas",
"支持填写单个状态码或范围含首尾使用逗号分隔504 和 524 始终不重试,不受此处配置影响": "Supports single status codes or inclusive ranges; separate with commas. 504 and 524 are never retried and are not affected by this setting",
"高危操作确认": "High-risk operation confirmation",
"检测到以下高危状态码重定向规则": "Detected high-risk status-code redirect rules",
"操作确认": "Operation confirmation",
"我确认开启高危重试": "I confirm enabling high-risk retry",
"高危状态码重试风险告知与免责声明Markdown": "### ⚠️ High-Risk Operation: Risk Notice and Disclaimer for 504/524 Retry\n\n[Background]\nBy default, this project does not retry for status codes `400` (bad request), `504` (gateway timeout), and `524` (timeout occurred). In many cases, `504` and `524` mean the request has reached the upstream AI service and processing has started, but the connection was closed due to long processing time.\n\nEnabling redirection/retry for these timeout status codes is a **high-risk operation**. Before enabling it, you must read and understand the consequences below:\n\n#### 1. Core Risks (Read Carefully)\n1. 💸 Duplicate/multiple billing risk: Most upstream AI providers **still charge** for requests that started processing but got interrupted by network timeout (`504`/`524`). If retry is triggered, a new upstream request will be sent, which can lead to **duplicate or multiple charges**.\n2. ⏳ Severe client timeout: If a single request already timed out, adding retries can multiply total latency and cause severe or unacceptable timeout behavior for your final client/caller.\n3. 💥 Request backlog and system crash risk: Forcing retries on timeout requests keeps threads and connections occupied for longer. Under high concurrency, this can cause serious backlog, exhaust system resources, trigger a cascading failure, and crash your proxy service.\n\n#### 2. Risk Acknowledgement\nIf you still choose to enable this feature, you acknowledge all of the following:\n\n- [ ] I have fully read and understood the risks and fully understand the destructive consequences of forcing retries for status codes `504` and `524`.\n- [ ] I have communicated with the upstream provider and confirmed that the timeout issue is an upstream bottleneck and cannot be resolved upstream at this time.\n- [ ] I voluntarily accept all duplicate/multiple billing risks and will not file issues or complaints in this project repository regarding billing anomalies caused by this retry behavior.\n- [ ] I voluntarily accept system stability risks, including severe client timeout and possible service crash. Any consequences caused by enabling this feature are my own responsibility.\n\n> **[Operation Confirmation]**\n> To unlock this feature, manually type the text below in the input box:\n> I understand the duplicate billing and crash risks, and confirm enabling it.",
"高危状态码重试风险确认输入文本": "I understand the duplicate billing and crash risks, and confirm enabling it.",
"高危状态码重试风险确认项1": "I have fully read and understood the risks and fully understand the destructive consequences of forcing retries for status codes 504 and 524.",
"高危状态码重试风险确认项2": "I have communicated with the upstream provider and confirmed that the timeout issue is an upstream bottleneck and cannot be resolved upstream at this time.",
"高危状态码重试风险确认项3": "I voluntarily accept all duplicate/multiple billing risks and will not file issues or complaints in this project repository regarding billing anomalies caused by this retry behavior.",
"高危状态码重试风险确认项4": "I voluntarily accept system stability risks, including severe client timeout and possible service crash. Any consequences caused by enabling this feature are my own responsibility.",
"高危状态码重试风险输入框占位文案": "Please type the exact text above",
"高危状态码重试风险输入不匹配提示": "The input does not match the required text",
"例如401, 403, 429, 500-599": "e.g. 401,403,429,500-599",
"自动选择": "Auto Select",
"自定义充值数量选项": "Custom Recharge Amount Options",