openclaw - 💡(How to fix) Fix Make `PRIMARY_MODEL_PREWARM_TIMEOUT_MS` configurable via env or config (follow-up to #74776) [2 comments, 2 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#75791Fetched 2026-05-02 05:30:05
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
2
Timeline (top)
commented ×2closed ×1referenced ×1

Root Cause

This is a follow-up to recently-closed #74776 ("gateway: prewarmConfiguredPrimaryModel blocks channel startup for ~4 minutes on every restart"). That issue addressed the structural problem (channels should not block on prewarm); this one addresses the still-cosmetic but persistent boot-time warning caused by the inner 5-second hardcoded timeout.

Code Example

const PRIMARY_MODEL_PREWARM_TIMEOUT_MS = 5e3;

---

[gateway] startup model warmup timed out after 5000ms; continuing without waiting
RAW_BUFFERClick to expand / collapse

This is a follow-up to recently-closed #74776 ("gateway: prewarmConfiguredPrimaryModel blocks channel startup for ~4 minutes on every restart"). That issue addressed the structural problem (channels should not block on prewarm); this one addresses the still-cosmetic but persistent boot-time warning caused by the inner 5-second hardcoded timeout.

The startup model warmup timeout is hardcoded to 5000ms at dist/server.impl-Cgc64qrk.js:5338:

const PRIMARY_MODEL_PREWARM_TIMEOUT_MS = 5e3;

It's referenced at line 5423 with params.timeoutMs ?? PRIMARY_MODEL_PREWARM_TIMEOUT_MS but no caller in the gateway boot path passes a timeoutMs override, so it's effectively a hard 5-second budget.

This is too tight for gemini-cli runtime (cold OAuth handshake takes 8-15s), pi runtime first-use (model-loader initialization), or any provider with slow auth refresh. Every gateway boot logs:

[gateway] startup model warmup timed out after 5000ms; continuing without waiting

The behavior is "continue without waiting" so it's cosmetic, but every boot generates noise warnings AND the gateway proceeds with a half-warmed model which causes follow-up failures (fetch-timeout, model-call hangs).

Proposed fix: read from gateway.warmupTimeoutMs config OR OPENCLAW_PRIMARY_MODEL_PREWARM_TIMEOUT_MS env var, defaulting to 5000ms when unset. Suggested precedence: env > config > hardcoded default.

Reproduce: configure agentRuntime.id: "gemini-cli" with no other changes; restart gateway; observe the warning every boot.

extent analysis

TL;DR

Increase the startup model warmup timeout by configuring gateway.warmupTimeoutMs or setting the OPENCLAW_PRIMARY_MODEL_PREWARM_TIMEOUT_MS environment variable to a value greater than 5000ms.

Guidance

  • Identify the current timeout value and consider increasing it based on the specific runtime environment, such as gemini-cli or pi, to accommodate slower auth refresh times.
  • Review the proposed fix and consider implementing it to make the timeout configurable via gateway.warmupTimeoutMs or OPENCLAW_PRIMARY_MODEL_PREWARM_TIMEOUT_MS.
  • To verify the fix, restart the gateway with the updated configuration and check for the absence of the "startup model warmup timed out" warning.
  • Consider testing with different timeout values to determine the optimal setting for the specific use case.

Example

// Example configuration update
const config = {
  // ...
  gateway: {
    warmupTimeoutMs: 15000, // increased timeout value
  },
};

Notes

The proposed fix aims to address the cosmetic issue of the startup model warmup timeout warning, but it may not resolve the underlying issues of follow-up failures (fetch-timeout, model-call hangs). Further investigation may be necessary to address these related problems.

Recommendation

Apply the proposed fix by configuring gateway.warmupTimeoutMs or setting the OPENCLAW_PRIMARY_MODEL_PREWARM_TIMEOUT_MS environment variable to increase the startup model warmup timeout, as this will help reduce the noise warnings and potentially improve the overall stability of the gateway.

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…

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 Make `PRIMARY_MODEL_PREWARM_TIMEOUT_MS` configurable via env or config (follow-up to #74776) [2 comments, 2 participants]