feat: 冻结 Claude 环境 profile 为 3 OS 槽位 (R4.2 升级)#1
Merged
Conversation
added 5 commits
June 23, 2026 22:08
R4.2 升级:凭证级 3 OS 槽位冻结式 profile pool(windows/macos/linux), 对应 claude-pro-3 封号根因(同凭证 71 分钟暴露 4 个 device_id + 7 套 anthropic-beta + UA/beta 版本不自洽)。 - pool schema v2:固定 3 槽位,每槽模拟生成冻结 device_id/client_id/ cli_version/beta_set,终身不变;desktop 归并 windows - 预生成(新凭证落库)+ 懒生成(未绑定 pool 凭证首次请求) - 透传路径(mimic=false)也强制重写 metadata.user_id.device_id 为槽位 固定值,与 enableMPT 解耦;不再透传客户端 device_id - 透传路径 anthropic-beta 按槽位 BetaSet 归一,不透传客户端 beta, 消除 UA=2.1.161 却声称 2.1.186 beta 的版本不自洽 - 解除并发与槽位互斥:v2 槽位为共享身份,并发请求复用同槽 (5 个 windows 请求都走 windows 槽),lease 串行锁不再占用 - 学习链路彻底移除:删除 learnClaudeCodeHeaderProfile,source 只剩 simulated;旧 claude_code_header_profile 复用读取保留(旧账号回退) - 旧账号不改动:旧 schema / 旧 profile 回退现有逻辑,不读写不覆盖 - 新增 8 个单元测试 + 1 个并发复用测试;全仓测试通过
Codex profile pool 对齐 Claude v2:3 OS 槽位冻结(windows/macos/linux),
并发复用同槽,旧 Codex 账号统一升级迁移(非保守回退)。
- CodexEnvironmentProfilePool 加 Schema/IsV2;Profile 加 FrozenAt
- newFrozenCodexEnvironmentProfilePool:一次性模拟生成 3 槽冻结
- acquireCodex v2 路径:按客户端 OS 选槽,共享身份无互斥,并发复用
- 旧 Codex 账号统一迁移为 v2(删旧 pool/profile,生成 v2 落库)
- 新凭证落库预生成 v2 pool
手工编辑 profile UI 入口(按槽位编辑字段):
- 后端新增 PUT /:id/{claude,codex}-environment-profile/slot 端点
+ UpdateClaudeEnvironmentProfileSlot / UpdateCodexEnvironmentProfileSlot
+ applyClaude/CodexProfileOverrides 合并非空字段覆盖,保留冻结语义
- 前端 EnvironmentProfileCard: v2 pool 按 3 槽位展示可编辑表单
(device_id/client_id/UA/cli_version/beta_set 等),编辑+保存
- EditAccountModal 接 save-slot 事件调 slot 编辑 API
- 类型 + i18n(zh/en)补齐 slot 编辑相关文案
go build/test 全通过;frontend vue-tsc + vitest + build 通过
- gateway_context_management_test.go: 补 computeFinalAnthropicBeta / computeFinalCountTokensAnthropicBeta 新增的 slotProfile 参数(传 nil) - claude_environment_profile_pool_test.go: nil context 改 context.TODO (SA1012) - 移除未使用的 isV2CodexEnvironmentProfile (unused) - DecodeClaude/CodexEnvironmentProfilePool: 去掉值类型 fast-path, 消除 copylocks (govet) — 走 json marshal 路径 - README: 环境 Profile 池段更新为 3 OS 槽位冻结式 v2 说明
- admin_service_profile_pool_test.go: 重写为 v2 语义(3 槽冻结/bound/ simulated source),容量与并发/tier 解耦 - environment_profile_test.go: 类型断言带 ok 检查 (errcheck) - version_fetcher_service.go: resp.Body.Close() 返回值显式忽略 (errcheck) - codex_environment_profile.go: codexProfileLogger ctx 不再无效赋值 (ineffassign)
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.
背景
对应 claude-pro-3 账号封号根因诊断(71 分钟 145 请求/17.26M token 被封):
改动
R4.2 从「学习+复用」升级为「3 OS 槽位冻结式 profile pool」:
验证
go build ./...全通过go test ./...全仓 42 包 ok