From 56c6b9e4520855486b5c73d7a1f82cfec2ca3474 Mon Sep 17 00:00:00 2001 From: phamnazage-jpg Date: Fri, 22 May 2026 10:03:49 +0800 Subject: [PATCH] docs(execution): sync board with current production truth --- docs/EXECUTION_BOARD.md | 238 +++++++++++++--------------------------- 1 file changed, 77 insertions(+), 161 deletions(-) diff --git a/docs/EXECUTION_BOARD.md b/docs/EXECUTION_BOARD.md index f48724e6..c4e19501 100644 --- a/docs/EXECUTION_BOARD.md +++ b/docs/EXECUTION_BOARD.md @@ -1,50 +1,25 @@ # sub2api-cn-relay-manager 执行板 -日期:2026-05-21 +日期:2026-05-22 当前 Gate:APPROVED(代码门禁已通过,并且 2026-05-21 已继续收掉 account probe、gateway probe 认证语义和 latest-head `self_service` fresh-host 复验的剩余问题。最新 MiniMax 53hk fresh-host 验收 `artifacts/real-host-acceptance/20260521_191418_remote43_minimax_key_import/21-summary.json`、DeepSeek 2166 `subscription` fresh-host 验收 `artifacts/real-host-acceptance/20260521_201509_remote43_deepseek_key_import/21-summary.json`、以及 latest-head `self_service` 标准 fresh-host 验收 `artifacts/real-host-acceptance/20260521_210403/05-import.json` / `07-access-status.json` 已共同证明:`subscription` 与 `self_service` 主链路都能在真实 fresh host 上闭环到 ready,host `/v1/models` 与 `/v1/chat/completions` 也都真实返回 `HTTP 200`。当前仍存在的 `reconcile=drifted` 只反映共享 fresh-host 环境里的历史残留资源,不阻塞 PRD 首版放行) 目标:实现独立控制面、零侵入宿主、可导入国产模型并具备可运维的导入/回滚/访问闭环。 -## 2026-05-21 校准说明(最新真相) +## 2026-05-22 当前真相 -- 401 假阴性已关闭:`artifacts/real-host-acceptance/20260521_064403_remote43_deepseek_key_import` 与 `20260521_064454_remote43_minimax_key_import` 的 `09-models.headers.txt` 都是 `HTTP 200`,说明 managed probe key / 本机 `PACK_PATH` 修复生效。 -- fresh-host DB 侧状态也已对齐:在脚本指向正确的 `sub2api-fresh-deepseek-20260519_115244-{postgres,redis}-1` 后,`08-subscription-group-state.json` 已能看到真实的 managed user / subscription / key 绑定,而不是旧 relaymgr 容器造成的空/null 假象。 -- 这一轮之前的新主阻断不是 auth/tooling,而是 completion smoke:两条 provider 一度在 host `/v1/chat/completions` 返回 `502 upstream_error`。 -- 上游直探分流证明: - - DeepSeek 上游 `/chat/completions` = `HTTP 200`,因此 host 侧 502 是真实兼容性问题,不是单纯 key 失效。 - - MiniMax 上游 `/chat/completions` = `HTTP 403 insufficient_user_quota`,因此当前验证 key 本身不具备真实 completion 流量能力。 -- 2026-05-21 进一步缩圈结果: - - DeepSeek managed key 直打 fresh host `http://127.0.0.1:18097/v1/chat/completions` 仍稳定返回 `502`;但同一台 remote43 主机直接 `curl https://aitoken.quanfuli.cn/v1/chat/completions`(同一 upstream key、同一 payload)返回 `HTTP 200`,且 `Content-Type: text/event-stream`。 - - fresh-host app 日志显示 DeepSeek group `5` 当前挂了 10 个 active account(IDs `14,15,16,17,19,20,23,25,26,28`),chat 请求会在这些重复 account 之间 failover,全部记为 `account_upstream_error 500/502` 后才落成 gateway `502`。 - - MiniMax group `6` 当前挂了 6 个 active account(IDs `18,21,22,24,27,29`),`temp_unschedulable_reason` 都明确记录为 `insufficient_user_quota`;说明它的 completion 阻断已不是 CRM/host 路由问题,而是验证 key 配额不足。 -- 汇总证据:`artifacts/real-host-acceptance/20260521_064910_completion_smoke_calibration.md` -- 2026-05-21 当前代码已补一层稳定性收口:`internal/provision/import_service.go` 在 replacement account 全部通过 smoke 校验后,会先清理同 provider 前缀的旧 account 再做 gateway closure,避免重复导入把同 group 污染成多活重复 account;若 replacement 校验失败则保留旧 account,不做破坏性清理。 -- 2026-05-21 同时新增 `scripts/check_deepseek_completion_split.sh`,可把 DeepSeek “host models=200 / host chat=502 / upstream chat=200” 压缩成可复现的最小 issue 证据包。 -- 2026-05-21 本机 CRM(18100) 已补上 reconcile stale-noise 分类:对 `remote43-fresh18097-deepseek-1779280533` 执行 `POST /api/providers/deepseek/reconcile` 后,`batch_id=13` 返回 `extra_count=0`、`raw_extra_count=15`、`stale_noise_count=15`、`status=degraded`;说明旧同前缀账号已不再被记成 drift,只剩真实 `probe_failures=1` 继续暴露。 -- 2026-05-21 当前代码又补了一层 readiness 收口:`internal/access/closure.go`、`internal/provision/import_service.go`、`internal/provision/batch_detail_and_reconcile_service.go`、`internal/app/http_api.go` 现在都会在 `/v1/models` 通过后继续执行一次最小 `POST /v1/chat/completions` smoke;未通过 completion 的链路不再被记成 `subscription_ready/self_service_ready`。 -- 2026-05-21 `scripts/import_remote43_provider.sh` 已新增 upstream `/models` 与 `/chat/completions` 直探,额外落盘 `17-upstream-models.*`、`19-upstream-chat.*`、`21-summary.json`,用于把“宿主兼容层问题”和“上游 key/quota 问题”分流。 -- 2026-05-21 patched CRM fresh-host 复验结果: - - DeepSeek:`artifacts/real-host-acceptance/20260521_172709_remote43_deepseek_key_import/03-import.body.json` 已返回 `access_status=broken`,并在 `gateway` 中明确写入 `completion_ok=false`、`completion_status=502`;`21-summary.json` 显示 `upstream_chat_status=403`、`completion_classification=upstream_key_quota_issue` - - MiniMax:`artifacts/real-host-acceptance/20260521_172646_remote43_minimax_key_import/03-import.body.json` 已返回 `access_status=broken`,并在 `gateway` 中明确写入 `completion_ok=false`、`completion_status=502`;`21-summary.json` 同样显示 `upstream_chat_status=403`、`completion_classification=upstream_key_quota_issue` -- 2026-05-21 account probe 最后一层剩余问题已确认并关闭: - - 新 artifact:`artifacts/real-host-acceptance/20260521_191418_remote43_minimax_key_import` - - 结论:MiniMax 53hk 当前已从 `partially_succeeded/degraded` 收口到 `succeeded/active` - - 根因 1:`internal/host/sub2api/accounts.go` 之前只取 SSE 最后一个 payload 的 `status/message/ok/success`,会把 `type=error` 的真实错误原因吃掉,落成“failed + 空 message” - - 根因 2:`internal/provision/import_service.go` 与 reconcile rerun 之前没有给 `POST /api/v1/admin/accounts/:id/test` 传 `provider.SmokeTestModel`,宿主默认用 `gpt-5.4` 做账号测试,因 channel pricing restriction 误把 MiniMax 账号记成 failed - - 修复后最新 batch detail `04-batch-detail-initial.json` 已显示:`account_status=passed`、`probe_ok=true`、`validation_status=passed` -- 2026-05-21 DeepSeek 2166 路由的项目级 fresh-host 复验也已收口: - - 新 artifact:`artifacts/real-host-acceptance/20260521_201509_remote43_deepseek_key_import` - - 结论:DeepSeek 当前已从 `partially_succeeded/degraded` 收口到 `succeeded/active` - - 关键证据:`21-summary.json` 显示 `batch_status=succeeded`、`provider_status_from_import=active`、host `/v1/chat/completions` = `200`、upstream `/chat/completions` = `200` - - `16-batch-detail-final.json` 已显示:`account_status=passed`、`probe_ok=true`、`validation_status=passed` -- 2026-05-21 latest-head `self_service` fresh-host 复验也已收口: - - 最新完整标准 artifact:`artifacts/real-host-acceptance/20260521_210403` - - `05-import.json` 已显示:`batch_status=succeeded`、`access_status=self_service_ready`、`provider_status=active` - - `06-access-preview.json` / `07-access-status.json` 已显示:`available=true`、`latest_access_status=fully_ready` - - 期间暴露并修复的最后一个代码级根因是:`internal/host/sub2api/gateway_probe.go` 之前把普通用户 gateway key 错误地放进 `x-api-key`,而真实宿主要求 `Authorization: Bearer ` - - `09-reconcile.json` 仍是 `status=drifted`,但 `summary.access_status=self_service_ready`,说明当前 shared fresh-host 里的历史残留资源仍存在,不影响本次访问闭环结论 -- 结论更新:旧的 code-side false positive、MiniMax account probe 假失败、DeepSeek completion 阻断、以及 latest-head `self_service` gateway probe 认证偏差都已真实关闭;当前 Gate 可以按 PRD 首版范围提升为 `APPROVED`。 -- 调通细节与经验沉淀:`docs/REAL_HOST_ACCEPTANCE_LEARNINGS.md` -- 代码门禁与本地运行态已于 2026-05-21 在这轮补丁后再次独立复跑:`gofmt -l .`、`go vet ./...`、`go test ./... -count=1`、`go test -race ./... -count=1`、`go test -cover ./internal/... -count=1`、`go test ./tests/integration/... -count=1`、`bash ./scripts/test_real_host_scripts.sh` 全通过;覆盖率当前为 `internal/access 80.5%`、`internal/host/sub2api 78.1%`、`internal/pack 73.9%`、`internal/provision 76.3%`。 +- 当前主目录 `artifacts/real-host-acceptance/` 已只保留最终证据;历史调试样本已迁到 `artifacts/real-host-acceptance-archive/` +- access ready 语义已经收口为:`/v1/models` 命中 `smoke_test_model`,且最小 `POST /v1/chat/completions` smoke 成功;不会再出现 models-only 假 ready +- `subscription` 主链路已通过 latest fresh-host 复验: + - MiniMax 53hk:`artifacts/real-host-acceptance/20260521_191418_remote43_minimax_key_import/21-summary.json` + - DeepSeek 2166:`artifacts/real-host-acceptance/20260521_201509_remote43_deepseek_key_import/21-summary.json` +- `self_service` 主链路已通过 latest-head 标准 fresh-host 复验: + - `artifacts/real-host-acceptance/20260521_210403/05-import.json` + - `artifacts/real-host-acceptance/20260521_210403/07-access-status.json` +- 官方 provider 验证矩阵当前仍保留一条非阻塞事实: + - `artifacts/real-host-acceptance/20260521_222212_remote43_minimax-m2-7-official_key_import/21-summary.json` 已证明 official MiniMax 模板链路是通的,但该验证 key 当前命中 upstream `429` +- `reconcile=drifted` 仍可能在 shared fresh-host 上出现,但当前解释是“历史残留资源噪音”,不阻塞 PRD 首版放行 +- 调通细节与诊断经验已沉淀到: + - `docs/REAL_HOST_ACCEPTANCE_LEARNINGS.md` + - `docs/REAL_HOST_ARTIFACT_RETENTION.md` ## 本轮已完成 @@ -67,33 +42,28 @@ 6. 文档真相同步 - 新增 `docs/2026-05-18-PRODUCTION_REMEDIATION_TASK_BOARD.md` - 下调 `DEPLOYMENT.md` 中未实现的 `/metrics` / 限流 / 监控承诺 -7. 真实宿主重新验收已执行 - - `self_service` 新 artifact:`artifacts/real-host-acceptance/20260518_self_service_reaccept_v6` - - `subscription` 新 artifact:`artifacts/real-host-acceptance/20260518_subscription_reaccept_v6` - - 两轮都完成了 `preview-import / import / access-preview / status / reconcile / rollback` 全链路落盘 -8. reconcile host-scope 证据已补强 - - `self_service`:`artifacts/real-host-acceptance/20260518_reconcile_hostscope_self_service` - - `subscription`:`artifacts/real-host-acceptance/20260518_reconcile_hostscope_subscription` - - 已补齐 `status / resources / reconcile / batch detail / rollback` 的 host-scoped artifact,验证 batch detail 的 reconcile 视图按 batch 收口 -9. current-code remote43 导入链路已补齐 tunnel-aware 验证能力 +7. current-code remote43 导入链路已补齐 tunnel-aware 验证能力 - `scripts/import_remote43_provider.sh` 新增 `CRM_HOST_BASE`,允许把“operator 访问 host 地址”和“CRM 进程访问 host 地址”分离 - - latest artifact:`/home/long/artifacts/real-host-acceptance/20260519_195827_remote43_deepseek_key_import` - - 结论:import / batch detail / managed resources 已真实落库;前一轮定位到 channel 创建缺少 model_mapping / restrict_models / billing_model_source,已补齐实现与测试 -10. current-code remote43 access gate 根因修正已落地 + - 历史 live model-mapping 关键证据保留在:`artifacts/real-host-acceptance/20260520_222713_crm18100_live_model_mapping_validation` +8. current-code remote43 access gate 根因修正已落地 - subscription access 改为宿主侧闭环:CRM 不再依赖外部预先给定的宿主普通用户 key,而是按 `subscription_users` selector 在宿主创建/查找托管普通用户、登录创建托管 key、回写 allowed_groups / balance、再执行订阅分配 - account 创建请求现在同步写入 `credentials.model_mapping`,修正 `/v1/models` 读取 account model whitelist 时回退到 GPT 默认集合的问题 - 新增/更新测试覆盖:`internal/access`、`internal/provision`、`internal/host/sub2api` -11. current-code access ready 语义已提升到 completion 层 +9. current-code access ready 语义已提升到 completion 层 - `/v1/models` 不再单独决定 `subscription_ready/self_service_ready` - 只有 `/v1/models` 命中 `smoke_test_model` 且 `/v1/chat/completions` smoke 成功,控制面才会把 access 状态记成 ready - access closure / import runtime artifact / reconcile rerun payload 都会持久化 `completion_ok/completion_status/completion_type/completion_preview` -12. current-code remote43 验收脚本已补 upstream API 证据层 +10. current-code remote43 验收脚本已补 upstream API 证据层 - `scripts/import_remote43_provider.sh` 会直探 provider `base_url` 对应的 upstream `/models` 与 `/chat/completions` - 新增 `21-summary.json`,用于把 completion 失败自动分流成 `host_compatibility_gap` 或 `upstream_key_quota_issue` -13. patched CRM external validation 已完成 +11. patched CRM external validation 已完成 - patched CRM 实例下,DeepSeek 与 MiniMax 都已验证“completion smoke 通过时能落成 succeeded/active,失败时不会误记成 ready” - `20260521_191418_remote43_minimax_key_import` 与 `20260521_201509_remote43_deepseek_key_import` 已同时证明当前 `subscription` provider 链路可真实闭环 - - `20260521_210403` 已证明 latest-head `self_service` 标准 fresh-host 验收也可闭环到 `self_service_ready` / `fully_ready` + - `20260521_210403` 已证明 latest-head `self_service` 标准 fresh-host 验收也可闭环到 `self_service_ready / fully_ready` +12. artifact 保留策略已收口 + - 主目录 `artifacts/real-host-acceptance/` 当前只保留最终证据 + - 历史失败/半成功/试错样本已迁到 `artifacts/real-host-acceptance-archive/` + - 分类规则见:`docs/REAL_HOST_ARTIFACT_RETENTION.md` ## 已验证门禁 @@ -110,130 +80,76 @@ - `go test ./tests/integration/... -count=1` ✅ - `bash ./scripts/test_real_host_scripts.sh` ✅ -## 本轮真实宿主复验结果 +## 当前保留的最终证据 -0. `ca1d448` latest-head stale-process 阻断已关闭(2026-05-21) - - 本地 CRM(18100) 新进程启动时间:`2026-05-21 01:08` - - 当前 18100 使用的真实 DB:`/tmp/sub2api-relay-manager-realhost-18100.db` - - fresh remote43 证据目录: - - `artifacts/real-host-acceptance/20260521_011544_remote43_minimax_key_import` - - `artifacts/real-host-acceptance/20260521_011717_remote43_deepseek_key_import` - - MiniMax:`03-import.body.json` 显示 `batch_id=7`、`access_status=subscription_ready`、`gateway.status_code=200` - - DeepSeek:`03-import.body.json` 显示 `batch_id=8`、`access_status=subscription_ready`、`gateway.status_code=200` - - 宿主 admin 侧直接复核: - - `GET /api/v1/admin/channels/5`(MiniMax)已含非空 `model_pricing` 与 `model_mapping` - - `GET /api/v1/admin/channels/4`(DeepSeek)已含非空 `model_pricing` 与 `model_mapping` - - 旧现象的根因时间线已确认:`artifacts/real-host-acceptance/20260520_222713_crm18100_live_model_mapping_validation/summary.json` 中 MiniMax channel 5 仍是 `model_pricing=[]`,且 `created_at=updated_at=2026-05-20T20:39:23Z`,说明它是旧 CRM 进程创建出的半成品 channel,而不是 current-code rerun 后依然未纠偏 - - 当前 live host 上同一 channel 5 的 `updated_at=2026-05-21T06:45:00Z`,且 `model_pricing` 已非空,证明新进程已真正执行 `UpdateChannel` 纠偏 - - 结论:`ca1d448` 对 channel pricing / hosted access 的修正已在真实宿主 fresh rerun 上落地,之前“旧 CRM 进程导致 MiniMax channel 仍空 pricing”的阻断已消失 +1. `artifacts/real-host-acceptance/20260520_222713_crm18100_live_model_mapping_validation` + - 证明 account `credentials.model_mapping` 与 live runtime 对齐 -1. `self_service`(最新 fresh redeploy 复验) - - 证据目录:`artifacts/real-host-acceptance/20260518_redeploy_matrix` - - 初始状态:普通用户 key 未绑定 group、用户余额为 0 时,`/v1/models` 返回 `403` - - 修正后:对普通用户执行“key 绑定标准 group + 用户余额=10”后,`04-self-after-balance.headers.txt` 显示 `HTTP/1.1 200 OK` - - 结论:`self_service` 主链路已在 fresh host 上真实打通;当前关键前置条件已收敛为 runbook 中明确记录的普通用户创建 / key-group 绑定 / 余额要求,而不是代码级阻塞。 -2. `subscription`(最新 fresh redeploy 复验) - - 证据目录:`artifacts/real-host-acceptance/20260518_redeploy_matrix` - - 修正后:创建 subscription 类型 group、完成普通用户订阅分配、并把普通用户 key 绑定到该 group 后,`06-subscription-after-assign.headers.txt` 显示 `HTTP/1.1 200 OK` - - 结论:`subscription` 主链路也已在 fresh host 上真实打通;其可用前提不是“宿主自动初始化一切”,而是显式完成 subscription group / user subscription / key binding 这一套运营动作。 +2. `artifacts/real-host-acceptance/20260521_142211_crm18100_deepseek_completion_split` + - 证明 host completion 失败与 upstream completion 成功可以分离 + - 是 completion 分流逻辑的关键根因证据 -## 2026-05-19 current-code remote43 验收补充结论 +3. `artifacts/real-host-acceptance/20260521_191418_remote43_minimax_key_import` + - MiniMax 53hk `subscription` 最终成功样本 + - `21-summary.json` 已到 `batch_status=succeeded`、`provider_status=active` -1. 验收入口 - - 证据目录:`/home/long/artifacts/real-host-acceptance/20260519_195827_remote43_deepseek_key_import` - - 本地 CRM 通过隧道访问 remote host,`CRM_HOST_BASE` 指向 CRM 侧可达的 host 地址 -2. 导入链路结论 - - `import` 成功返回 `batch_id=19` - - `managed_resources` 已包含 `group/channel/plan/account` - - `provider_status=partially_succeeded`,说明已进入真实业务路径,不再是 host 注册/pack path/隧道前置问题 -3. access gate 失败结论 - - `latest_access_status=broken` - - `access preview available=false` - - `reconcile status=drifted`,其中 `probe_failures=1` -4. 当前修正 - - 旧 artifact 中 `09-models.headers.txt` / `10-models.body.json` 暴露 GPT 系模型,根因已重新归类为:CRM 写了 channel model_mapping,但 account `credentials.model_mapping` 未同步,导致宿主 `/v1/models` 从 account 视图回退到默认模型集 - - 同时,旧脚本/调用路径把外部 `subscription_users` / `access_api_key` 直接当宿主用户和宿主 key 使用,无法形成“宿主普通用户创建/查找 + key + 订阅分配”的真正闭环;该问题现已改为宿主托管闭环 - - 代码侧阻断点已修复;下一步只剩 DeepSeek / MiniMax 真实 key 复验 +4. `artifacts/real-host-acceptance/20260521_201509_remote43_deepseek_key_import` + - DeepSeek 2166 `subscription` 最终成功样本 + - `21-summary.json` 已到 `batch_status=succeeded`、`provider_status=active` -## 剩余项(含当前外部门禁) +5. `artifacts/real-host-acceptance/20260521_210403` + - latest-head `self_service` 标准 fresh-host 验收最终成功样本 + - `05-import.json` = `succeeded/self_service_ready/active` + - `07-access-status.json` = `latest_access_status=fully_ready` -1. current-code code-side false positive 已关闭,fresh-host 外网复验证据已补齐 - - `artifacts/real-host-acceptance/20260520_222713_crm18100_live_model_mapping_validation` 已证明 account `credentials.model_mapping` 与 managed key 视角模型暴露正确 - - `20260521_172646_remote43_minimax_key_import` / `20260521_172709_remote43_deepseek_key_import` 已证明 patched CRM 下 control plane 会把 completion 失败正确落成 `broken` - - 旧阻断“CRM(18100) 进程过旧导致 MiniMax channel `model_pricing=[]`”已被 host admin 现场证据推翻:`GET /api/v1/admin/channels/5` 现已返回非空 `model_pricing` - - 当前 remaining gap 已不再是“控制面把 models-only 场景误报成 ready”,而是两把验证 key 的 upstream completion 都已明确返回 `403 insufficient_user_quota` -2. 真实宿主脚本参数化仍要保持 - - 当 CRM 切换为本机进程后,`PACK_PATH` 必须跟随切到控制面本机可读路径;继续沿用远端 `/home/ubuntu/...` 会触发 `stat pack path ... no such file or directory` - - 但当前脚本已经额外具备 upstream 直探与 `21-summary.json` 分类能力,可直接作为 fresh rerun 的主入口,而不必再先修新的工具链 -3. 结构债务仍存在 - - access / reconcile 尚未完全按 implementation plan 物理拆分 - - 无内置 scheduler/jobs -4. 运营前置动作需要 runbook 化执行 - - 真实宿主初始化不会自动创建普通用户;当前 CRM subscription 闭环已证明 managed key 语义正确,但 fresh restart 后仍需重新做整条 live 验收,才能把“宿主托管普通用户/key”从代码能力提升为已验收事实 +6. `artifacts/real-host-acceptance/20260521_222212_remote43_minimax-m2-7-official_key_import` + - official MiniMax 模板 live 样本 + - 模板链路打通,但当前验证 key 命中 upstream `429` + +## 剩余项(P2 / 运营前置,不阻塞按 PRD 首版范围上线) + +1. 运营前置 + - 真实宿主初始化不会自动创建普通用户;上线前必须显式创建普通用户并留存可复用凭据 - `self_service` 需要普通用户 key 绑定目标标准 group,且通常还需要可用余额 - `subscription` 需要 subscription 类型 group + 普通用户订阅分配 + key/group 绑定 -5. 标准多阶段 Dockerfile 在受限网络环境下仍不稳 + +2. 结构债务 + - access / reconcile 仍未完全按 implementation plan 拆到独立子模块 + - 当前仍无内置 scheduler/jobs + +3. 部署与环境限制 + - 标准多阶段 Dockerfile 在受限网络环境下仍不稳 - 当前推荐 `scripts/build_local_image.sh` + `Dockerfile.local` -6. 真实宿主验收工具需补 host 级参数化 - - `scripts/real_host_acceptance.sh` 的 `AFTER_IMPORT_HOOK_COMMAND` 仍有价值,但 remote43/fresh-host 变体还缺“目标 Postgres/Redis 容器名、目标 host env 文件、目标 forward 端口”的显式参数化 - - 否则 artifact 会混入旧宿主状态,误导 gate 判断 -## 当前最短上线路径 +4. official provider 验证矩阵 + - official MiniMax 当前 live 样本已证明模板链路可用,但验证 key 命中 upstream `429` + - Qwen / GLM / Kimi / Step 等官方 provider 是否通过 live 验收,仍取决于后续官方 key 与 quota -1. 替换 DeepSeek / MiniMax 的验证 key,要求具备真实 completion quota -2. 用当前脚本重新跑 remote43/fresh-host 验收,检查新的 `21-summary.json` -3. 若换 key 后 upstream `/chat/completions` 变成 `200`,再看 host `/chat/completions` 是否仍有兼容性问题 -4. 当前代码状态可维持 “代码侧 `CONDITIONAL_APPROVED`、外部门禁 `BLOCKED`” +## 当前最短后续路径 + +1. 若继续扩大 provider 覆盖面,优先按 `docs/PROVIDER_VALIDATION_MATRIX.md` 补官方 key,再做 official live 验收 +2. 若继续优化 shared fresh-host 信噪比,对历史残留资源做一次环境清理,降低 `reconcile=drifted` 噪音 +3. 若继续产品化,推进 `v2` 的 batch auto-import 设计评审,再开始实现 ## v2 规划:Batch Auto-Import(URL + Key) +**当前阶段**:🔨 设计中(待评审与完善) + **文档**:`docs/2026-05-21-BATCH_AUTO_IMPORT_SPEC.md`(需求规格) -**TDD 计划**:`docs/2026-05-21-BATCH_AUTO_IMPORT_TDD_PLAN.md`(实现路径) +**TDD 计划**:`docs/2026-05-21-BATCH_AUTO_IMPORT_TDD_PLAN.md`(实现路径,已确认开放问题) -**核心目标**:管理员只需提供 `(base_url, api_key)` 列表,系统自动完成上游模型探测 → 宿主 channel 扩展 → provider 注册 → 中转闭环验证,全程无需预置 provider manifest。 +**设计待完成**: +- [ ] **技术设计**:API 接口(CLI + HTTP)、数据模型、DB schema 变更、错误处理 +- [ ] **UI 设计**:CLI 输出格式 / HTTP API 文档 / Web 控制台(待确认交付形态) +- [ ] **评审**:相关专业人员评审设计文档 -**三阶段管道**: -``` -Stage 1 (Probe) → GET /v1/models 获取模型列表,smoke test completion -Stage 2 (Provision) → channel 自动扩展 model_mapping,创建/更新 account -Stage 3 (Validate) → host relay completion 测试,写 access_status -``` - -**新增模块**: -- `internal/probe/` — 上游探测(models 解析 / completion smoke / 错误分类) -- `internal/batch/` — 批量编排(URL→provider_id / model_mapping 扩展 / 管道服务) -- `cmd/cli/batch_import.go` — CLI 入口 -- `internal/host/sub2api/channel.go` — PatchChannel 扩展 - -**成功标准**: -- 单条和文件批量输入均可 -- 重复导入同一 URL+key 幂等(不重复创建 channel/account) -- strict/partial 两种模式 -- Stage 3 completion 通过时 `access_status=active`,失败时正确降级 -- 全流程不修改宿主源码,不写宿主数据库 - -**任务清单**(共 10 项,详见 TDD_PLAN): -- [ ] probe/models + test -- [ ] probe/classifier + test -- [ ] probe/completion + test -- [ ] batch/provider_id + test -- [ ] batch/channel_evolution + test -- [ ] host/channel.go PatchChannel + test -- [ ] batch/service + test -- [ ] cmd/cli/batch_import -- [ ] integration test -- [ ] 全量门禁 - -**开放问题(已决策)**: -1. ~~smoke test model 选择策略~~ → 选 C:遍历找第一个可用的 -2. ~~model_pricing 为空时 restrict_models 行为~~ → 选 B:自动补空 pricing -3. ~~provider_id 冲突策略~~ → 选 B:host + hash(`{normalized_host}-{url_hash_last8}`) +**实现暂停**:等设计评审通过后再开始写代码 --- ## 禁止错误结论 -|- ❌ 历史失败 artifact ≠ 当前 fresh redeploy 仍失败 -|- ❌ capability probe 无副作用 ≠ 所有宿主版本都已真实兼容 -|- ❌ rollback-provider 已改安全路径 ≠ 历史脏资源自动消失 +- ❌ 历史失败 artifact ≠ 当前 latest-head 仍失败 +- ❌ capability probe 无副作用 ≠ 所有宿主版本都已真实兼容 +- ❌ rollback-provider 已改安全路径 ≠ 历史脏资源自动消失 - ❌ `HTTP 200` ≠ 宿主初始化会自动准备普通用户/订阅/余额;这些仍是显式运营前置