Part 15: Infrastructure Hardening (Stop Crashing Yourself) banner
OnlyTerp OnlyTerp

Part 15: Infrastructure Hardening (Stop Crashing Yourself)

DevOps & Infrastructure community intermediate

Description

Your OpenClaw setup probably has hidden landmines that cause crash loops, GPU contention, and rate limit spirals. We found all of ours in one session. Here's what to check and how to fix each one. ---

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for OnlyTerp/openclaw-optimization-guide, shared by 11 entries in this directory. It describes the repository, not this entry specifically.

Part 15: Infrastructure Hardening (Stop Crashing Yourself)

Your OpenClaw setup probably has hidden landmines that cause crash loops, GPU contention, and rate limit spirals. We found all of ours in one session. Here's what to check and how to fix each one.


The Compaction Crash Loop

The Problem

OpenClaw uses a model to "compact" (summarize) old conversation history when sessions get long. By default, this uses whatever model your Google plugin provides — usually **Gemini 2.5 Flash**.

When you hit Gemini's rate limit (1M tokens/min), compaction starts failing with 429 errors. Instead of backing off, it **retries immediately** — creating an infinite loop:

compaction: Full summarization failed (429 quota exceeded)
compaction: Partial summarization also failed (429)
compaction: Full summarization failed (429)
... every 2 seconds, forever

This makes OpenClaw "crash" when you open a chat — the gateway is stuck in a compaction retry loop.

The Fix

Set an explicit compaction model that won't rate-limit you:

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "cerebras/qwen-3-235b-a22b-instruct-2507",
        "mode": "safeguard",
        "reserveTokens": 15000
      }
    }
  }
}

**Why Cerebras?** 3,000 tokens/second, generous rate limits, and the 235B MoE model produces quality summaries.

**Never use for compaction:** Gemini Flash (rate limits), expensive models like Opus (waste of money for summarization).


The Gemini Flash Trap

The Problem

Gemini 2.5 Flash sneaks into more places than you realize:

Subsystem What It Does Why Flash Is Bad Here
Compaction Summarizes old messages Rate limits → crash loop
Slug generation Names your sessions Timeouts → errors in logs
Session memory hooks Saves session context Rate limits → data loss
Auto-capture hooks Extracts learnings Rate limits → missed captures
Agent fallbacks Backup when primary fails Also rate-limited when you need it most
Web search grounding Powers web_search tool Shares quota with everything else

When multiple subsystems hit Flash simultaneously, you blow through the quota instantly. One agent doing research + compaction + session saves = 3+ concurrent Flash calls = instant rate limit.

The Fix

**1. Audit every Flash reference:**

Select-String -Path ~/.openclaw/openclaw.json -Pattern "gemini-2.5-flash"

**2. Replace in priority order:**

  • Compaction model → Cerebras or local model
  • Agent fallbacks → Cerebras qwen235b
  • Web search provider → Tavily

GPU Contention: The Embedding Server Problem

The Problem

If you run a local embedding server on the same GPU you game/infer on:

  • Embedding server allocates 15GB+ VRAM (Qwen3-VL-8B in FP16)
  • CUDA "already borrowed" errors → embedding server crashes
  • Kill embedding server to game → memory system dies