Skip to content

Commit b79de62

Browse files
authored
fix(codex): remove dynamic tools profile option
1 parent 9f028e9 commit b79de62

18 files changed

Lines changed: 290 additions & 60 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Docs: https://docs.openclaw.ai
1313
- Dependencies: refresh workspace pins and patch targets, including ACPX `@agentclientprotocol/claude-agent-acp` `0.33.1`, Codex ACP `0.14.0`, Baileys `7.0.0-rc10`, Google GenAI `2.0.1`, OpenAI `6.37.0`, AWS SDK `3.1045.0`, Kysely `0.29.0`, Tlon skill `0.3.6`, Aimock `1.19.5`, and tsdown `0.22.0`.
1414
- Agents/compaction: preserve scoped background exec/process session references across embedded compaction and after-turn runtime contexts without exposing sessions from unrelated scopes. Fixes #79284. (#79307) Thanks @TurboTheTurtle.
1515
- CLI/onboarding: improve setup, onboarding, configure, and channel command wayfinding so terminal flows explain the next useful command instead of relying on terse setup labels.
16+
- Agents/Codex: remove the configurable Codex dynamic-tools profile so Codex app-server always owns workspace, edit, patch, exec, process, and plan tools while OpenClaw integration tools remain available.
1617

1718
### Fixes
1819

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
31ba805dfaa665fe16735d7c2f3a5e9fb0c349aeb5e301881b5da65cee62b1f8 config-baseline.json
1+
f10281b32feb151b97952fda0722bae46c66456783e82ccaa7f39f11306287fa config-baseline.json
22
5552e7871057e05d5699f90f536ce58e62d5b8cfc6020d3e7106be7915fed041 config-baseline.core.json
33
80f0f51caedf14dc2138d975b62852ff7c5cf085df1c734c9de279f5859a7eeb config-baseline.channel.json
4-
3a08e5422ce1422d9e2b75feac7e44cdcd0c3dc1eea594f664bceec13cbe3f58 config-baseline.plugin.json
4+
dba159f639977bb96d79f0b78de2c6de48d25ed6ba1590f55812affb7ca6e4b0 config-baseline.plugin.json

‎docs/cli/doctor.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Notes:
6767
- Doctor includes a memory-search readiness check and can recommend `openclaw configure --section model` when embedding credentials are missing.
6868
- Doctor warns when no command owner is configured. The command owner is the human operator account allowed to run owner-only commands and approve dangerous actions. DM pairing only lets someone talk to the bot; if you approved a sender before first-owner bootstrap existed, set `commands.ownerAllowFrom` explicitly.
6969
- Doctor warns when Codex-mode agents are configured and personal Codex CLI assets exist in the operator's Codex home. Local Codex app-server launches use isolated per-agent homes, so use `openclaw migrate codex --dry-run` to inventory assets that should be promoted deliberately.
70+
- Doctor removes retired `plugins.entries.codex.config.codexDynamicToolsProfile`; Codex app-server always keeps Codex-native workspace tools native.
7071
- Doctor warns when skills allowed for the default agent are unavailable in the current runtime environment because bins, env vars, config, or OS requirements are missing. `doctor --fix` can disable those unavailable skills with `skills.entries.<skill>.enabled=false`; install/configure the missing requirement instead when you want to keep the skill active.
7172
- If sandbox mode is enabled but Docker is unavailable, doctor reports a high-signal warning with remediation (`install Docker` or `openclaw config set agents.defaults.sandbox.mode off`).
7273
- If legacy sandbox registry files (`~/.openclaw/sandbox/containers.json` or `~/.openclaw/sandbox/browsers.json`) are present, doctor reports them; `openclaw doctor --fix` migrates valid entries into sharded registry directories and quarantines invalid legacy files.

‎docs/gateway/doctor.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ That stages grounded durable candidates into the short-term dreaming store while
223223
- `browser.profiles.*.driver: "extension"` → `"existing-session"`
224224
- remove `browser.relayBindHost` (legacy extension relay setting)
225225
- legacy `models.providers.*.api: "openai"` → `"openai-completions"` (gateway startup also skips providers whose `api` is set to a future or unknown enum value rather than failing closed)
226+
- remove `plugins.entries.codex.config.codexDynamicToolsProfile`; Codex app-server always keeps Codex-native workspace tools native
226227

