Skip to content

Add Codex Computer Use setup for Codex mode - #71842

Merged
pash-openai merged 11 commits into
mainfrom
codex/computer-use-app-server
Apr 26, 2026
Merged

pash-openai merged 11 commits into
mainfrom
codex/computer-use-app-server

Conversation

@pash-openai

@pash-openai pash-openai commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

This adds a Computer Use setup path to the bundled Codex plugin. OpenClaw can now ask Codex app-server to enable plugin support, discover the Codex marketplaces app-server already knows about, install the configured computer-use plugin when requested, reload MCP servers, and verify that the computer-use MCP server is ready before a Codex-mode turn starts.

It also adds /codex computer-use status and /codex computer-use install, configuration fields under plugins.entries.codex.config.computerUse, and docs for the default app-server marketplace flow plus the explicit marketplaceSource, marketplacePath, and marketplaceName overrides.

The first-time path is intentionally owned by Codex app-server rather than by OpenClaw. With no marketplace override, OpenClaw calls plugin/list, waits for app-server's marketplace startup sync for up to marketplaceDiscoveryTimeoutMs during install, chooses the known Computer Use marketplace when there are multiple matches, then installs through app-server. Turn-start auto-install only uses marketplaces app-server has already discovered; installing from a configured source or local path requires the explicit /codex computer-use install command. If app-server cannot surface a Computer Use marketplace, OpenClaw reports that directly instead of inventing or vendoring a registry path.

The boundary stays narrow: OpenClaw does not vendor or implement desktop control. Codex owns the native MCP plugin and tool calls; OpenClaw only configures and checks the app-server side.

I proved this with a live smoke against OpenClaw running this branch: the Codex harness was forced, fallback was disabled, and the Codex app-server command was left unmanaged so OpenClaw had to use its managed @openai/codex runtime dependency. The agent then operated macOS Calculator through Computer Use and completed with agentHarnessId: "codex", fallbackUsed: false, a Computer Use tool summary containing computer-use.get_app_state and computer-use.click, and the final result 42. That gives me confidence this is wired through OpenClaw -> Codex app-server -> Computer Use MCP, rather than a mocked path or a fallback runner.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: L maintainer Maintainer-authored PR labels Apr 26, 2026
@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch from c93b9ea to 6fac760 Compare April 26, 2026 01:11
@pash-openai
pash-openai marked this pull request as ready for review April 26, 2026 01:13
@aisle-research-bot

aisle-research-bot Bot commented Apr 26, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 3 potential security issue(s) in this PR:

# Severity Title
1 🟠 High Automatic marketplace plugin installation (potential untrusted code execution) triggered by configuration at attempt startup
2 🟡 Medium Environment variables can implicitly enable Computer Use and trigger plugin enablement/installation at startup
3 🟡 Medium Policy bypass: /codex computer-use status can force-enable Computer Use when overrides are provided
1. 🟠 Automatic marketplace plugin installation (potential untrusted code execution) triggered by configuration at attempt startup
Property Value
Severity High
CWE CWE-285
Location extensions/codex/src/app-server/computer-use.ts:99-193

Description

runCodexAppServerAttempt now calls ensureCodexComputerUse() during startup, before the Codex thread begins. If computerUse.autoInstall is enabled (via plugins.entries.codex.config.computerUse or OPENCLAW_CODEX_COMPUTER_USE_AUTO_INSTALL), the code:

  • Enables Codex app-server plugins (experimentalFeature/enablement/set)
  • Selects a marketplace containing the configured pluginName (default computer-use; overridable)
  • Installs the plugin via plugin/install

Because the decision is driven by configuration/env inputs and happens automatically at attempt start, a configuration that is influenced by an untrusted source (e.g., a checked-in project config used to run OpenClaw) can cause installation of a marketplace plugin without an explicit user/guardian confirmation step. Marketplace selection also includes a local marketplace preference, which can increase supply-chain risk if a local marketplace can be introduced/poisoned on the host.

Vulnerable flow (auto-install + plugin install):

​// run-attempt.ts
await ensureCodexComputerUse({ client: startupClient, pluginConfig: options.pluginConfig, ... });

​// computer-use.ts
if (config.autoInstall) {
  const installedStatus = await inspectCodexComputerUse({ installPlugin: true, ... });
}
...
await request("experimentalFeature/enablement/set", { enablement: { plugins: true } });
...
await request("plugin/install", pluginRequestParams(marketplace, params.config.pluginName));

If a malicious or compromised marketplace entry can satisfy the pluginName lookup, this can lead to execution of untrusted plugin code in the Codex app-server context (and subsequent access to desktop/MCP capabilities), i.e., supply-chain RCE/privilege escalation.

Recommendation

Require an explicit authorization/confirmation gate before enabling plugins and performing plugin/install when the trigger comes from configuration/environment (especially at attempt startup).

Concrete options:

  1. Disable auto-install by default at turn start and only allow installs via an explicit command that is already user-initiated (/codex computer-use install).
  2. If auto-install must exist, restrict installation sources:
    • allow only vetted marketplace names (e.g., openai-bundled, openai-curated) and refuse local unless explicitly approved
    • optionally pin plugin publisher/signature/hash
  3. When running in a guarded mode (or any non-interactive environment), require an approval policy check before:
    • experimentalFeature/enablement/set enabling plugins
    • plugin/install

Example (fail closed unless explicitly opted-in to install from non-curated sources):

const allowed = new Set(["openai-bundled", "openai-curated"]);
if (config.autoInstall && marketplace.name && !allowed.has(marketplace.name)) {
  throw new CodexComputerUseSetupError(
    unavailableStatus(config, "Auto-install is only allowed from curated marketplaces.")
  );
}

Also consider treating pluginName overrides as unsafe for auto-install (only allow the default computer-use unless the user explicitly runs the install command).

2. 🟡 Environment variables can implicitly enable Computer Use and trigger plugin enablement/installation at startup
Property Value
Severity Medium
CWE CWE-15
Location extensions/codex/src/app-server/config.ts:251-266

Description

resolveCodexComputerUseConfig() treats process environment variables as configuration sources for the Computer Use feature and implicitly enables the feature when certain marketplace-related fields are present. runCodexAppServerAttempt() calls ensureCodexComputerUse() early in startup, so an attacker who can influence the OpenClaw/Codex process environment (e.g., CI variables, wrapper scripts, multi-tenant runners, or service managers that allow user-supplied env) can:

  • Force Computer Use to be enabled (or cause startup failure/DoS) via OPENCLAW_CODEX_COMPUTER_USE or by setting any of the marketplace-related variables
  • Potentially force automatic plugin installation and experimental plugin enablement by setting OPENCLAW_CODEX_COMPUTER_USE_AUTO_INSTALL (and relying on already-discovered marketplaces that contain the default computer-use plugin)

This expands the attack surface at runtime start and makes a security-sensitive capability controllable via ambient environment state rather than explicit, reviewed configuration.

Vulnerable behavior:

const autoInstall = ... readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_AUTO_INSTALL) ?? false;

const enabled = ... readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE) ??
  Boolean(autoInstall || marketplaceSource || marketplacePath || marketplaceName);

And at startup:

await ensureCodexComputerUse({ client: startupClient, pluginConfig: options.pluginConfig, ... });

Recommendation

Treat Computer Use enablement and installation as explicit opt-in rather than implicitly derived from environment state.

Suggested mitigations (choose according to product needs):

  1. Do not auto-enable based on marketplace fields from env; require computerUse.enabled: true in config:
const enabled =
  params.overrides?.enabled ??
  config.enabled ??
  readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE) ??
  false;
  1. If env overrides must exist for local testing, gate them behind an explicit dev-mode flag (or ignore env in production builds).

  2. Consider requiring a separate explicit confirmation flag before autoInstall can be read from env (or disable env-driven autoInstall entirely), since it can lead to experimentalFeature/enablement/set and plugin/install calls.

3. 🟡 Policy bypass: `/codex computer-use status` can force-enable Computer Use when overrides are provided
Property Value
Severity Medium
CWE CWE-284
Location extensions/codex/src/command-handlers.ts:242-246

Description

/codex computer-use status is expected to be a read-only check and (when disabled) should not start or contact Codex app-server.

However, handleComputerUseCommand sets forceEnable to true whenever any overrides are provided, even for the status action. forceEnable is later used to force enabled: true inside resolveComputerUseConfig, which causes readCodexComputerUseStatus() to proceed with app-server requests (e.g., plugin/list, plugin/read, mcpServerStatus/list) even if the feature is disabled in config/env.

Impact:

  • A caller can bypass higher-level gating/disablement by running status with an override (e.g. --marketplace-path, --plugin, etc.).
  • This may unexpectedly start/connect to app-server and perform network/side-effecting operations in environments that assumed Computer Use was disabled.

Vulnerable code:

forceEnable: parsed.action === "install" || parsed.hasOverrides,

Recommendation

Do not implicitly force-enable Computer Use for status just because overrides are present.

Options:

  1. Only forceEnable on install:
const params: CodexComputerUseSetupParams = {
  pluginConfig,
  forceEnable: parsed.action === "install",
  ...(Object.keys(parsed.overrides).length > 0 ? { overrides: parsed.overrides } : {}),
};
  1. If overrides are needed for status, add an explicit opt-in flag (e.g. --enable) and require it to set forceEnable: true.

Also consider ensuring readCodexComputerUseStatus() returns a disabled status without starting/connecting to app-server unless the feature is explicitly enabled in config/env or via an explicit user opt-in flag.


Analyzed PR: #71842 at commit b043ec0

Last updated on: 2026-04-26T03:48:35Z

@greptile-apps

greptile-apps Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Computer Use setup path to the bundled Codex plugin, including ensureCodexComputerUse called on every Codex-mode run attempt, /codex computer-use status|install commands, new computerUse config fields with environment-variable fallbacks, and a full test suite covering install, status, and fail-closed paths. The implementation is well-structured and the narrow ownership boundary (OpenClaw configures/checks; Codex owns the native tool calls) is clearly maintained.

Confidence Score: 4/5

Safe to merge; all findings are non-blocking P2 quality concerns with no functional regressions.

No P0 or P1 defects found. The only notable concern is that inspectCodexComputerUse fires write operations on every Codex turn rather than once per session, but this is a performance/design issue rather than a correctness bug. Remaining findings are test naming and CLI UX improvements.

extensions/codex/src/app-server/computer-use.ts — the per-turn write-operation pattern in inspectCodexComputerUse

Comments Outside Diff (1)

  1. extensions/codex/src/app-server/computer-use.ts, line 481-485 (link)

    P2 Write operations on every Codex turn

    inspectCodexComputerUse unconditionally calls experimentalFeature/enablement/set and — when marketplaceSource is configured — marketplace/add before any plugin or server checks. Because ensureCodexComputerUse is called from run-attempt.ts on every Codex-mode turn, these mutations fire per-turn even when the plugin is already installed and the MCP server is healthy.

    Consider caching the "enabled + ready" result per-session (e.g. once per runCodexAppServerAttempt) so the full setup probe only executes on the first turn or when explicitly triggered via /codex computer-use status.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: extensions/codex/src/app-server/computer-use.ts
    Line: 481-485
    
    Comment:
    **Write operations on every Codex turn**
    
    `inspectCodexComputerUse` unconditionally calls `experimentalFeature/enablement/set` and — when `marketplaceSource` is configured — `marketplace/add` before any plugin or server checks. Because `ensureCodexComputerUse` is called from `run-attempt.ts` on every Codex-mode turn, these mutations fire per-turn even when the plugin is already installed and the MCP server is healthy.
    
    Consider caching the "enabled + ready" result per-session (e.g. once per `runCodexAppServerAttempt`) so the full setup probe only executes on the first turn or when explicitly triggered via `/codex computer-use status`.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/codex/src/app-server/computer-use.ts
Line: 481-485

Comment:
**Write operations on every Codex turn**

`inspectCodexComputerUse` unconditionally calls `experimentalFeature/enablement/set` and — when `marketplaceSource` is configured — `marketplace/add` before any plugin or server checks. Because `ensureCodexComputerUse` is called from `run-attempt.ts` on every Codex-mode turn, these mutations fire per-turn even when the plugin is already installed and the MCP server is healthy.

Consider caching the "enabled + ready" result per-session (e.g. once per `runCodexAppServerAttempt`) so the full setup probe only executes on the first turn or when explicitly triggered via `/codex computer-use status`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/codex/src/command-handlers.ts
Line: 569-572

Comment:
**Missing value silently dropped for flag arguments**

When a flag like `--source` or `--marketplace-path` appears as the last argument, `args[index + 1]` is `undefined`. `normalizeComputerUseStringOverrides` then silently discards it, so the user gets no feedback that their argument was ignored. A simple bounds check and early help return would make the CLI experience clearer:

```typescript
if (arg === "--source" || arg === "--marketplace-source") {
  if (index + 1 >= args.length) { parsed.help = true; continue; }
  parsed.overrides.marketplaceSource = args[index + 1];
  index += 1;
  continue;
}
```

The same pattern applies to `--marketplace-path`, `--marketplace`, `--plugin`, and `--server`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/codex/src/app-server/config.test.ts
Line: 132-165

Comment:
**Misleading test fixture name**

The first case sets `OPENCLAW_CODEX_COMPUTER_USE_PLUGIN_NAME: "ignored-plugin"` in the env and then asserts `pluginName: "ignored-plugin"`. The value name "ignored-plugin" implies this env var should be ignored, but it's actually the active fallback because no `pluginName` is present in the `pluginConfig`. Renaming it to something like `"env-fallback-plugin"` or `"env-plugin-name"` would better match the intent of testing the environment-fallback resolution path.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "Add Codex Computer Use setup" | Re-trigger Greptile

@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch from 728ba3b to 603a00b Compare April 26, 2026 01:55
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling labels Apr 26, 2026
@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch 2 times, most recently from 95cbacf to 29079db Compare April 26, 2026 02:15
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling and removed agents Agent runtime and tooling labels Apr 26, 2026
@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch from 8108784 to f9e0742 Compare April 26, 2026 02:33
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Apr 26, 2026
@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch 4 times, most recently from c560645 to bf99f86 Compare April 26, 2026 03:28
@pash-openai
pash-openai force-pushed the codex/computer-use-app-server branch from 40a4dac to b043ec0 Compare April 26, 2026 03:43
@pash-openai
pash-openai merged commit 67ffa3d into main Apr 26, 2026
67 checks passed
@pash-openai
pash-openai deleted the codex/computer-use-app-server branch April 26, 2026 20:21
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* Add Codex Computer Use setup

* Tighten Codex Computer Use setup checks

* Handle fresh Codex Computer Use marketplace setup

* Fix channel setup manifest fixture

* Match Codex Computer Use marketplace loading

* Harden plugin manifest test fixtures

* Isolate auth choice legacy manifest test

* Update aggregate shard test expectation

* Improve Codex Computer Use first-run setup

* Harden Codex Computer Use auto-install

* Fix plugin auto-enable test fixture roots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant