Skip to content

Load Codex for selectable OpenAI agent models#81591

Merged
vincentkoc merged 1 commit into
mainfrom
codex/codex-harness-selectable-openai
May 14, 2026
Merged

Load Codex for selectable OpenAI agent models#81591
vincentkoc merged 1 commit into
mainfrom
codex/codex-harness-selectable-openai

Conversation

@pashpashpash

@pashpashpash pashpashpash commented May 14, 2026

Copy link
Copy Markdown
Contributor

The Codex startup migration already knew that selected OpenAI agent models should run through the Codex harness. The gap was that startup, plugin auto-enable, and doctor repair only looked at the primary/fallback model slots when inferring runtime requirements.

That missed existing configs where Anthropic stayed primary while agents.defaults.models or a per-agent models map made openai/gpt-5.5 selectable. Those configs could enable the OpenAI provider but never load or repair the Codex harness, so /model openai/gpt-5.5 later resolved to a Codex policy with no registered harness.

This change moves selectable agent model-map keys through the same harness policy used for real turns. Official openai/* selectable agent models now require the Codex plugin, while explicit agentRuntime.id: "pi" and custom OpenAI-compatible base URLs still opt out. The shared helper feeds auto-enable, startup planning, and doctor install repair, so the update path and runtime path agree.

I also included a one-line lint cleanup in an untouched live test because the current core lint gate on origin/main was failing on that pre-existing redundant return type before this PR could pass pnpm check:changed.

Real behavior proof

Behavior addressed: Existing configs with an Anthropic primary model and a selectable agents.defaults.models["openai/gpt-5.5"] entry should still load and repair the Codex harness before a user switches to that OpenAI model.

Real environment tested: Local OpenClaw source checkout in a fresh git worktree, using the real bundled plugin manifest registry, installed plugin index builder, plugin auto-enable code, harness runtime collector, and gateway startup planner.

Exact steps or command run after this patch: pnpm exec tsx -e imported collectConfiguredAgentHarnessRuntimes, applyPluginAutoEnable, loadPluginManifestRegistry, loadInstalledPluginIndex, and resolveGatewayStartupPluginPlanFromRegistry, then evaluated an Anthropic-primary config with agents.defaults.models["openai/gpt-5.5"] = {}.

Evidence after fix: The command printed "configuredRuntimes": ["codex"], "codexEnabled": true, auto-enable changes including "openai/gpt-5.5 model configured, enabled automatically." and "codex agent runtime configured, enabled automatically.", and startupPluginIds containing "codex".

Observed result after fix: The local proof shows the same config shape now reaches Codex runtime discovery, plugin auto-enable, and startup planning. Targeted runtime discovery, plugin auto-enable, startup planning, and doctor repair tests also passed, as did targeted oxfmt, git diff --check, and pnpm check:changed.

What was not tested: I did not restart Vincent’s exact gateway or use his private config; the local proof exercises the same startup/doctor discovery path with a redacted minimal config shape.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels May 14, 2026
@clawsweeper

clawsweeper Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR extends Codex harness-runtime discovery to selectable agent model-map entries, adds regression coverage for auto-enable/startup/doctor repair, updates the changelog, and makes one lint-only live-test type cleanup.

Reproducibility: yes. On current main, an Anthropic-primary config with agents.defaults.models["openai/gpt-5.5"] = {} is source-reproducible as missing Codex because the collector scans selected primary/fallback refs and explicit runtime entries, but not selectable model-map keys without agentRuntime.

Real behavior proof
Sufficient (live_output): The PR body provides labeled after-fix real behavior proof from a local source checkout with copied live output showing Codex runtime discovery, auto-enable, and startup planning for the affected config shape.

Next step before merge
No repair lane is needed; this is an active protected-label bug-fix PR with no blocking findings found in review.

Security
Cleared: The diff changes TypeScript config/runtime discovery logic, tests, and changelog text without adding dependencies, scripts, workflow permissions, secret handling, or new code-execution supply-chain paths.

Review details

Best possible solution:

Land the centralized collector/test change after normal maintainer and CI validation, keeping Codex runtime inference aligned across auto-enable, startup planning, and doctor repair.

Do we have a high-confidence way to reproduce the issue?

Yes. On current main, an Anthropic-primary config with agents.defaults.models["openai/gpt-5.5"] = {} is source-reproducible as missing Codex because the collector scans selected primary/fallback refs and explicit runtime entries, but not selectable model-map keys without agentRuntime.

Is this the best way to solve the issue?

Yes. Routing selectable model-map keys through resolveAgentHarnessPolicy in the shared collector is the narrow maintainable fix because auto-enable, startup planning, and doctor repair already depend on that collector.

What I checked:

  • Current-main gap: On current main, collectConfiguredAgentHarnessRuntimes scans agents.defaults.model and each agent's selected model, but it does not inspect selectable agents.defaults.models or per-agent models keys unless those entries already contain an explicit agentRuntime. (src/agents/harness-runtimes.ts:155, a504cd0190b9)
  • Codex runtime contract: The shared harness policy already treats official openai/* and openai-codex/* selections as Codex runtime unless a non-auto runtime such as Pi is configured or OpenAI uses a custom base URL. (src/agents/harness/policy.ts:38, a504cd0190b9)
  • Affected flows share the collector: Plugin auto-enable consumes collectConfiguredAgentHarnessRuntimes when adding agent-harness-runtime-configured candidates, so the current gap can skip Codex auto-enable for selectable OpenAI entries. (src/config/plugin-auto-enable.shared.ts:644, a504cd0190b9)
  • Startup planning shares the collector: Gateway startup planning also derives requiredAgentHarnessRuntimes from collectConfiguredAgentHarnessRuntimes, so fixing the central collector is the right surface for startup plugin loading. (src/plugins/gateway-startup-plugin-ids.ts:687, a504cd0190b9)
  • PR diff coverage: The patch adds model-map-key scanning through resolveAgentHarnessPolicy and covers default selectable OpenAI, per-agent selectable OpenAI, explicit Pi opt-out, custom OpenAI-compatible base URL opt-out, plugin auto-enable, startup planning, and doctor repair collection. (src/agents/harness-runtimes.ts:60, 94a4e723e343)
  • History provenance: Current blame and log place the central harness runtime collector, harness policy, auto-enable hook, startup hook, and doctor repair hook in commit 2d3f3de23549d94d62f453ecde494a6515e7ba0a, making that the main current-main ownership trail for this review. (src/agents/harness-runtimes.ts:131, 2d3f3de23549)

Likely related people:

  • Ayaan Zaidi: Blame and log show this person introduced the current harness runtime collector, harness policy, plugin auto-enable hook, startup planner hook, and doctor repair hooks used by this PR's affected path. (role: recent area contributor; confidence: high; commits: 2d3f3de23549; files: src/agents/harness-runtimes.ts, src/agents/harness/policy.ts, src/config/plugin-auto-enable.shared.ts)
  • duqaXxX: Git history for the same Codex harness activation surfaces includes a prior fix titled fix(codex): activate harness plugin for forced runtime, which is closely related to this PR's plugin-loading behavior. (role: adjacent Codex harness activation contributor; confidence: medium; commits: 69ba924b530e; files: src/agents/harness-runtimes.ts, src/config/plugin-auto-enable.shared.ts, src/plugins/gateway-startup-plugin-ids.ts)
  • pashpashpash: Beyond authoring this PR, local history shows a recent merged Codex app-server fix from this contributor in adjacent Codex/agent surfaces, so they are a plausible follow-up owner for this patch context. (role: adjacent Codex contributor; confidence: medium; commits: 74860e93fd6e; files: src/agents, extensions/codex, docs/plugins/codex-harness.md)

Remaining risk / open question:

  • Targeted tests were not executed during this read-only review; the verdict relies on source inspection, the PR diff, and the submitted local behavior proof.

Codex review notes: model gpt-5.5, reasoning high; reviewed against a504cd0190b9.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 14, 2026
@vincentkoc vincentkoc self-assigned this May 14, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Landing this one as the canonical fix.

Verification checked before merge:

  • gh pr checks 81591 --repo openclaw/openclaw --watch=false
  • git diff --check origin/main...refs/remotes/pr/81591

Relevant result: CI/check suites are green; Real behavior proof is the only failing check, and this PR already carries proof: sufficient after the ClawSweeper review. Treating that as non-blocking for maintainer landing.

Backport plan: after merge, cherry-pick the resulting squash commit to release/2026.5.12.

@vincentkoc
vincentkoc merged commit 3ce9224 into main May 14, 2026
126 of 133 checks passed
@vincentkoc
vincentkoc deleted the codex/codex-harness-selectable-openai branch May 14, 2026 01:51
vincentkoc pushed a commit that referenced this pull request May 14, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.

PR: #81591

(cherry picked from commit 3ce9224)
@vincentkoc

Copy link
Copy Markdown
Member

Backport complete.

  • Main landing commit: 3ce9224
  • Release branch: release/2026.5.12
  • Backport commit: d1b5b24

Verification for the backport:

  • git diff --check origin/release/2026.5.12...HEAD
  • pnpm check:changed --base 89f641a005a19888ae083b3e88ba84c19a225fb4 --head HEAD on Blacksmith Testbox tbx_01krj39aqky52hrrc0ymdvrkh7

Note: the first Testbox attempt used the default origin/main base and failed before checks because this release branch checkout had no merge base with origin/main; rerunning with the release branch tip as --base passed.

nighting0615 pushed a commit to nighting0615/openclaw that referenced this pull request May 19, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.

PR: openclaw#81591

(cherry picked from commit 3ce9224)
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.\n\nPR: openclaw/openclaw#81591
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.\n\nPR: openclaw/openclaw#81591
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.\n\nPR: openclaw#81591
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.\n\nPR: openclaw#81591
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Treat selectable configured OpenAI agent models as Codex runtime requirements during plugin auto-enable, startup planning, and doctor install repair.\n\nPR: openclaw#81591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations maintainer Maintainer-authored PR proof: sufficient ClawSweeper judged the real behavior proof convincing. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants