ccswitchmulti icon indicating copy to clipboard operation
ccswitchmulti copied to clipboard

Codex 配置写入在缺失配置与并发修改时保护用户数据

Open zhushihao opened this issue 3 months ago • 1 comments

问题

Codex Desktop 与 CCSwitchMulti 都会写入同一个 config.toml。当当前供应商缺少完整配置、恢复来源不可用,或 Codex 在写入期间更新用户表时,旧的供应商快照可能把用户配置覆盖成空文件或旧内容。

已确认根因

写入路径曾把“缺少配置”当成显式空配置,并在 live 文件读取、合并和首次指纹记录之间存在窗口。这样会覆盖用户的 [desktop]、[plugins]、[projects]、[marketplaces] 和未知用户表。

兼容范围

  • 现有供应商数据库和旧配置格式必须继续可读。
  • 当前 live 文件是用户配置的优先事实来源。
  • 显式清空仍可工作,但缺失输入不能变成空写入。
  • 并发无法安全合并时必须保留外部文件并返回可识别的 deferred 结果。

期望行为

所有 Codex live 写入路径都应采用 live-as-base、原始字节与指纹同一快照、有限重试和 fail-closed 语义;恢复和普通切换都不得静默清空或回滚用户表。

验收建议

覆盖缺失配置、损坏 TOML、并发外部修改、健康备份回退、普通切换预检和原子 writer 的回归测试。

zhushihao avatar Aug 24 '26 09:08 zhushihao

Resolved in the v3.19.2-25 line by 137eefb7 and 213df3ea. Codex writes reconcile from one live snapshot with bounded optimistic retries, preserve unknown/user-owned tables, and return explicit concurrent-modification errors instead of replacing live config with stale or missing Provider data.

BigStrongSun avatar Sep 02 '26 19:09 BigStrongSun