fix: Hub 连接清理顺序修复、OAuth 类型常量提取、disassociate 逻辑优化

- Hub proxy/worker 连接关闭时先 unregister 再延迟 abort writer,确保缓冲消息排空
- 提取 OAUTH_AUTH_TYPES 常量,替代各处硬编码的 OAuth 类型列表
- auto-disassociate 跳过 OAuth Key,避免其动态 allowed_models 干扰判定
- 删除 Key 时传入 skip_disassociate=True,跳过不必要的解关联检查
- ModelMapper 缓存命中时将 ORM 实例脱离 Session,修复 DetachedInstanceError
This commit is contained in:
fawney19
2026-03-08 23:03:56 +08:00
parent f5f7a23bb0
commit 91b6e0a382
9 changed files with 40 additions and 12 deletions

View File

@@ -202,7 +202,7 @@ def test_clear_oauth_invalid_response_invalidates_caches(
@pytest.mark.asyncio
async def test_run_delete_key_side_effects_not_skip_disassociate(
async def test_run_delete_key_side_effects_skip_disassociate(
monkeypatch: pytest.MonkeyPatch,
) -> None:
captured: dict[str, Any] = {}
@@ -225,4 +225,4 @@ async def test_run_delete_key_side_effects_not_skip_disassociate(
)
assert captured["provider_id"] == "provider-1"
assert "skip_disassociate" not in captured
assert captured["skip_disassociate"] is True