openclaw - 💡(How to fix) Fix Gateway startup warmup is slow for inline configured primary model [1 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#73528Fetched 2026-04-29 06:18:44
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
closed ×1commented ×1

Gateway startup can spend ~45 seconds in prewarmConfiguredPrimaryModel() even when the primary model is already explicitly configured inline in openclaw.json under models.providers.<provider>.models[].

This was observed on a normal Linux/systemd user service, not Android/proot.

Related PR: #60027

Root Cause

Gateway startup can spend ~45 seconds in prewarmConfiguredPrimaryModel() even when the primary model is already explicitly configured inline in openclaw.json under models.providers.<provider>.models[].

This was observed on a normal Linux/systemd user service, not Android/proot.

Related PR: #60027

Fix Action

Fix / Workaround

Local workaround tested

I tested a local dist-only workaround that returns early from prewarmConfiguredPrimaryModel() when the resolved primary model is present in inline models.providers with explicit model/provider transport metadata (api/provider api/baseUrl).

StepTime after local workaround
sidecars.channels189ms
gateway ready~11.9s total
RAW_BUFFERClick to expand / collapse

Summary

Gateway startup can spend ~45 seconds in prewarmConfiguredPrimaryModel() even when the primary model is already explicitly configured inline in openclaw.json under models.providers.<provider>.models[].

This was observed on a normal Linux/systemd user service, not Android/proot.

Related PR: #60027

Environment

  • OpenClaw: 2026.4.26 (be8c246)
  • Runtime: systemd user service
  • Node: v22.21.1
  • Primary model: openai-codex/gpt-5.5
  • Config shape: openai-codex/gpt-5.5 is already declared inline in models.providers.openai-codex.models[] with provider/model API metadata

No secrets or API keys are needed to reproduce the shape of the issue.

What I measured

Using gateway startup tracing plus temporary local timing around sidecars.channels and prewarmConfiguredPrimaryModel():

StepTime before
sidecars.channels~44.8s
prewarmConfiguredPrimaryModel()~44.5s
ensureOpenClawModelsJson() inside prewarm~14.8s
resolveModel() inside prewarm~29.8s
startChannels()~80-190ms
sidecars.memory~0.3ms

So the slow part was not channel startup, TTS, memory, or markdown/workspace scanning. It was the eager primary-model warmup path.

Additional local tracing split resolveModel() further and showed the slow work came from provider/auth/catalog discovery and suppression/runtime hook paths, even though the selected primary model was already present inline in config.

Actual behavior

On startup, OpenClaw enters the PI primary-model warmup path and runs:

  1. ensureOpenClawModelsJson(cfg, agentDir)
  2. resolveModel(provider, model, agentDir, cfg, { skipProviderRuntimeHooks: true })

This can add tens of seconds to gateway startup even when the primary model could be resolved directly from inline models.providers config.

Expected behavior

If the resolved primary model is already explicitly declared inline under models.providers.<provider>.models[], startup should avoid the expensive eager registry/provider discovery pass when possible.

Runtime can still perform normal model resolution/validation on first use; this startup warmup already behaves as best-effort and logs warnings rather than failing startup.

Local workaround tested

I tested a local dist-only workaround that returns early from prewarmConfiguredPrimaryModel() when the resolved primary model is present in inline models.providers with explicit model/provider transport metadata (api/provider api/baseUrl).

Result:

StepTime after local workaround
sidecars.channels189ms
gateway ready~11.9s total

CPU also settled normally after startup.

Possible fix directions

  • Keep #60027's OPENCLAW_SKIP_MODEL_WARMUP as an explicit escape hatch.
  • Also consider an automatic fast path in prewarmConfiguredPrimaryModel():
    • resolve configured primary provider/model;
    • if it is already available in inline models.providers.<provider>.models[] with enough transport metadata, skip the eager ensureOpenClawModelsJson() + registry discovery warmup;
    • preserve the current discovery behavior for providers/models that rely on dynamic provider catalogs.

This would avoid a repeated expensive discovery pass for fully configured primary models while keeping dynamic-provider startup behavior unchanged.

extent analysis

TL;DR

The likely fix involves optimizing the prewarmConfiguredPrimaryModel() function to skip expensive registry/provider discovery when the primary model is already explicitly configured inline in openclaw.json.

Guidance

  • Review the prewarmConfiguredPrimaryModel() function to identify opportunities for optimization, particularly in the ensureOpenClawModelsJson() and resolveModel() calls.
  • Consider implementing a fast path in prewarmConfiguredPrimaryModel() that checks if the primary model is already available in inline models.providers with sufficient transport metadata, and skips the eager warmup if so.
  • Evaluate the effectiveness of keeping OPENCLAW_SKIP_MODEL_WARMUP as an explicit escape hatch, as proposed in #60027.
  • Investigate the provider/auth/catalog discovery and suppression/runtime hook paths to understand why they are contributing to the slowdown, even when the primary model is already present inline in config.

Example

No code snippet is provided, as the issue does not contain sufficient information to generate a specific example.

Notes

The proposed fix directions suggest that the issue may be related to the eager warmup of the primary model, and that optimizing this process could significantly reduce startup time. However, the exact implementation details will depend on the specific requirements and constraints of the OpenClaw system.

Recommendation

Apply a workaround by implementing a fast path in prewarmConfiguredPrimaryModel() to skip the expensive registry/provider discovery when the primary model is already explicitly configured inline in openclaw.json. This approach balances the need for optimized startup performance with the requirement to preserve dynamic-provider startup behavior.

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

If the resolved primary model is already explicitly declared inline under models.providers.<provider>.models[], startup should avoid the expensive eager registry/provider discovery pass when possible.

Runtime can still perform normal model resolution/validation on first use; this startup warmup already behaves as best-effort and logs warnings rather than failing startup.

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 Gateway startup warmup is slow for inline configured primary model [1 comments, 2 participants]