OpenClaw (PC Instance)

Instance

  • Running on: DESKTOP-F9KSPPP (Windows)
  • Path: C:\Users\Sozo\AppData\Roaming\npm\node_modules\openclaw\
  • Startup: Start-Process node.exe -ArgumentList '--stack-size=4096', 'openclaw.mjs', 'gateway', '--port', '18789'
  • Web UI: http://localhost:18789
  • Gateway: port 18791

Config File

D:\OpenClaw_Home\.openclaw\openclaw.json

Default Model

deepseek/deepseek-v4-flash (直连, OpenRouter, 2026-06-09 切换; minimax 降级为 fallback#1)

Model Provider Stack (2026-06-09 update — Telegram session 20260609_083838_42294b4e)

状态: 根因已找到 + 修复已应用 (user 改 “deepseek 直连因为好像比较便宜”); 价格对比验证仍 mid-Q&A (助手在 08:55 暂停核对官方价 vs minimax 账单)

触发原因

之前 OpenClaw primary = openrouter/deepseek/deepseek-v4-flash (走 OpenRouter 中转). user 在 Telegram 说 “改成 deepseek 直连因为好像比较便宜”, 助手在同一个 session 内完成了切换.

当前 providers 配置 (D:\OpenClaw_Home.openclaw\openclaw.json)

{
  "providers": {
    "deepseek": {
      "baseUrl": "https://api.deepseek.com/v1",
      "api": "openai-completions",
      "apiKey": {
        "source": "env",
        "provider": "default",
        "id": "DEEPSEEK_API_KEY"   // SecretRef — 实际值不在 JSON 里
      }
    },
    "minimax": { /* 保留为 fallback#1, api 同样 openai-completions */ }
  }
}

三个模型实测 (openclaw models list 输出)

deepseek/deepseek-v4-flash    text    1024k    default,configured,alias:DSFlash
minimax/MiniMax-M2.7          text    200k     fallback#1
deepseek/deepseek-v4-pro      text    1024k    configured,alias:DSPro

Gateway 升级

  • 旧版: OpenClaw (Gemini 4 时代, build 不详)
  • 新版: OpenClaw 2026.6.1 (2e08f0f)
  • npm install: added 21 packages, removed 277 packages (依赖重整)
  • health-monitor.ps1 有 auto-repair (kill + restart) → 升级时不用手动管 gateway

备份 (改动前快照)

  • C:\Users\IDA\.openclaw\openclaw.json.pre-gemini4-20260609-… — 切换前的 Gemini 4 配置, 完整保留

Key 安全

  • DEEPSEEK_API_KEY 存哪里: 走 SecretRef → 环境变量 DEEPSEEK_API_KEY (在 IDA PC 的 ~/.hermes/.env 或 Sozo PC 的对应位置, 需 user 确认哪个)
  • openclaw.json 里只看到 __OPENCLAW_REDACTED__ placeholder, 真 key 不在 JSON
  • 注意: 这跟 desktop-app-启-backend-用哪个-env-—-两个独立-hermes-部署-2026-06-07-1330%LOCALAPPDATA%\hermes\.env 写 key 是两套独立方案 — OpenClaw 走 env var + SecretRef, Hermes Desktop 走 plaintext .env

Defer (等 user 完成价格对比)

  • 助手 08:55 暂停在 “官方 DeepSeek 价 vs minimax 账单” 对比 → 价格是否真的更便宜, 需要拿实际账单才算数
  • 如果 user 回话: “账单出来了, 直连确实便宜” → 标记本次切换 = 确认有效, 加进 decision-log
  • 如果 user 回话: “其实差不多” → 触发”是否切回 OpenRouter” 的 A/B/C
  • 如果 user 不回: 默认保留当前直连配置, 不主动回退
  • decision-log (2026-04-15 旧决策 “OpenClaw primary = openrouter/…”; 待加 2026-06-09 的 supersede 决策)
  • hermes-agent (Hermes Desktop 的 DEEPSEEK_API_KEY 修复是另一个子系统, 不要混淆)
  • sozo-setup (OpenClaw 跑在 Sozo PC, 配置在 D:\OpenClaw_Home)

Telegram Bot

  • Bot: @JakeyBiluBot
  • Token: 8766595133:AAH...iqN_BpP... (partial — full token in PC config)
  • Status: Gateway running, but Telegram polling FAILS (see below)

CRITICAL BUG: Node.js 24 Telegram Fetch Timeout (2026-05-05)

Symptom

  • OpenClaw gateway starts successfully on port 18789
  • Telegram plugin fails to poll: fetch timeout reached; aborting operation
  • fetchWithTimeout to api.telegram.org/bot.../getMe times out after 38600ms
  • Subsequent setMyCommands also fails with network error
  • BUT: curl.exe on the same PC CAN reach Telegram API instantly

Root Cause

Node.js 24’s native fetch (used by Grammy library) cannot reach Telegram API from this PC. Curl works fine. This is a Node.js-specific network issue — possibly related to:

  • TLS/SSL stack difference between Node.js fetch and Windows system TLS
  • Node.js 24 (unreleased/beta) network behavior on Windows
  • Antivirus/firewall selectively blocking Node.js HTTPS connections

Event Loop Issue

Log also shows severe event loop starvation when Telegram fetch hangs:

  • 34 seconds delay
  • 93% event loop utilization
  • This blocks all other operations during the 38s timeout

Workaround

  1. Direct Telegram API calls via curl from PC work fine
  2. Bot can send messages via API even though polling fails
  3. User receives messages from Termux Hermes bot, not OpenClaw bot

Investigation Tried

  • -e "TRACE RESOLUTION" Node flag — no additional info
  • --tls-max=<version> flag attempt
  • Different Telegram API methods all fail (getMe, setMyCommands)
  • All fail at network level, not Telegram API level

Known Working Startup (2026-05-05 22:34)

# Kill existing
ssh Sozo@100.83.112.84 "taskkill /F /PID <PID>"
 
# Start via PowerShell Start-Process with output redirection
ssh Sozo@100.83.112.84 "powershell -NoProfile -Command \
  'Start-Process -FilePath \"C:\Program Files\nodejs\node.exe\" \
    -ArgumentList \"--stack-size=4096\",\"C:\Users\Sozo\AppData\Roaming\npm\node_modules\openclaw\openclaw.mjs\",\"gateway\",\"--port\",\"18789\" \
    -RedirectStandardOutput \"C:\Users\Sozo\AppData\Local\Temp\openclaw\stdout.log\" \
    -RedirectStandardError \"C:\Users\Sozo\AppData\Local\Temp\openclaw\stderr.log\"'"
 
# Verify after 15s
ssh Sozo@100.83.112.84 "netstat -ano | findstr 18789"

Lock File Issue

  • Location: C:\Users\Sozo\AppData\Roaming\npm\node_modules\openclaw\state\lock
  • Delete before starting if “already running” error
  • Sometimes need to delete twice

Memory Index Corruption Fix (2026-05-06)

Symptom

  • OpenClaw semantic memory index becomes corrupted
  • Residual main.sqlite.tmp-* files accumulate in memory directory
  • This causes memory/index functionality to fail or behave incorrectly

Fix Procedure

  1. Stop the gateway:
    # Find and kill gateway process
    Get-Process node -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*openclaw*' }
    Stop-Process -Id <PID> -Force
  2. Delete tmp files:
    Remove-Item "$env:OPENCLAW_HOME\.openclaw\memory\main.sqlite.tmp-*" -Force
  3. Rebuild semantic index:
    openclaw memory index --force
  4. Restart gateway (see Known Working Startup above)

npm Corruption Fix (2026-05-14)

Symptom

  • OpenClaw fails to start with backoff-OFL2Aish.js module not found
  • dist/ folder missing critical files

Fix

# Full reinstall of OpenClaw npm package
npm install -g openclaw

Background Crash Issue (2026-05-13)

Observation

Claude Code (also MiniMax 2.7, local PC) does NOT crash during intensive work. OpenClaw crashes frequently on the same PC, same model. This suggests the issue is not the model but the OpenClaw/Node.js environment.

Symptoms

  • OpenClaw gateway crashes while Claude Code stays stable
  • Both use MiniMax 2.7 via OpenRouter on the same Windows PC
  • Crash causes loss of task context/recall — significant recovery overhead

UTF-8 BOM Config Bug (2026-05-14)

Symptom

  • OpenClaw gateway shows bot token as 8766595133:*** (PowerShell masking)
  • Telegram returns 401 Unauthorized even with correct token
  • JSON.parse silently fails to read config due to BOM

Root Cause

  • openclaw.json has UTF-8 BOM (EF BB BF) at start of file
  • Node.js JSON.parse cannot read files with BOM — treats BOM as invalid character
  • Config appears to load but critical fields are unreadable

Fix

# Remove UTF-8 BOM from openclaw.json
$bom = [byte[]](0xEF, 0xBB, 0xBF)
$content = [System.IO.File]::ReadAllBytes("D:\OpenClaw_Home\.openclaw\openclaw.json")
if ($content[0..2] -join "," -eq "239,187,191") {
    $clean = $content[3..($content.Length-1)]
    [System.IO.File]::WriteAllBytes("D:\OpenClaw_Home\.openclaw\openclaw.json", $clean)
    Write-Host "BOM removed"
}

Verification

# Check first 4 bytes — should be 7B 0D 0A 20 ({ \r \n space), NOT EF BB BF
[System.IO.File]::ReadAllBytes("D:\OpenClaw_Home\.openclaw\openclaw.json")[0..3] -join " "

Connection

  • SSH: ssh Sozo@100.83.112.84
  • SSH alternative: ssh sozo@100.83.112.84