227228
Doctor warnings also include account-default guidance for multi-account channels:
228229

‎docs/plugins/codex-harness-reference.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Supported top-level fields:
4242
| -------------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
4343
| `discovery` | enabled | Model discovery settings for Codex app-server `model/list`. |
4444
| `appServer` | managed stdio app-server | Transport, command, auth, approval, sandbox, and timeout settings. |
45-
| `codexDynamicToolsProfile` | `"native-first"` | Use `"openclaw-compat"` to expose the full OpenClaw dynamic tool set to Codex app-server. |
4645
| `codexDynamicToolsLoading` | `"searchable"` | Use `"direct"` to put OpenClaw dynamic tools directly in the initial Codex tool context. |
4746
| `codexDynamicToolsExclude` | `[]` | Additional OpenClaw dynamic tool names to omit from Codex app-server turns. |
4847
| `codexPlugins` | disabled | Native Codex plugin/app support for migrated source-installed curated plugins. See [Native Codex plugins](/plugins/codex-native-plugins). |
@@ -211,9 +210,8 @@ isolation on local launches.
211210

212211
## Dynamic tools
213212

214-
Codex dynamic tools default to the `native-first` profile and `searchable`
215-
loading. In that mode, OpenClaw does not expose dynamic tools that duplicate
216-
Codex-native workspace operations:
213+
Codex dynamic tools default to `searchable` loading. OpenClaw does not expose
214+
dynamic tools that duplicate Codex-native workspace operations:
217215

218216
- `read`
219217
- `write`

