model-access 后续跟踪:手机直连长期方案 + PR #36 审查遗留改进项
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 395
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
来自 PR makecindy/cindy-temp#36(登录后自动下发 XD 网关凭据,模型列表以网关为准)的审查跟踪 issue,收两类事项。
## 一、手机版直连 model-access-server 长期方案(规则 26 跟踪,必做)
现状:手机本期零改动兼容——语音等链路经 voiceCredentialSync 穿透口自动携带桌面端同步下来的新凭据。长期方案是手机版作为独立客户端直连 model-access-server:
- 手机端接入 modelAccessApiBaseUrl 端点(clientEndpoints 字段已随 PR makecindy/cindy-temp#36 就位);
- 凭据同步状态机(503 灰度关闭 / 403 企业未接入终态)在 mobile 侧的对应实现;
- 换号 / 登出时的凭据与模型目录清理。
## 二、审查中标记的改进项([建议] 级,不阻合并,逐项收尾)
1. **换账号后租户元数据残留**:`reconcileOwner` 只清 key,不清 `model-access-credentials.json`;冷启动无条件应用持久化模型快照,同机 A→B 换号后 B 首次同步成功前会短暂展示 A 租户的模型清单。建议换号时顺带 `store.clear()` 或至少清 models 快照。
2. **`handleAuthChange` 绕过终态闸**:认证分支直接 `startSync()`(credentialsSync.ts:277),同账号的 `notifyAuthListeners`(如 updateProfile)会在 unsupported/disabled 终态下多打服务端请求(结果幂等,影响仅多余请求)。终态下跳过或注释说明有意。
3. **过期注释同步**:多处注释称 disabled 态「走手填兜底」但手填 UI 已删——effectiveEndpoint.ts:12、providerSecretStore.ts:46-49、providerHandlers.ts:11、credentialsSync.ts:13。若 disabled 灰度语义就是「无存量 key 用户无接入途径」,修注释即可;若「手填兜底」本应存在则是产品缺口,需与 owner 确认。
4. **模型目录世代闸补单测**:P1 修复本体(`authGeneration` / `runModelsSync` / `scheduleModelsSync`,model-access/index.ts)是非平凡并发逻辑但无单测(规则 14);`resetModelAccessForTest` 已导出可复位依赖,补内存 harness 用例成本低。顺带处理该导出目前全仓无人调用的问题。
5. **embedding-host 启动日志**:index.ts:73 `JSON.stringify` 对函数形态 baseUrl 会静默丢字段;index.ts:23 有一行悬空注释(「兜底常量…」下面没有常量)。
## 三、发版顺序硬前置(运维动作,非代码)
合并后、下一个 packaged desktop/mobile 发版前,**必须先给线上 CDN 端点清单(cn + global)补 `modelAccessApiBaseUrl` 字段**——clientEndpoints 全字段必填,缺失即新包启动阻断(老包忽略未知字段,先补清单安全)。
关联:PR makecindy/cindy-temp#36、配套服务端 cindy-server(私有仓)#41。
Contributor guide
Research direction
Start by reading credentialsSync.ts, model-access/index.ts, effectiveEndpoint.ts, providerSecretStore.ts, providerHandlers.ts, and the embedding-host index.ts entry points, then inspect PR #36 and the existing model-access tests. The work is done when the mobile direct-client flow, account cleanup, terminal-state handling, comments, concurrency tests, and logging issues are addressed, with the CDN endpoint inventories updated before release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, devops, mobile-dev, release
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100