Skip to content

feat(gateway): P0 凭证池稳定 identity 与 Admit/Gateway 统一快照 #850

Description

@xiaocheny214

背景

#842 已按 primary.key{i} 做 i2v 在途与 429 分车道,但成员身份仍是 CSV 下标:配置头部插 key 或删中间 key 时,Redis 在途/冷却会绑到另一把物理钥匙。同时 Admit 动态读 env、Gateway 启动冻住 _routes,两份名单可能分叉。

#843 总 Issue 分期交付;本 Issue 只覆盖 P0:稳定 credential_id、统一快照、#842 车道键迁移,以及四表 ORM 骨架(运行时仍可无 DB)。

目标

  • credential_id = {endpoint_id}:{sha256(api_key)[:16]},禁止再生成 primary.key{i} 作为 route_id
  • Admit 与 Video/Image/Chat Gateway 均经 get_pool_snapshot / pool_routes 读同一份成员表
  • i2v Redis 在途键:windup:i2v:gate:inflight:cred:{credential_id};deploy 一轮内兼容 primary.key{i}credential_id 映射
  • 新增 pool_models(四表 ORM)、pool_registryimport_gateway_pool_from_env.py;无 DB 时退回 AI_ROUTE_*

不在本 Issue

  • disable / drain / AUTH 摘选路(P1)
  • capability 型号目录(P2)
  • quota_scope=account 账号舱壁(P3)

#843

验收标准

  • 配置头部插入或中部删除 key 后,旧任务 Redis 在途/冷却仍绑原物理凭证(credential_id 不变)
  • Admit try_acquire 与 Gateway poll_i2v(route_id=...) 使用同一 credential_id
  • 无 DB 时纯 env 行为与 fix(i2v): 全站在途名额与 429 冷却,避免动作建单打满上游 #842 合入后一致(key 数、inflight_max、429 分车道)
  • uv run pytest tests/test_gateway_pool_ids.py tests/test_gateway_pool_models.py tests/test_i2v_admit.py tests/test_gateway_video.py tests/test_gateway_image.py tests/test_gateway_chat.py 通过

实现 PR

备注

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions