fix(proxy): map AUTH_FAILURE to FORBIDDEN to preserve healthy clearan…#577
Open
bigbang20061 wants to merge 1 commit into
Open
fix(proxy): map AUTH_FAILURE to FORBIDDEN to preserve healthy clearan…#577bigbang20061 wants to merge 1 commit into
bigbang20061 wants to merge 1 commit into
Conversation
…ce bundle
ResultCategory.AUTH_FAILURE represents account-side credential problems
(blocked-user, bad-credentials, session-not-found, email-domain-rejected, etc.
as detected by is_invalid_credentials_body), not proxy or Cloudflare problems.
The previous mapping AUTH_FAILURE -> UNAUTHORIZED caused ProxyDirectory.feedback
(control/proxy/__init__.py:185-198) to invalidate the cached ClearanceBundle
on every banned-account hit, burning a healthy cf_clearance and forcing an
unnecessary FlareSolverr refresh. Pools containing N banned accounts would
trigger N clearance refreshes during warm-up before any real CF problem
appeared.
Map to FORBIDDEN so the pool cursor still advances under PROXY_POOL mode
(__init__.py:200-221) but the clearance bundle stays intact. This matches the
principle already documented in xai_usage._proxy_feedback_kind_for_error
("invalid or blocked accounts are account problems, not proxy problems").
Relates to chenyme#407, chenyme#452.
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
ResultCategory.AUTH_FAILURE对应账号侧凭证失效(blocked-user、bad-credentials、session-not-found、email-domain-rejected、account suspended等,识别逻辑见xai_usage.is_invalid_credentials_body),跟代理 / Cloudflare 状态无关。但原映射
AUTH_FAILURE → UNAUTHORIZED在ProxyDirectory.feedback(app/control/proxy/__init__.py:185-198)会无条件失效当前(proxy_url, clearance_host)维度的ClearanceBundle,导致:cf_clearance修复:把映射改成
AUTH_FAILURE → FORBIDDEN。PROXY_POOL模式下,__init__.py:200-221仍会推进_pool_cursor,遇到坏号下次会换代理__init__.py:185-198不再失效 bundle,保留健康 clearancexai_usage._proxy_feedback_kind_for_error里已有的原则 "invalid or blocked accounts are account problems, not proxy problems" 一致,把同一条原则贯彻到 chat 主链路仅改动
_CATEGORY_TO_PROXY表中 1 行 + 注释,不引入新依赖、不改变其它分类(FORBIDDEN → CHALLENGE、RATE_LIMITED → RATE_LIMITED等保持不变)。Testing
python -m py_compile app/dataplane/reverse/feedback.py✓ast.parse语法验证 ✓ProxyDirectory.feedback(__init__.py:183-221)中FORBIDDEN/UNAUTHORIZED两个分支的语义差异:UNAUTHORIZED:失效 bundle + 推进游标FORBIDDEN:仅推进游标state_machine.apply_feedback的账号侧反馈,跟代理侧反馈两条独立链路,账号状态机行为不受本改动影响(账号侧仍由build_account_feedback处理)Related
Relates to #407, #452