Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
Bug Report: OpenAI/Codex OAuth Profile Not Attached to Inference Requests
Environment
- OpenClaw Version: 2026.6.1 (2e08f0f)
- OS: Fedora Linux
- Installation Method: npm global install
- Auth Method: OpenAI OAuth (
openclaw models auth login --provider openai --set-default) - OpenAI Account Type: ChatGPT Prolite subscription
- Node:
/usr/bin/node
Summary
OpenClaw successfully completes OpenAI OAuth login and stores a valid auth profile, but model inference requests are sent without an Authorization header.
The runtime consistently reports:
profile=-
401 Unauthorized
Missing bearer or basic authentication in header
This occurs with both:
openai/gpt-5.5
codex/gpt-5.5
Relevant Logs
Gateway startup:
[gateway] agent model: codex/gpt-5.5 (thinking=medium, fast=off)
[gateway] http server listening (3 plugins: codex, openshell, policy)
Inference failure:
[agent/embedded] embedded run failover decision:
reason=auth
from=codex/gpt-5.5
profile=-
401 Unauthorized:
Missing bearer or basic authentication in header
url: https://api.openai.com/v1/responses
Repeated failures also occur with:
from=openai/gpt-5.5
profile=-
Auth State
auth-state.json:
{
"order": {
"openai": [
"openai:amoni094@gmail.com"
],
"codex": [
"openai:amoni094@gmail.com"
]
},
"lastGood": {
"openai": "openai:amoni094@gmail.com",
"codex": "openai:amoni094@gmail.com"
}
}auth-profiles.json contains a valid OAuth profile:
{
"profiles": {
"openai:amoni094@gmail.com": {
"type": "oauth",
"provider": "openai"
}
}
}OAuth login completes successfully and refresh tokens are stored.
Additional Investigation Performed
Verified:
- OAuth login succeeds
- Auth profile exists
- Auth profile order exists
- OpenClaw reads auth state
- Codex plugin installed and enabled
- Codex plugin reinstalled from scratch
- OpenClaw routing reset
- Fallbacks cleared
- New sessions created
- Doctor fixes applied
- Stale Codex session routing state removed
Issue persists.
Observed Conclusion
The selected OAuth profile appears to be ignored during inference.
The auth profile exists and is selected, but inference executes with:
profile=-
which results in requests being sent without an Authorization header.
This appears to be a bug in auth profile resolution or provider handoff during model execution.
Steps to reproduce
Reproduction Steps
- Install OpenClaw 2026.6.1
- Enable Codex plugin
- Login:
openclaw models auth login --provider openai --set-default- Set model:
openclaw models set codex/gpt-5.5or
openclaw models set openai/gpt-5.5- Start gateway:
systemctl --user restart openclaw-gateway- Test:
openclaw tui --session test --message "hello"Expected behavior
Expected Behavior
After successful OAuth login:
Auth profile: openai:amoni094@gmail.com (openai/oauth)
model requests should be executed using that profile.
Expected log:
profile=openai:amoni094@gmail.com
and inference should succeed.
Actual behavior
Actual Behavior
Inference always fails:
from=openai/gpt-5.5 profile=-
401 Unauthorized: Missing bearer or basic authentication in header
and similarly:
from=codex/gpt-5.5 profile=-
401 Unauthorized: Missing bearer or basic authentication in header
OpenClaw version
2026.6.1
Operating system
Fedora 44 Silverblue
Install method
No response
Model
gpt 5.5; codex; gpt 5.4 mini; qren3:8b
Provider / routing chain
N/A
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
Severity high - openclaw doesn't work - only workaround to use codex directly for now
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 5, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Current main and the v2026.6.6 release already cover the central failure: ordered OpenAI OAuth profiles are forwarded into Codex harness runs instead of leaving the inference path with
profile=-; the separate migrated empty/default auth-store concern is tracked elsewhere.So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the shipped v2026.6.6/current auth-forwarding path for this inference handoff, and use #91352 for the distinct migrated empty/default auth-store problem.
Do we have a high-confidence way to reproduce the issue?
No current-main failure path remains from source inspection: the reported 2026.6.1 logs are credible, but current main and v2026.6.6 now forward the selected OpenAI OAuth profile into Codex harness attempts. I did not run live OAuth inference in this read-only review.
Is this the best way to solve the issue?
Yes. The current runtime-plan and scoped-store path is a better durable solution than only widening the bootstrap predicate because it forwards the Codex-owned OpenAI profile while preserving plugin-harness credential isolation.
Security review:
Security review: No PR diff or vulnerability report was under review; this pass only inspected existing auth routing behavior for issue triage.
AGENTS.md: found and applied where relevant.
What I checked:
codex/gpt-5.5andopenai/gpt-5.5inference without an Authorization header despite a storedopenai:*OAuth profile and auth order; later comments linked the attempted fix PR and a separate migration-empty-store data point.openai:*profile instead of treating the provider as unauthenticated. (src/agents/embedded-agent-runner/run.ts:1000, dd7f2ef002e8)src/agents/embedded-agent-runner/run.ts:1273, dd7f2ef002e8)runtimePlan.auth.forwardedAuthProfileIdbefore falling back to the request profile or binding profile, which is the handoff needed for the reported inference path. (extensions/codex/src/app-server/run-attempt.ts:453, dd7f2ef002e8)openai:work; adjacent tests cover forcedopenai/*Codex runtime OAuth bootstrap and external overlay selection. (src/agents/embedded-agent-runner/run.overflow-compaction.test.ts:1006, dd7f2ef002e8)auth_provider_from_authmaps ChatGPT/OAuth auth snapshots toBearerAuthProvider, and that provider inserts theAuthorization: Bearer ...header, so forwarding the OAuth profile store is the correct dependency contract for the missing-header failure. (../codex/codex-rs/model-provider/src/auth.rs:117, e5253b97fb6c)Likely related people:
src/agents/runtime-plan/auth.ts,extensions/codex/src/app-server/run-attempt.ts,extensions/codex/src/app-server/auth-bridge.ts)src/agents/openai-routing.ts,src/agents/embedded-agent-runner/run.ts,extensions/codex/provider-catalog.ts)Codex review notes: model internal, reasoning high; reviewed against dd7f2ef002e8; fix evidence: release v2026.6.6, commit 8c802aa68351.
wangmiao0668000666 commentedon Jun 9, 2026
I've analyzed this issue and identified the root cause. The regression was introduced in commit 4c33aaa ("refactor: unify OpenAI provider identity").
When using
codex/gpt-5.5, the provider resolves tocodexinstead ofopenai. However, thepluginHarnessNeedsOpenClawAuthBootstrapcheck insrc/agents/embedded-agent-runner/run.ts:826still requiresprovider === OPENAI_PROVIDER_ID, which evaluates tofalseforcodex.This causes the auth store to be initialized as empty (
createEmptyAuthProfileStore()), stripping out the OAuth profile and resulting inprofile=-.Fix: Include
codexin the bootstrap condition so OpenClaw properly loads and forwards auth profiles for Codex harness responses-API models.I'll submit a PR shortly.
alexph-dev commentedon Jun 9, 2026
Adding another related data point from a local 2026.6.x OpenAI/Codex OAuth setup. This may be one layer earlier than the
profile=-runtime failure described here.Sanitized timeline/evidence:
openclaw doctor --fix --yes --non-interactiveran from the OpenClaw checkout at2026-06-09 08:26:39 +08.auth-profiles.json.openai-provider-unification.*.bakwith legacyopenai-codex:*OAuth profiles.auth-profiles.json.sqlite-import.*.bakwith canonicalopenai:*OAuth profiles.auth-profiles.jsonwas recreated as an empty store:{"version":1,"profiles":{}}.OPENAI_API_KEYwas present.So the failure mode is not just “OAuth profile exists but is not attached to inference”; in this case valid OAuth profiles existed in migration backups, but the active auth store ended up empty after provider-unification / SQLite-import style migration. If this is covered by the same root cause, the fix should probably assert that doctor/import leaves the active auth store populated whenever it archives valid OAuth profiles.
No tokens/profile IDs included here; all identifiers above are sanitized.