‎docs/plugins/codex-harness.md‎

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,128 @@ Get the thread id from the completed `/diagnostics` reply, `/codex binding`, or
377377
For upload mechanics and runtime-level diagnostics boundaries, see
378378
[Codex harness runtime](/plugins/codex-harness-runtime#codex-feedback-upload).
379379

380+
Auth is selected in this order:
381+
382+
1. An explicit OpenClaw Codex auth profile for the agent.
383+
2. The app-server's existing account in that agent's Codex home.
384+
3. For local stdio app-server launches only, `CODEX_API_KEY`, then
385+
`OPENAI_API_KEY`, when no app-server account is present and OpenAI auth is
386+
still required.
387+
388+
When OpenClaw sees a ChatGPT subscription-style Codex auth profile, it removes
389+
`CODEX_API_KEY` and `OPENAI_API_KEY` from the spawned Codex child process. That
390+
keeps Gateway-level API keys available for embeddings or direct OpenAI models
391+
without making native Codex app-server turns bill through the API by accident.
392+
Explicit Codex API-key profiles and local stdio env-key fallback use app-server
393+
login instead of inherited child-process env. WebSocket app-server connections
394+
do not receive Gateway env API-key fallback; use an explicit auth profile or the
395+
remote app-server's own account.
396+
397+
If a deployment needs additional environment isolation, add those variables to
398+
`appServer.clearEnv`:
399+
400+
```json5
401+
{
402+
plugins: {
403+
entries: {
404+
codex: {
405+
enabled: true,
406+
config: {
407+
appServer: {
408+
clearEnv: ["CODEX_API_KEY", "OPENAI_API_KEY"],
409+
},
410+
},
411+
},
412+
},
413+
},
414+
}
415+
```
416+
417+
`appServer.clearEnv` only affects the spawned Codex app-server child process.
418+
419+
Codex dynamic tools default to `searchable` loading. OpenClaw does not expose
420+
dynamic tools that duplicate Codex-native workspace operations: `read`, `write`,
421+
`edit`, `apply_patch`, `exec`, `process`, and `update_plan`. Remaining OpenClaw
422+
integration tools such as messaging, sessions, media, cron, browser, nodes,
423+
gateway, `heartbeat_respond`, and `web_search` are available through Codex tool
424+
search under the `openclaw` namespace, keeping the initial model context
425+
smaller.
426+
`sessions_yield` and message-tool-only source replies stay direct because those
427+
are turn-control contracts. Heartbeat collaboration instructions tell Codex to
428+
search for `heartbeat_respond` before ending a heartbeat turn when the tool is
429+
not already loaded.
430+
431+
Set `codexDynamicToolsLoading: "direct"` only when connecting to a custom Codex
432+
app-server that cannot search deferred dynamic tools or when debugging the full
433+
tool payload.
434+
435+
Supported top-level Codex plugin fields:
436+
437+
| Field | Default | Meaning |
438+
| -------------------------- | -------------- | ---------------------------------------------------------------------------------------- |
439+
| `codexDynamicToolsLoading` | `"searchable"` | Use `"direct"` to put OpenClaw dynamic tools directly in the initial Codex tool context. |
440+
| `codexDynamicToolsExclude` | `[]` | Additional OpenClaw dynamic tool names to omit from Codex app-server turns. |
441+
| `codexPlugins` | disabled | Native Codex plugin/app support for migrated source-installed curated plugins. |
442+
443+
Supported `appServer` fields:
444+
445+
| Field | Default | Meaning |
446+
| ----------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
447+
| `transport` | `"stdio"` | `"stdio"` spawns Codex; `"websocket"` connects to `url`. |
448+
| `command` | managed Codex binary | Executable for stdio transport. Leave unset to use the managed binary; set it only for an explicit override. |
449+
| `args` | `["app-server", "--listen", "stdio://"]` | Arguments for stdio transport. |
450+
| `url` | unset | WebSocket app-server URL. |
451+
| `authToken` | unset | Bearer token for WebSocket transport. |
452+
| `headers` | `{}` | Extra WebSocket headers. |
453+
| `clearEnv` | `[]` | Extra environment variable names removed from the spawned stdio app-server process after OpenClaw builds its inherited environment. `CODEX_HOME` and `HOME` are reserved for OpenClaw's per-agent Codex isolation on local launches. |
454+
| `requestTimeoutMs` | `60000` | Timeout for app-server control-plane calls. |
455+
| `turnCompletionIdleTimeoutMs` | `60000` | Quiet window after a turn-scoped Codex app-server request while OpenClaw waits for `turn/completed`. Raise this for slow post-tool or status-only synthesis phases. |
456+
| `mode` | `"yolo"` unless local Codex requirements disallow YOLO | Preset for YOLO or guardian-reviewed execution. Local stdio requirements that omit `danger-full-access`, `never` approval, or the `user` reviewer make the implicit default guardian. |
457+
| `approvalPolicy` | `"never"` or an allowed guardian approval policy | Native Codex approval policy sent to thread start/resume/turn. Guardian defaults prefer `"on-request"` when allowed. |
458+
| `sandbox` | `"danger-full-access"` or an allowed guardian sandbox | Native Codex sandbox mode sent to thread start/resume. Guardian defaults prefer `"workspace-write"` when allowed, otherwise `"read-only"`. |
459+
| `approvalsReviewer` | `"user"` or an allowed guardian reviewer | Use `"auto_review"` to let Codex review native approval prompts when allowed, otherwise `guardian_subagent` or `user`. `guardian_subagent` remains a legacy alias. |
460+
| `serviceTier` | unset | Optional Codex app-server service tier. `"priority"` enables fast-mode routing, `"flex"` requests flex processing, `null` clears the override, and legacy `"fast"` is accepted as `"priority"`. |
461+
462+
OpenClaw-owned dynamic tool calls are bounded independently from
463+
`appServer.requestTimeoutMs`: Codex `item/tool/call` requests use a 30 second
464+
OpenClaw watchdog by default. A positive per-call `timeoutMs` argument extends
465+
or shortens that specific tool budget. The `image_generate` tool also uses
466+
`agents.defaults.imageGenerationModel.timeoutMs` when the tool call does not
467+
provide its own timeout, and the media-understanding `image` tool uses
468+
`tools.media.image.timeoutSeconds` or its 60 second media default. Dynamic tool
469+
budgets are capped at 600000 ms. On timeout, OpenClaw aborts the tool signal
470+
where supported and returns a failed dynamic-tool response to Codex so the turn
471+
can continue instead of leaving the session in `processing`.
472+
473+
After OpenClaw responds to a Codex turn-scoped app-server request, the harness
474+
also expects Codex to finish the native turn with `turn/completed`. If the
475+
app-server goes quiet for `appServer.turnCompletionIdleTimeoutMs` after that
476+
response, OpenClaw best-effort interrupts the Codex turn, records a diagnostic
477+
timeout, and releases the OpenClaw session lane so follow-up chat messages are
478+
not queued behind a stale native turn. Any non-terminal notification for the
479+
same turn, including `rawResponseItem/completed`, disarms that short watchdog
480+
because Codex has proven the turn is still alive; the longer terminal watchdog
481+
continues to protect genuinely stuck turns. Timeout diagnostics include the
482+
last app-server notification method and, for raw assistant response items, the
483+
item type, role, id, and a bounded assistant text preview.
484+
485+
Environment overrides remain available for local testing:
486+
487+
- `OPENCLAW_CODEX_APP_SERVER_BIN`
488+
- `OPENCLAW_CODEX_APP_SERVER_ARGS`
489+
- `OPENCLAW_CODEX_APP_SERVER_MODE=yolo|guardian`
490+
- `OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY`
491+
- `OPENCLAW_CODEX_APP_SERVER_SANDBOX`
492+
493+
`OPENCLAW_CODEX_APP_SERVER_BIN` bypasses the managed binary when
494+
`appServer.command` is unset.
495+
496+
`OPENCLAW_CODEX_APP_SERVER_GUARDIAN=1` was removed. Use
497+
`plugins.entries.codex.config.appServer.mode: "guardian"` instead, or
498+
`OPENCLAW_CODEX_APP_SERVER_MODE=guardian` for one-off local testing. Config is
499+
preferred for repeatable deployments because it keeps the plugin behavior in the
500+
same reviewed file as the rest of the Codex harness setup.
501+
380502
## Native Codex plugins
381503

382504
Native Codex plugin support uses Codex app-server's own app and plugin
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { describe, expect, it } from "vitest";
2+
import { legacyConfigRules, normalizeCompatibilityConfig } from "./doctor-contract-api.js";
3+
4+
describe("codex doctor contract", () => {
5+
it("reports the retired dynamic tools profile config key", () => {
6+
expect(
7+
legacyConfigRules[0]?.match({
8+
codexDynamicToolsProfile: "openclaw-compat",
9+
codexDynamicToolsLoading: "direct",
10+
}),
11+
).toBe(true);
12+
expect(legacyConfigRules[0]?.match({ codexDynamicToolsLoading: "direct" })).toBe(false);
13+
});
14+
15+
it("removes the retired dynamic tools profile without dropping other Codex config", () => {
16+
const original = {
17+
plugins: {
18+
entries: {
19+
codex: {
20+
enabled: true,
21+
config: {
22+
codexDynamicToolsProfile: "openclaw-compat",
23+
codexDynamicToolsLoading: "direct",
24+
codexDynamicToolsExclude: ["custom_tool"],
25+
appServer: { mode: "guardian" },
26+
},
27+
},
28+
},
29+
},
30+
};
31+
32+
const result = normalizeCompatibilityConfig({ cfg: original });
33+
34+
expect(result.changes).toEqual([
35+
"Removed retired plugins.entries.codex.config.codexDynamicToolsProfile; Codex app-server always keeps Codex-native workspace tools native.",
36+
]);
37+
expect(result.config.plugins?.entries?.codex?.config).toEqual({
38+
codexDynamicToolsLoading: "direct",
39+
codexDynamicToolsExclude: ["custom_tool"],
40+
appServer: { mode: "guardian" },
41+
});
42+
expect(original.plugins.entries.codex.config).toHaveProperty("codexDynamicToolsProfile");
43+
});
44+
});

0 commit comments

Comments
 (0)