@@ -255,6 +255,106 @@ fallback catalog:
255255}
256256```
257257
258+ ## App-server connection and policy
259+
260+ By default, the plugin starts Codex locally with:
261+
262+ ``` bash
263+ codex app-server --listen stdio://
264+ ```
265+
266+ You can keep that default and only tune Codex native policy:
267+
268+ ``` json5
269+ {
270+ plugins: {
271+ entries: {
272+ codex: {
273+ enabled: true ,
274+ config: {
275+ appServer: {
276+ approvalPolicy: " on-request" ,
277+ sandbox: " workspace-write" ,
278+ serviceTier: " priority" ,
279+ },
280+ },
281+ },
282+ },
283+ },
284+ }
285+ ```
286+
287+ For an already-running app-server, use WebSocket transport:
288+
289+ ``` json5
290+ {
291+ plugins: {
292+ entries: {
293+ codex: {
294+ enabled: true ,
295+ config: {
296+ appServer: {
297+ transport: " websocket" ,
298+ url: " ws://127.0.0.1:39175" ,
299+ authToken: " ${CODEX_APP_SERVER_TOKEN}" ,
300+ requestTimeoutMs: 60000 ,
301+ },
302+ },
303+ },
304+ },
305+ },
306+ }
307+ ```
308+
309+ Supported ` appServer ` fields:
310+
311+ | Field | Default | Meaning |
312+ | ------------------- | ---------------------------------------- | ------------------------------------------------------------------------ |
313+ | ` transport ` | ` "stdio" ` | ` "stdio" ` spawns Codex; ` "websocket" ` connects to ` url ` . |
314+ | ` command ` | ` "codex" ` | Executable for stdio transport. |
315+ | ` args ` | ` ["app-server", "--listen", "stdio://"] ` | Arguments for stdio transport. |
316+ | ` url ` | unset | WebSocket app-server URL. |
317+ | ` authToken ` | unset | Bearer token for WebSocket transport. |
318+ | ` headers ` | ` {} ` | Extra WebSocket headers. |
319+ | ` requestTimeoutMs ` | ` 60000 ` | Timeout for app-server control-plane calls. |
320+ | ` approvalPolicy ` | ` "never" ` | Native Codex approval policy sent to thread start/resume/turn. |
321+ | ` sandbox ` | ` "workspace-write" ` | Native Codex sandbox mode sent to thread start/resume. |
322+ | ` approvalsReviewer ` | ` "user" ` | Use ` "guardian_subagent" ` to let Codex guardian review native approvals. |
323+ | ` serviceTier ` | unset | Optional Codex service tier, for example ` "priority" ` . |
324+
325+ The older environment variables still work as fallbacks for local testing when
326+ the matching config field is unset:
327+
328+ - ` OPENCLAW_CODEX_APP_SERVER_BIN `
329+ - ` OPENCLAW_CODEX_APP_SERVER_ARGS `
330+ - ` OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY `
331+ - ` OPENCLAW_CODEX_APP_SERVER_SANDBOX `
332+ - ` OPENCLAW_CODEX_APP_SERVER_GUARDIAN=1 `
333+
334+ Config is preferred for repeatable deployments.
335+
336+ ## Codex command
337+
338+ The bundled plugin registers ` /codex ` as an authorized slash command. It is
339+ generic and works on any channel that supports OpenClaw text commands.
340+
341+ Common forms:
342+
343+ - ` /codex status ` shows live app-server connectivity, models, account, rate limits, MCP servers, and skills.
344+ - ` /codex models ` lists live Codex app-server models.
345+ - ` /codex threads [filter] ` lists recent Codex threads.
346+ - ` /codex resume <thread-id> ` attaches the current OpenClaw session to an existing Codex thread.
347+ - ` /codex compact ` asks Codex app-server to compact the attached thread.
348+ - ` /codex review ` starts Codex native review for the attached thread.
349+ - ` /codex account ` shows account and rate-limit status.
350+ - ` /codex mcp ` lists Codex app-server MCP server status.
351+ - ` /codex skills ` lists Codex app-server skills.
352+
353+ ` /codex resume ` writes the same sidecar binding file that the harness uses for
354+ normal turns. On the next message, OpenClaw resumes that Codex thread, passes the
355+ currently selected OpenClaw ` codex/* ` model into app-server, and keeps extended
356+ history enabled.
357+
258358## Tools, media, and compaction
259359
260360The Codex harness changes the low-level embedded agent executor only.
@@ -286,6 +386,9 @@ reports version `0.118.0` or newer.
286386** Model discovery is slow:** lower ` plugins.entries.codex.config.discovery.timeoutMs `
287387or disable discovery.
288388
389+ ** WebSocket transport fails immediately:** check ` appServer.url ` , ` authToken ` ,
390+ and that the remote app-server speaks the same Codex app-server protocol version.
391+
289392** A non-Codex model uses PI:** that is expected. The Codex harness only claims
290393` codex/* ` model refs.
291394
0 commit comments