Repository navigation
Conversation
Read CRAGGemini upstream_reason on effective 403 in native and direct-client mappers; route TOS_VIOLATION to gemini_account_ineligible and align host, API, scheduler, and web remediation copy so bare 403s mention both disable and region. Co-authored-by: ted <kuhlmangarry24@gmail.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: f17f774c-5554-46ce-a48a-035b4f90f427) |
…rder Soften gemini_account_ineligible messaging across API, scheduler, and web; order upstream 403 token extraction with TOS first; tighten string checks. Co-authored-by: ted <kuhlmangarry24@gmail.com>
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
上游 HTTP 403 不再一律映射为
gemini_location_unsupported。在scripts/gemini_host_native.py与src/lib/gemini/direct-client.mjs的_map_worker_error/mapCragWorkerError中读取载荷upstream_reason(及message/error中的原因 token),与 CRAGGemini 0.4.14+ 前向兼容。Refs #1957
Error code 决策
upstream_reason: TOS_VIOLATION(或错误文本中包含该 token)→gemini_account_ineligible(沿用既有码,不新增)。该码已在scheduler.mjs的FAILOVER_ERRORS、ACCOUNT_WIDE_COOLDOWN_ERRORS与INELIGIBLE_STATES(ineligible)中,单账号熔断与账号级冷却行为与资格不合格一致。upstream_reason: UNSUPPORTED_REGION→gemini_location_unsupported(不变)。gemini_location_unsupported(调度行为不变);用户文案同时说明「账号可能被停用」与「出口地区可能不受支持」,并提示资格查询可能仍正常、应以实际对话确认。TOS 路径前提:仅当 CRAGGemini worker 透传
upstream_reason,或message/error文本本身包含TOS_VIOLATION时才会走 TOS →gemini_account_ineligible分支;否则仍按裸 403 处理为gemini_location_unsupported。TOS 分支要等 CRAGGemini 透传后才在生产生效。gemini_account_ineligible的用户文案不硬断言 TOS:该码亦来自classify_http_error的 else 分支、诊断日志Account ineligible: …等;文案表述「不符合资格或可能已停用」,仅在文案中条件性提及 TOS_VIOLATION。gemini_host_account.py对显式TOS_VIOLATION与 assistineligibleTiers做了对齐。parse_ineligibility在没有 tier 时会把 TOS 账号标成ineligible并挡出调度;目前没有单测覆盖这条路径。Release notes(≥ 1.4.237)
TOS_VIOLATION时映射为gemini_account_ineligible,面板与 API 提示申诉或换号(不硬断言 TOS),不再误导向仅换代理。403与UNSUPPORTED_REGION的gemini_location_unsupported文案说明停用与地区两种可能,并强调以实际对话验证。upstream_reason(或错误文本含TOS_VIOLATION);无 tier 的 TOS 账号会被标为 ineligible 并挡出调度(该路径暂无单测)。未验证
upstream_reason;issue [Bug] 403 被统一报成「地区不支持」:craggemini 丢失上游 TOS_VIOLATION 原因,导致无法区分账号停用与地区限制(1.4.233) #1957 附带的实测载荷无 reason 字段。单测用合成载荷覆盖 TOS / 地区 / 裸 403 及多 token 优先级。parse_ineligibility在没有 tier 时将 TOS 账号标成ineligible并挡出调度,尚无单测。测试
python3 test/unit/gemini-host-native-smoke.py— PASSnode scripts/run-isolated-tests.mjs test/unit .test.mjs gemini-session-conflict— 8/8 PASSpnpm -C web test src/lib/gemini-account-status.test.ts— 14/14 PASS./node_modules/.bin/biome check --writeon 根目录 touched.mjs(Biome 2.5.11);pnpm -C web exec prettier --writeon touched web TS未声称 path-filtered CI run 45954686034 为 dev tip 全量 CI。
Note
Medium Risk
Changes error-code mapping and user-facing failover paths for all Gemini 403 upstream responses; wrong reason parsing could mis-route accounts to proxy changes vs account appeals.
Reviewed by Cursor Bugbot for commit f500f5f. Configure here.