app-server: make EXTERNAL_AUTH_REFRESH_TIMEOUT (10s) configurable for external auth refresh

Open 💬 0 comments Opened Jun 11, 2026 by zhuyankarl

Feature request

codex-rs/app-server/src/message_processor.rs hard-codes the wait for the account/chatgptAuthTokens/refresh server→client request:

const EXTERNAL_AUTH_REFRESH_TIMEOUT: Duration = Duration::from_secs(10);

When the app-server is embedded in a host that manages OAuth credentials itself (external auth bridge), the host may legitimately need more than 10s to answer — e.g. it serializes token refreshes across multiple agent processes behind a cross-process lock, or the OAuth token endpoint is slow from the host's region. When that happens the turn fails with:

auth refresh request timed out after 10s

even though the host's refresh succeeds moments later, and the whole turn is aborted rather than retried.

Observed in production with codex-cli 0.135.0 embedded in OpenClaw (see openclaw/openclaw#89278 for a downstream report with logs): bursts of this timeout under refresh-lock contention, self-recovering on the next turn.

Ask

Make the timeout configurable — any of:

  • a config key (e.g. external_auth_refresh_timeout_seconds) or env var read at app-server startup,
  • a parameter on the app-server initialize/handshake so the embedding client can declare how long its auth refresh may take,
  • or at minimum bump the default (the device-auth flow already allows 15 minutes; 10s is tight for a cross-process-locked OAuth refresh).

Happy to provide more logs if useful.

View original on GitHub ↗