openclaw - 💡(How to fix) Fix Lossless/pi-ai `completeSimple` fails with `Connection error` for OpenClaw `claude-cli` Sonnet transport [1 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#73043Fetched 2026-04-28 06:28:18
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Lossless Claw / pi-ai completeSimple fails when using OpenClaw's synthetic claude-cli/claude-sonnet-4-6 provider path, even though raw Claude CLI Sonnet works and OpenClaw runtime auth can read Claude CLI OAuth credentials from Keychain.

This looks like a transport integration issue between Lossless Claw's simple-completion summarizer path and OpenClaw's claude-cli provider (api = anthropic-messages, baseUrl = cli://claude), not a model/auth outage.

Error Message

"error": null "stopReason": "error", "errorMessage": "Connection error." 2. it should fail with a specific transport/provider error explaining why synthetic claude-cli cannot be used from this Lossless/pi-ai path. This does not currently affect production because LCM is running on GPT-5.5 and is healthy. It does block safely using Sonnet as a Lossless Claw summarization model, because the controlled LCM symptom is the same: empty content, zero usage, finish/stopReason=error, Connection error, then fallback/truncation summary.

Root Cause

This does not currently affect production because LCM is running on GPT-5.5 and is healthy. It does block safely using Sonnet as a Lossless Claw summarization model, because the controlled LCM symptom is the same: empty content, zero usage, finish/stopReason=error, Connection error, then fallback/truncation summary.

Code Example

claude --print --model sonnet 'Reply with exactly SONNET_RAW_OK'

---

SONNET_RAW_OK

---

{
  "auth": {
    "mode": "oauth",
    "hasApiKey": true,
    "hasRequest": false,
    "requestKeys": [],
    "error": null
  }
}

---

import { completeSimple } from '/Users/nonzero/.openclaw/extensions/lossless-claw/node_modules/@mariozechner/pi-ai/dist/stream.js';
import { getRuntimeAuthForModel } from '/opt/homebrew/lib/node_modules/openclaw/dist/runtime-model-auth.runtime.js';
import fs from 'node:fs';

const cfg = JSON.parse(fs.readFileSync('/Users/nonzero/.openclaw/openclaw.json', 'utf8'));
const lookupModel = {
  id: 'claude-cli/claude-sonnet-4-6',
  provider: 'claude-cli',
  model: 'claude-sonnet-4-6',
  api: 'anthropic-messages',
  contextWindow: 200000,
};
const runtimeAuth = await getRuntimeAuthForModel({
  model: lookupModel,
  cfg,
  workspaceDir: '/Users/nonzero/.openclaw/workspace',
});

const model = {
  id: 'claude-cli/claude-sonnet-4-6',
  name: 'claude-cli/claude-sonnet-4-6',
  provider: 'claude-cli',
  model: 'claude-sonnet-4-6',
  api: 'anthropic-messages',
  baseUrl: 'cli://claude',
  contextWindow: 200000,
  maxTokens: 4096,
};

const result = await completeSimple(
  { ...model, apiKey: runtimeAuth?.apiKey },
  { messages: [{ role: 'user', content: 'Reply with exactly LCM_SONNET_OK', timestamp: Date.now() }] },
  { maxTokens: 32, temperature: 0, apiKey: runtimeAuth?.apiKey }
);
console.log(JSON.stringify(result, null, 2));

---

{
  "role": "assistant",
  "content": [],
  "api": "anthropic-messages",
  "provider": "claude-cli",
  "model": "claude-cli/claude-sonnet-4-6",
  "usage": {
    "input": 0,
    "output": 0,
    "cacheRead": 0,
    "cacheWrite": 0,
    "totalTokens": 0
  },
  "stopReason": "error",
  "errorMessage": "Connection error."
}
RAW_BUFFERClick to expand / collapse

Summary

Lossless Claw / pi-ai completeSimple fails when using OpenClaw's synthetic claude-cli/claude-sonnet-4-6 provider path, even though raw Claude CLI Sonnet works and OpenClaw runtime auth can read Claude CLI OAuth credentials from Keychain.

This looks like a transport integration issue between Lossless Claw's simple-completion summarizer path and OpenClaw's claude-cli provider (api = anthropic-messages, baseUrl = cli://claude), not a model/auth outage.

Environment

  • macOS host: Darwin arm64
  • OpenClaw: 2026.4.25 (aa36ee6)
  • Lossless Claw: 0.9.2
  • Claude Code CLI: 2.1.119
  • Production LCM remains healthy on GPT-5.5:
    • summaryModel = openai-codex/gpt-5.5
    • summaryProvider = null / absent
    • proactiveThresholdCompactionMode = deferred
    • summaryTimeoutMs = 180000
  • Synthetic Claude provider config:
    • models.providers.claude-cli.api = anthropic-messages
    • models.providers.claude-cli.baseUrl = cli://claude
    • models.providers.claude-cli.models = []

Controls that pass

Raw Sonnet CLI succeeds:

claude --print --model sonnet 'Reply with exactly SONNET_RAW_OK'
SONNET_RAW_OK

OpenClaw runtime auth lookup for the synthetic Sonnet model also succeeds and reads Claude CLI OAuth credentials from Keychain:

{
  "auth": {
    "mode": "oauth",
    "hasApiKey": true,
    "hasRequest": false,
    "requestKeys": [],
    "error": null
  }
}

Production LCM on GPT-5.5 is healthy: 176 production summaries in the last 24h, 0 production fallbacks, fallback rate 0%, degraded=false.

Repro harness

This is a standalone non-production harness. It does not change OpenClaw config, restart the gateway, or write to lcm.db.

import { completeSimple } from '/Users/nonzero/.openclaw/extensions/lossless-claw/node_modules/@mariozechner/pi-ai/dist/stream.js';
import { getRuntimeAuthForModel } from '/opt/homebrew/lib/node_modules/openclaw/dist/runtime-model-auth.runtime.js';
import fs from 'node:fs';

const cfg = JSON.parse(fs.readFileSync('/Users/nonzero/.openclaw/openclaw.json', 'utf8'));
const lookupModel = {
  id: 'claude-cli/claude-sonnet-4-6',
  provider: 'claude-cli',
  model: 'claude-sonnet-4-6',
  api: 'anthropic-messages',
  contextWindow: 200000,
};
const runtimeAuth = await getRuntimeAuthForModel({
  model: lookupModel,
  cfg,
  workspaceDir: '/Users/nonzero/.openclaw/workspace',
});

const model = {
  id: 'claude-cli/claude-sonnet-4-6',
  name: 'claude-cli/claude-sonnet-4-6',
  provider: 'claude-cli',
  model: 'claude-sonnet-4-6',
  api: 'anthropic-messages',
  baseUrl: 'cli://claude',
  contextWindow: 200000,
  maxTokens: 4096,
};

const result = await completeSimple(
  { ...model, apiKey: runtimeAuth?.apiKey },
  { messages: [{ role: 'user', content: 'Reply with exactly LCM_SONNET_OK', timestamp: Date.now() }] },
  { maxTokens: 32, temperature: 0, apiKey: runtimeAuth?.apiKey }
);
console.log(JSON.stringify(result, null, 2));

Actual result

{
  "role": "assistant",
  "content": [],
  "api": "anthropic-messages",
  "provider": "claude-cli",
  "model": "claude-cli/claude-sonnet-4-6",
  "usage": {
    "input": 0,
    "output": 0,
    "cacheRead": 0,
    "cacheWrite": 0,
    "totalTokens": 0
  },
  "stopReason": "error",
  "errorMessage": "Connection error."
}

Expected result

Either:

  1. completeSimple should route through OpenClaw's claude-cli / cli://claude transport and return content, or
  2. it should fail with a specific transport/provider error explaining why synthetic claude-cli cannot be used from this Lossless/pi-ai path.

Impact

This does not currently affect production because LCM is running on GPT-5.5 and is healthy. It does block safely using Sonnet as a Lossless Claw summarization model, because the controlled LCM symptom is the same: empty content, zero usage, finish/stopReason=error, Connection error, then fallback/truncation summary.

Safety note

No production config changes were made during this smoke test:

  • no summaryModel switch to Sonnet
  • no gateway restart
  • no lcm.db mutation
  • no plugin allow/config mutation

Production remains on openai-codex/gpt-5.5.

extent analysis

TL;DR

The issue is likely due to a transport integration problem between Lossless Claw's simple-completion summarizer path and OpenClaw's claude-cli provider, and a workaround may involve adjusting the baseUrl or api configuration for the claude-cli provider.

Guidance

  • Verify that the claude-cli provider is correctly configured in the OpenClaw settings, specifically the baseUrl and api fields.
  • Check the network connectivity and firewall rules to ensure that the cli://claude transport is allowed and functioning correctly.
  • Consider adjusting the baseUrl or api configuration for the claude-cli provider to see if it resolves the connection error.
  • Review the OpenClaw and Lossless Claw documentation to ensure that the claude-cli provider is supported and properly integrated.

Example

No code example is provided as the issue seems to be related to configuration and transport integration rather than code.

Notes

The issue may be specific to the claude-cli provider and the cli://claude transport, and further investigation is needed to determine the root cause. The fact that the raw Sonnet CLI succeeds and OpenClaw runtime auth lookup works suggests that the issue is likely related to the integration between Lossless Claw and OpenClaw.

Recommendation

Apply a workaround by adjusting the baseUrl or api configuration for the claude-cli provider, as this may resolve the connection error and allow the completeSimple function to work correctly.

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 Lossless/pi-ai `completeSimple` fails with `Connection error` for OpenClaw `claude-cli` Sonnet transport [1 participants]