安装 OpenClaw Codex 插件
openclaw plugins install @openclaw/codex
在 ~/.openclaw/openclaw.json 的 plugins.entries.codex 中启用 supervision。共享 Desktop/CLI 任务时使用用户态 app-server:
{
"enabled": true,
"config": {
"supervision": {
"enabled": true,
"allowWriteControls": true,
"allowRawTranscripts": false
},
"appServer": {
"transport": "stdio",
"homeScope": "user"
}
}
}
写控制允许继续、转向、分叉、重命名和归档任务;原始 transcript 建议保持关闭,尤其是飞书群聊场景。
重启并验证
openclaw gateway restart openclaw plugins list | rg -i codex openclaw codex sessions --limit 10 --json
看到 codex 为 enabled 后,再在 OpenClaw 控制台当前会话输入:
/codex threads
常用命令的区别:
| 位置 | 命令 | 作用 |
|---|---|---|
| shell | openclaw codex sessions | 列出 Gateway 可见的原生会话 |
| 聊天 | /codex threads | 查看当前对话绑定的 app-server 线程 |
| 聊天 | /codex resume <thread-id> | 继续线程 |
| 聊天 | /codex bind <thread-id> | 将当前对话绑定到线程 |
飞书 /codex threads 没回复怎么办?
按顺序检查:
- openclaw gateway status 是否显示进程运行、端口可探测。
- openclaw plugins list 中 codex 是否 enabled。
- 飞书消息实际路由到哪个 agent;该 agent 是否启用了 supervision。
- 先在控制台会话执行 /codex threads。控制台成功、飞书失败,通常是渠道路由或 agent 策略问题。
- 查看 /tmp/openclaw/openclaw-YYYY-MM-DD.log,不要把 token、JWT 或完整 transcript 发到群里。
如果出现 connect EPERM 127.0.0.1:18789,问题在 Gateway 本地连通性,不是 CC Switch token。LaunchAgent 启动的 Gateway 也不一定继承你在终端执行的:
export all_proxy=http://127.0.0.1:7890
需要代理时,要单独配置 Gateway 服务环境或受控 app-server 网络代理。
最终检查清单
- CC Switch 渠道能让 Codex Desktop/CLI 正常启动任务。
- ~/.codex/config.toml 使用 Responses,token 未进入仓库。
- OpenClaw codex 插件 enabled,supervision.enabled=true。
- 共享 Desktop/CLI 任务时使用 appServer.homeScope=user。
- allowWriteControls 按需开启,allowRawTranscripts 默认关闭。
- Gateway 重启后 openclaw codex sessions 能返回结果。
- 先在控制台验证 /codex threads,再验证飞书。
本教程记录的是一套可审计的本地接入流程,不声称绕过 ChatGPT 登录或将私有凭据开放给第三方。