Appearance
models auth login --provider openai-codex 写入错误 profile 并破坏 agents.defaults.models 配置(v2026.4.15)
问题
在 OpenClaw v2026.4.15 中,执行 openclaw models auth login --provider openai-codex 后出现三个确定性 bug,每次 OAuth 登录均可 100% 复现:
Bug A:profile-ID 路由错误
- 期望:写入
openai-codex:default - 实际:写入
openai-codex:<email>,导致配置文件引用 default 时找不到凭证
Bug B:agents.defaults.models 被覆盖(数据丢失)
- 登录前有 6 个条目(含别名和 per-model 参数配置)
- 每次 OAuth 登录后被压缩为 1 个条目,自定义别名和参数全部丢失
Bug C:auth-profiles.json 被错误路由
- 认证配置文件被写入
cron-agent/目录而非正确路径
解决方案
临时缓解措施(v2026.4.15):
修复 Bug A:登录完成后手动重命名 profile:
bash# 找到错误写入的 profile openclaw models auth list --provider openai-codex # 将 :email profile 复制为 :default # 具体操作取决于配置文件位置,通常在 ~/.openclaw/profiles.json保护
agents.defaults.models(防止 Bug B):登录前备份:bashcp ~/.openclaw/config.json ~/.openclaw/config.json.backup # 登录完成后对比并还原 agents.defaults.models 块Bug C 修复:检查
cron-agent/目录下是否存在auth-profiles.json,将其移动到正确路径(通常是~/.openclaw/)。
根本修复:等待官方 v2026.4.16+ 修复版本,该版本已在追踪此三联 bug,预计统一修复。