feat(proxy,oauth,pool): H2 头过滤、OAuth 过期分级标记与批量操作进度条

- proxy: 屏蔽 host/content-length 头转发,避免 H2 PROTOCOL_ERROR
- oauth: 区分 [REFRESH_FAILED] 与 [OAUTH_EXPIRED] 标记,token 过期
  自动阻止调度但不停用账号,便于管理员恢复
- pool/account_state: 识别新增的 OAUTH_EXPIRED/REFRESH_FAILED 前缀
- 前端: 批量操作显示实时进度条,倍率编辑 Escape/blur 竞态修复,
  OAuth 刷新失败后自动刷新列表
This commit is contained in:
fawney19
2026-03-06 01:47:09 +08:00
parent fa71cddb60
commit e9c3ac94c6
9 changed files with 134 additions and 16 deletions

View File

@@ -906,10 +906,9 @@ async def refresh_oauth(
except Exception as e:
# 标记为失效
key.oauth_invalid_at = datetime.now(timezone.utc)
key.oauth_invalid_reason = str(e)
key.is_active = False
key.oauth_invalid_reason = f"[REFRESH_FAILED] Token 续期失败: {e}"
db.commit()
logger.warning("Kiro Key {} token 刷新失败,已标记为失效并自动停用: {}", key_id, e)
logger.warning("Kiro Key {} token 刷新失败,已标记为刷新失效: {}", key_id, e)
raise InvalidRequestException("Kiro token refresh 失败,请检查凭据是否有效")
# 更新 key
@@ -1000,11 +999,12 @@ async def refresh_oauth(
from datetime import datetime, timezone
key.oauth_invalid_at = datetime.now(timezone.utc)
key.oauth_invalid_reason = error_reason
key.is_active = False
key.oauth_invalid_reason = (
f"[REFRESH_FAILED] Token 续期失败 ({resp.status_code}): {error_reason}"
)
db.commit()
logger.warning(
"Key {} OAuth token 刷新失败,已标记为失效并自动停用: {}", key_id, error_reason
"Key {} OAuth token 刷新失败,已标记为刷新失效: {}", key_id, error_reason
)
raise InvalidRequestException(f"token refresh 失败: {error_reason}")