Industrial Hypertext

Custom software, inspection systems & websites - Perth since 2002

I hit this exact failure recently:

Agent failed before reply: OAuth token refresh failed for openai-codex: Failed to refresh OAuth token for openai-codex. Please try again or re-authenticate.
Logs: openclaw logs --follow

The short version is: your OpenClaw runtime is fine, but the OAuth session for openai-codex is stale or invalid and needs to be re-authenticated.

Fast fix that worked

Run this command:

openclaw onboard --auth-choice openai-codex

That re-runs onboarding and refreshes auth for the OpenAI Codex provider. I got this exact recovery path from a YouTube walkthrough and confirmed it works in practice.

Sanity checks after re-auth

  1. Run openclaw status and verify model/auth look normal.
  2. Send a quick test message in your control UI/chat.
  3. If you rely on cron, trigger one test run and confirm delivery.

If it still fails

The key lesson: this error usually looks scary but is mostly an auth refresh issue, not a full system failure. Re-auth, verify, and move on.

Related OpenClaw fix

If OpenClaw says it updated but still seems to be running the old version afterwards, see OpenClaw Updated, But I Was Still Running the Old Version.

Need the next step, not another generic read?

Discuss a software bottleneck · Book an IHTMaps workflow review · Request a website quote

Best fit for inherited systems, spreadsheet-heavy workflows, internal tools, inspection processes, and websites that need better enquiry flow or calmer technical ownership.

Call 0432 000 583 if you want to talk through the current bottleneck directly.

E-business card (QR ready) for conferences and in-person shares. · Site map

Copyright © 2026 Industrial Hypertext - Software Development Perth, Western Australia | All rights reserved