openclaw - 💡(How to fix) Fix [Bug]: agentRuntime.id "codex" at agents.list[] is ignored by the model-prefix resolver — docs-recommended Codex harness setup fails [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77107Fetched 2026-05-05 05:52:04
View on GitHub
Comments
3
Participants
3
Timeline
6
Reactions
2
Author
Timeline (top)
commented ×3labeled ×2closed ×1

With the codex plugin installed and active, configuring an agent per the documented model: "openai/gpt-5.5" + agentRuntime: { id: "codex" } setup fails because the model resolver routes to the raw openai provider and ignores the agent's runtime override.

Error Message

FailoverError: No API key found for provider "openai". You are authenticated with OpenAI Codex OAuth. Use openai-codex/gpt-5.5, or set OPENAI_API_KEY for direct OpenAI API access.

Root Cause

With the codex plugin installed and active, configuring an agent per the documented model: "openai/gpt-5.5" + agentRuntime: { id: "codex" } setup fails because the model resolver routes to the raw openai provider and ignores the agent's runtime override.

Code Example

{ "id": "main", "model": "openai/gpt-5.5", "agentRuntime": { "id": "codex" } }

---

FailoverError: No API key found for provider "openai". You are authenticated
with OpenAI Codex OAuth. Use openai-codex/gpt-5.5, or set OPENAI_API_KEY for
direct OpenAI API access.

---

Trajectory record (runId=7c0c4066-6b50-45f1-94a7-8bcaf938c25e):
{
  "decision":            "candidate_failed",
  "requestedProvider":   "openai",
  "requestedModel":      "gpt-5.5",
  "candidateProvider":   "openai",
  "candidateModel":      "gpt-5.5",
  "reason":              "auth",
  "status":              401,
  "fallbackConfigured":  false,
  "fallbackStepFromModel":          "openai/gpt-5.5",
  "fallbackStepFromFailureReason":  "auth"
}

Plugin activation confirmed before the test:
http server listening (3 plugins: codex, discord, webhooks; 6.2s)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

With the codex plugin installed and active, configuring an agent per the documented model: "openai/gpt-5.5" + agentRuntime: { id: "codex" } setup fails because the model resolver routes to the raw openai provider and ignores the agent's runtime override.

Steps to reproduce

  1. Install and activate @openclaw/[email protected] (plugins.allow includes codex, plugins.entries.codex.enabled: true); confirm gateway log shows http server listening (3 plugins: codex, discord, webhooks; ...).
  2. Set the main agent in agents.list:
    { "id": "main", "model": "openai/gpt-5.5", "agentRuntime": { "id": "codex" } }
  3. Restart the gateway.
  4. Run openclaw agent --agent main --message "test".

Expected behavior

Per docs.openclaw.ai/plugins/codex-harness, this combination routes the model lookup through the Codex harness and uses the existing openai-codex OAuth profile for auth. The agent should reply.

Actual behavior

The resolver reports requestedProvider: "openai" and queries the raw OpenAI provider, which has no API key. The agentRuntime.id override is not consulted. Error:

FailoverError: No API key found for provider "openai". You are authenticated
with OpenAI Codex OAuth. Use openai-codex/gpt-5.5, or set OPENAI_API_KEY for
direct OpenAI API access.

OpenClaw version

2026.5.2 (8b2a6e5)

Operating system

macOS 26.2 (arm64)

Install method

pnpm (global)

Model

openai/gpt-5.5 (with agentRuntime.id codex)

Provider / routing chain

Intended: openclaw -> codex harness (intercepts openai/* via agentRuntime) -> openai-codex OAuth -> Codex app-server. Observed: openclaw -> openai provider lookup (agentRuntime override bypassed) -> fails on missing API key.

Additional provider/model setup details

Codex plugin manifest declares providers: ["codex"] and activation.onAgentHarnesses: ["codex"]. Existing openai-codex:default OAuth profile has valid accountId, access, and refresh fields. Plugin activation confirmed in gateway log before the test.

Logs, screenshots, and evidence

Trajectory record (runId=7c0c4066-6b50-45f1-94a7-8bcaf938c25e):
{
  "decision":            "candidate_failed",
  "requestedProvider":   "openai",
  "requestedModel":      "gpt-5.5",
  "candidateProvider":   "openai",
  "candidateModel":      "gpt-5.5",
  "reason":              "auth",
  "status":              401,
  "fallbackConfigured":  false,
  "fallbackStepFromModel":          "openai/gpt-5.5",
  "fallbackStepFromFailureReason":  "auth"
}

Plugin activation confirmed before the test:
http server listening (3 plugins: codex, discord, webhooks; 6.2s)

Impact and severity

Affected: any user attempting to enable the Codex harness following the official docs. Severity: High for the codex-harness use case — no working config to enable native Codex routing as documented. Frequency: 4/4 observed attempts (across config edits and gateway restarts). Consequence: The documented setup is unusable; the only routing path that does activate the codex provider is the deprecated codex/gpt-* form, which then hits a separate refresh bug (filed as a separate issue).

Additional information

Either the docs are aspirational and need correcting, or the resolver wiring is missing. If the latter, the fix likely belongs at the point where agents.list[].model is split into {provider, model} for resolver lookup — that path needs to also check the agent's agentRuntime.id and route to the harness when set. NOT_ENOUGH_INFO on which part of the dist is responsible (code is bundled)

extent analysis

TL;DR

The issue can be resolved by modifying the model resolver to consult the agent's agentRuntime.id and route to the Codex harness when set.

Guidance

  • Verify that the Codex plugin is correctly installed and activated by checking the gateway log for the plugin activation message.
  • Check the agents.list configuration to ensure that the agentRuntime.id is set to "codex" for the main agent.
  • Investigate the model resolver code to determine why it is not consulting the agentRuntime.id and routing to the Codex harness.
  • Consider modifying the model resolver to check the agentRuntime.id and route to the Codex harness when set to "codex".

Example

No code example is provided as the issue is related to the internal workings of the OpenClaw system and requires a deeper understanding of the codebase.

Notes

The issue seems to be related to the model resolver not correctly handling the agentRuntime.id override. The fix will likely involve modifying the model resolver code to consult the agentRuntime.id and route to the Codex harness when set.

Recommendation

Apply a workaround by modifying the model resolver code to check the agentRuntime.id and route to the Codex harness when set to "codex", as this is the most likely cause of the issue and will allow the documented setup to work as intended.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Per docs.openclaw.ai/plugins/codex-harness, this combination routes the model lookup through the Codex harness and uses the existing openai-codex OAuth profile for auth. The agent should reply.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: agentRuntime.id "codex" at agents.list[] is ignored by the model-prefix resolver — docs-recommended Codex harness setup fails [3 comments, 3 participants]