OpenClaw 2026.6.6 の Gateway 常駐運用において、WebChat / Telegram から短いメッセージを送っても応答開始まで非常に時間がかかる問題があった。
当初は、短文入力でも model-resolution に 35〜40 秒程度かかるケースがあり、実際の LLM API 呼び出しよりも、OpenClaw 内部のモデル解決・認証・プラグイン初期化まわりがボトルネックになっていた。
その後、未使用プラグインの無効化、フックの整理、モデル fallback の単純化を行った結果、短文応答の総処理時間はおおむね 5〜6 秒程度まで改善した。
最終的な主要ボトルネックは、Google/Gemma API ではなく、OpenClaw 内部の model-resolution に残る約 2.6 秒の固定コストである。
OpenClaw version:
OpenClaw 2026.6.6 (8c802aa)
OS / shell:
Windows / PowerShell
主な利用チャネル:
WebChat / Dashboard
Telegram
主モデル:
google/gemma-4-31b-it
認証状態:
openclaw models auth list
Agent: main
Auth state store: ~\.openclaw\agents\main\agent\openclaw-agent.sqlite
Profiles:
- google:default [google/api_key]
Google provider では google/gemma-4-31b-it が認識されており、実際の model-fetch も Google Generative AI API の streamGenerateContent に到達していた。
短い入力でも、応答開始前に非常に長い待ち時間が発生していた。
代表的な trace では、startup stages のうち model-resolution が 35〜40 秒程度を占めていた。
典型的な構造は以下。
startup stages:
workspace: 数 ms
runtime-plugins: 数 ms
hooks: 数 ms
model-resolution: 35000〜40000ms
auth: 数十 ms
context-engine: 数 ms
この時点で重要だったのは、実際の Google API 呼び出し自体は比較的速かったこと。
[model-fetch] start provider=google model=gemma-4-31b-it
[model-fetch] response provider=google model=gemma-4-31b-it status=200 elapsedMs=1300〜数秒程度
つまり、遅延の主因は Gemma 4 31B の生成速度ではなく、OpenClaw がモデル呼び出しに入る前の内部処理だった。
起動時または hot reload 時に多数の provider plugin が読み込まれていた。
例:
[plugins] loading anthropic ...
[plugins] loading openai ...
[plugins] loading opencode ...
[plugins] loading openrouter ...
...
[plugins] loaded 47 plugin(s) ... in 5739.1ms
さらに、初期状態では以下のような非常に重い prewarm が出ていた。
post-ready.agent-runtime-plugins:90512ms
provider auth state pre-warmed in 93502ms
このため、Gateway 起動後や config hot reload 後に、OpenClaw の main event loop が長時間ブロックされるような状態になっていた。
Google/Gemma を主モデルにしているにもかかわらず、ログに以下が出ていた。
[agents/auth-profiles] used external cli oauth bootstrap because local oauth was missing or unusable
trace では、具体的に以下のように openai:default が示された。
{
"profileId": "openai:default",
"provider": "openai",
"externalExpires": 1781671454000
}
used external cli oauth bootstrap because local oauth was missing or unusable
ただし、openclaw models auth list では保存済み profile は google:default [google/api_key] のみだった。
このことから、OpenAI OAuth profile が main agent の auth store に保存されているわけではなく、provider prewarm / catalog / status / reload などの処理で、外部 CLI 認証情報を runtime 的に見に行っている可能性が高いと判断した。
openclaw plugins disable <name> で無効化しても、ログ上は extension module が loading ... と表示される場合がある。
これは、無効化された plugin が通常 runtime surface から外れることと、OpenClaw が plugin registry / model catalog / metadata inspection のために module を読み込むことが別だからと考えられる。
したがって、disable は「完全にファイル import されない」ことを意味しない。
実用上は、以下を区別する必要がある。
plugin が registry/catalog inspection のために読み込まれる
plugin が enabled plugin として runtime surface に参加する
plugin が実際の model call / tool call / hook に使われる
Google/Gemma を主用途とするため、不要な hosted model provider、Copilot 系、OpenAI / Anthropic 系、OpenRouter 系、ローカル provider 系を無効化対象にした。
代表的な無効化対象:
openclaw plugins disable openai
openclaw plugins disable anthropic
openclaw plugins disable opencode
openclaw plugins disable opencode-go
openclaw plugins disable openrouter
openclaw plugins disable github-copilot
openclaw plugins disable copilot-proxy
openclaw plugins disable runwayその他、利用予定のない provider plugin も無効化した。
openclaw plugins disable arcee
openclaw plugins disable byteplus
openclaw plugins disable cerebras
openclaw plugins disable chutes
openclaw plugins disable cloudflare-ai-gateway
openclaw plugins disable deepinfra
openclaw plugins disable deepseek
openclaw plugins disable fal
openclaw plugins disable fireworks
openclaw plugins disable gmi
openclaw plugins disable groq
openclaw plugins disable huggingface
openclaw plugins disable kilocode
openclaw plugins disable kimi
openclaw plugins disable litellm
openclaw plugins disable lmstudio
openclaw plugins disable microsoft-foundry
openclaw plugins disable minimax
openclaw plugins disable mistral
openclaw plugins disable moonshot
openclaw plugins disable novita
openclaw plugins disable nvidia
openclaw plugins disable ollama
openclaw plugins disable qianfan
openclaw plugins disable qwen
openclaw plugins disable sglang
openclaw plugins disable stepfun
openclaw plugins disable synthetic
openclaw plugins disable tencent
openclaw plugins disable together
openclaw plugins disable venice
openclaw plugins disable vercel-ai-gateway
openclaw plugins disable vllm
openclaw plugins disable volcengine
openclaw plugins disable vydra
openclaw plugins disable xai
openclaw plugins disable xiaomi
openclaw plugins disable zai実際に残す候補は、用途に応じて次のように整理した。
最小構成:
google
telegram
workboard
memory-core
Dashboard / ファイル転送 / ブラウザ操作も使う場合:
browser
canvas
device-pair
document-extract
file-transfer
google
memory-core
telegram
web-readability
workboard
音声やスマホ操作を使わない場合は、以下は無効化候補。
openclaw plugins disable phone-control
openclaw plugins disable talk-voiceGateway 起動中に openclaw plugins disable ... を1つずつ実行すると、そのたびに config hot reload が走る。
例:
config change detected; evaluating reload
config hot reload applied
このたびに prewarm や auth bootstrap が走る可能性があるため、まとめて変更する場合は Gateway を停止してから行うのが望ましい。
openclaw gateway stop
# plugins disable / enable をまとめて実行
openclaw gateway startまたは、最後に必ず再起動する。
openclaw gateway restartモデル設定を最小化した。
{
"primary": "google/gemma-4-31b-it",
"fallbacks": [
"google/gemma-4-31b-it"
]
}これにより、fallback 解決時に OpenAI / Anthropic / OpenRouter / Copilot などの他 provider を探索する余地を潰した。
ただし、この設定では google/gemma-4-31b-it が一時的に 500 error を返した場合、別モデルへ逃げることはできない。可用性重視なら、以下のように Google provider 内の Gemini Flash 系を fallback に入れる案もある。
{
"primary": "google/gemma-4-31b-it",
"fallbacks": [
"google/gemini-2.5-flash",
"google/gemini-2.5-flash-lite"
]
}ただし、fallback を増やすと model-resolution の探索範囲が増える可能性があるため、性能検証中は単一モデル構成の方が切り分けやすい。
以下で hook 一覧を確認した。
openclaw hooks list確認された hooks:
boot-md
bootstrap-extra-files
command-logger
compaction-notifier
session-memory
これらはすべて ready だった。
通常応答時には以下のログが出ていた。
[plugins] [hooks] running before_agent_reply (1 handlers, first-claim wins)
ただし trace では、startup stages 内の hooks は 0ms だった。
startup stages:
runtime-plugins:2ms
hooks:0ms
model-resolution:2666ms
したがって、今回の残存遅延の主因は hook ではなかった。
改善後、短い「こんにちは」入力では以下のようなログになった。
message received
...
embedded run start provider=google model=gemma-4-31b-it
...
model-fetch start provider=google model=gemma-4-31b-it
model-fetch response status=200 elapsedMs=1902
...
embedded run done durationMs=5194
message processed duration=5866ms
別の実行でも、全体は約 5.6 秒だった。
message processed ... duration=5635ms
この時点で、最初に問題だった 35〜40 秒級の応答遅延は解消した。
trace で見ると、残りの主な固定コストは model-resolution だった。
startup stages:
totalMs=2721
workspace:0ms
runtime-plugins:2ms
hooks:0ms
model-resolution:2666ms
auth:47ms
context-engine:0ms
attempt-workspace:4ms
attempt-prompt:0ms
attempt-runtime-plan:2ms
attempt-dispatch:0ms
別実行でも同様。
startup stages:
totalMs=2719
workspace:0ms
runtime-plugins:2ms
hooks:0ms
model-resolution:2631ms
auth:51ms
context-engine:1ms
attempt-workspace:32ms
attempt-runtime-plan:2ms
このため、改善後の内訳は概ね以下。
model-resolution: 約2.6秒
auth: 約50ms
core-plugin-tools: 約100〜140ms
Google/Gemma model-fetch: 約1.4〜1.9秒
全体: 約5〜6秒
core-plugin-tools は以下の程度で、主因ではなかった。
core-plugin-tools totalMs=107〜141ms
plugin-tools:44〜70ms
authorization-policy:12ms
schema-normalization:3〜6ms
改善後、以下のような 500 error が発生することがあった。
[model-fetch] response provider=google api=google-generative-ai model=gemma-4-31b-it status=500 elapsedMs=942 contentType=text/event-stream
error=LLM request failed.
rawError=Google Generative AI API error (500): Internal error encountered. [code=INTERNAL]
これは OpenClaw の model-resolution 問題ではなく、Google Generative AI API 側が 500 Internal error を返したもの。
認証エラーなら 401 / 403、クォータなら 429、モデル名不正なら 404 系になるため、この 500 は上流 API または当該モデル提供基盤側の一時的失敗と判断する。
頻度確認:
Select-String -Path "$env:LOCALAPPDATA\Temp\openclaw\openclaw-*.log" `
-Pattern "status=500|code=INTERNAL|LLM request failed" |
Select-Object -Last 30単発なら再送でよい。頻発する場合は、一時的に google/gemini-2.5-flash などへ切り替えるか、fallback に入れる。
openclaw --versionopenclaw gateway restartopenclaw status --deep
openclaw doctor
openclaw doctor --fixopenclaw models list --provider googleopenclaw models auth listopenclaw models status --jsonopenclaw plugins list
openclaw plugins list --enabled
openclaw plugins list --disabledopenclaw hooks listopenclaw config set logging.level trace
openclaw gateway restartopenclaw logs --follow | Select-String "startup stages|model-resolution|runtime-plugins|hooks|auth|agent harness selected|embedded run start|model-fetch|message processed|liveness warning"Select-String -Path "$env:LOCALAPPDATA\Temp\openclaw\openclaw-*.log" `
-Pattern "external cli oauth|openai:default|anthropic|oauth bootstrap" |
Select-Object -Last 30Select-String -Path "$env:LOCALAPPDATA\Temp\openclaw\openclaw-*.log" `
-Pattern "status=500|code=INTERNAL|LLM request failed" |
Select-Object -Last 30最初の深刻な応答遅延は、主に以下の対応で大幅に改善した。
未使用 provider plugin の無効化
OpenAI / Anthropic / Copilot / OpenRouter / opencode 系の無効化
不要 capability plugin の無効化
fallback を google/gemma-4-31b-it のみに整理
hooks の確認と不要 hook の整理
Gateway restart による hot reload 状態のリセット
改善前は model-resolution が 35〜40 秒程度かかることがあった。
改善後は、短文応答の全体処理時間がおおむね 5〜6 秒程度になった。
残っている主な固定コストは、毎 turn の model-resolution 約 2.6 秒である。
この残存コストは、現在の設定ではかなり詰めた状態であり、OpenClaw 本体側で resolved model / provider / harness を process 内 cache するなどの改善がないと、さらに大きく削るのは難しい可能性がある。
OpenClaw 側に issue / feature request を出すなら、以下のような内容が妥当。
Single provider / single model / single fallback configuration still spends about 2.6s per turn in model-resolution.
Config:
primary: google/gemma-4-31b-it
fallbacks: [google/gemma-4-31b-it]
Trace:
startup stages totalMs=2721
workspace:0ms
runtime-plugins:2ms
hooks:0ms
model-resolution:2666ms
auth:47ms
context-engine:0ms
Request:
Cache resolved model/provider/harness within the Gateway process and invalidate it only on config reload, plugin reload, model config change, or auth state change.
この要望は、今回の観測結果と整合している。