Repository navigation
fix(officeace,db,api,web): APIG.1009 重登无效且启用不解硬禁用 - #64
Merged
Merged
Conversation
virtiofs 上 flock 不跨宿主/容器,单实例锁失效;双写会损坏 SQLite(database disk image is malformed)。切换部署前先停一侧,容器运行时勿动 -wal/-shm。
officeAce 的聊天凭据(Basic model_app_key)与额度/签到凭据(临时 AK/SK) 是两套:OAuth 重登时 `client-permission-validate` 原样下发**同一对** app key,于是「登录成功 → 下次聊天 401 → 硬禁用 session dead」反复发生 (实测 2026-12-01 robbsluo 连登三次,每次拿回的 key 与库内一字不差)。 同时 `toggle enabled=true` 只翻 `enabled` 不清 `disabled`,留下 `enabled=1` 且 `disabled=1` 的僵尸态——管理台点「取消暂停」界面仍显示 session dead,运维只会继续重登。 - officeace: 新增 `disabled_reason()`,APIG.1009 明确告知「重登无效, 去 OfficeAce 客户端『模型 → 接入模型』重新接入」;APIG.0303 刻意排除 (控制面 AK/SK 过期同码,等预刷新即可) - probe_failure: `relogin_reason()` 接受可选 provider,渠道自带 `disabled_reason` 时优先用,认不出回落通用文案(四个调用点已传入) - credential_login: 新增 `validate_login_credential()`,登录落库后用只读 `list_models` 校验聊天凭据(仅 officeace)。只有上游判 DEAD 才写回 「需重新登录」,网络/限流/协议异常一律视为通过 - admin_auth: poll / complete 两条登录路径统一走 `_login_success()`, 带 `warning` 字段;为空时不落键,既有响应逐字节不变 - db: `set_enabled(enabled=True)` 一并清 `disabled` / `disabled_reason` / `err_count`,但不动冷却(归「恢复 / 强制恢复」) - web: 登录成功但带 warning 时提示「但<原因>」;取消暂停的提示补上 「硬禁用也一并解除」 测试:新增 13 条(officeace disabled_reason、relogin_reason 渠道优先、 登录后校验的 DEAD/瞬时/缺实现/解密失败分支、poll 带 warning、启用清硬禁用), 后端行/分支覆盖率 100%(6319 passed,移走 .env 复跑),前端 953 passed。
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.
背景
officeAce 的聊天凭据(
Basic model_app_key)与额度/签到凭据(临时 AK/SK)是两套。OAuth 重登时client-permission-validate原样下发同一对 app key,于是「登录成功 → 下次聊天 401 → 硬禁用 session dead」反复发生。实测 2026-12-01 robbsluo 连登三次,每次拿回的 key 与库内一字不差。同时
toggle enabled=true只翻enabled不清disabled,留下enabled=1且disabled=1的僵尸态——管理台点「取消暂停」界面仍显示 session dead,运维只会继续重登。改动
src/provider/officeace/events.pydisabled_reason():APIG.1009→ 「重登无效,去 OfficeAce 客户端『模型 → 接入模型』重新接入」;APIG.0303刻意排除(控制面 AK/SK 过期同码,等预刷新即可)src/provider/probe_failure.pyrelogin_reason()接受可选provider,渠道自带disabled_reason时优先用,认不出回落通用文案src/api/credential_login.pyvalidate_login_credential():登录落库后用只读list_models校验聊天凭据(仅 officeace)。只有上游判 DEAD 才写回「需重新登录」src/api/admin_auth.py_login_success(),带warning;为空时不落键src/db/repo.pyset_enabled(enabled=True)一并清disabled/disabled_reason/err_count,不动冷却web/验证
ruff check src tests scripts通过.env复跑,模拟 CI):6319 passed,行/分支覆盖率 100%tsc --noEmit通过;vitest run953 passed;pnpm build通过docker compose build+up -d:容器 healthy,/healthz200POST /toggle {"enabled":true}打 robbsluo → 库里enabled=1, disabled=0, disabled_reason=NULL注意
本分支还带着一条
docs(deploy): 禁宿主与容器双写同一 DATA_DIR(121b6bd),与本次修复无关但已在同一分支上。如需拆分可以说明。