openclaw - ✅(Solved) Fix [Bug]: Custom OpenAI-compatible provider returns valid assistant content, but embedded agent ends with `payloads=0` / "Agent couldn't generate a response" [1 pull requests]

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…

With a custom OpenAI-compatible provider, OpenClaw receives a valid assistant response from the backend, but the embedded agent still ends the turn with payloads=0 and shows “Agent couldn't generate a response.”

Error Message

[agent/embedded] incomplete turn detected: runId=... sessionId=... stopReason=stop payloads=0 — surfacing error to user

Root Cause

With a custom OpenAI-compatible provider, OpenClaw receives a valid assistant response from the backend, but the embedded agent still ends the turn with payloads=0 and shows “Agent couldn't generate a response.”

PR fix notes

PR #69724: fix: ensure assistantTexts populated at message_end for custom providers (#69410)

Description (problem / solution / changelog)

问题

#69410:Custom provider 返回有效内容但 agent payloads=0。

根因

finalizeAssistantTexts 中当 onBlockReply 存在时(标准 agent 调用),else if (!addedDuringMessage && !chunkerHasBuffered && text) 不满足,因为第一个分支条件不满足。custom provider 场景下流式文本未加入 assistantTexts,message_end 提取的文本两个分支都不满足 → assistantTexts 空 → payloads=0

修复

else if 改为独立 if,确保 message_end 文本无条件加入 assistantTexts

测试覆盖

3 tests passed (21ms).

Changed files

  • extensions/browser/src/browser/pw-session.test.ts (modified, +75/-0)
  • extensions/browser/src/browser/pw-session.ts (modified, +65/-0)
  • extensions/browser/src/browser/pw-tools-core.browser-ssrf-guard.test.ts (modified, +1/-0)
  • extensions/browser/src/browser/pw-tools-core.snapshot.ts (modified, +10/-1)
  • src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.custom-provider-payloads.test.ts (added, +113/-0)
  • src/agents/pi-embedded-subscribe.ts (modified, +5/-3)
  • src/agents/sandbox/remote-fs-bridge.test.ts (modified, +57/-0)
  • src/agents/sandbox/remote-fs-bridge.ts (modified, +16/-2)
  • src/tasks/task-registry.audit.test.ts (modified, +26/-0)
  • src/tasks/task-registry.ts (modified, +6/-3)

Code Example

Gateway log:
[agent/embedded] incomplete turn detected: runId=... sessionId=... stopReason=stop payloads=0 — surfacing error to user
⚠️ Agent couldn't generate a response. Please try again.

CLI output:
openclaw agent --agent main --message "Antworte nur mit OK"
⚠️ Agent couldn't generate a response. Please try again.

Backend log excerpt:
Request received: /v1/chat/completions
Incoming body keys: ['model', 'messages', 'stream', 'store', 'max_completion_tokens', 'tools']
Incoming path: /v1/chat/completions
Sanitized payload keys: ['model', 'messages', 'max_tokens', 'temperature', 'stream']
Sanitized message count: 2
Sanitized max_tokens: 64
Sanitized message 1: role=system content='You are a personal assistant running inside OpenClaw...'
Sanitized message 2: role=user content='[Mon 2026-04-20 13:13 GMT+2] Antworte nur mit OK'
Upstream response keys: ['id', 'system_fingerprint', 'object', 'model', 'created', 'choices', 'usage']
Upstream first choice keys: ['index', 'finish_reason', 'message']
Assistant content preview: 'OK'
Request finished (11.63s)

Direct backend calls to /v1/completions and /v1/chat/completions succeed.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

With a custom OpenAI-compatible provider, OpenClaw receives a valid assistant response from the backend, but the embedded agent still ends the turn with payloads=0 and shows “Agent couldn't generate a response.”

Steps to reproduce

  1. Configure a custom OpenAI-compatible provider in ~/.openclaw/openclaw.json pointing to a local proxy/backend.
  2. Ensure the backend returns a valid assistant response for both /v1/completions and /v1/chat/completions.
  3. Start the gateway: openclaw gateway --bind lan
  4. Run: openclaw agent --agent main --message "Antworte nur mit OK"
  5. Observe that the backend logs a valid assistant response (OK), but OpenClaw ends with: Agent couldn't generate a response. Please try again.
  6. Confirm gateway log shows: incomplete turn detected ... payloads=0

Expected behavior

If the custom provider returns a valid assistant chat completion with content "OK", OpenClaw should surface "OK" as the agent reply.

Actual behavior

OpenClaw does not surface the assistant reply. Instead, the turn ends with:

  • incomplete turn detected ... payloads=0
  • Agent couldn't generate a response. Please try again.

OpenClaw version

2026.4.19-beta.1

Operating system

macOS 15.x

Install method

npm install -g openclaw

Model

seppi-llm/mlx-community/Qwen2.5-14B-Instruct-4bit

Provider / routing chain

openclaw -> custom OpenAI-compatible provider -> local proxy -> mlx_lm.server

Additional provider/model setup details

Custom provider configured in ~/.openclaw/openclaw.json.

OpenClaw runs on a Mac mini. The provider points to a local OpenAI-compatible proxy running on a MacBook Pro: http://192.168.1.36:47000/v1

The proxy sanitizes incoming OpenClaw chat/completions requests and forwards them to mlx_lm.server.

Backend model: mlx-community/Qwen2.5-14B-Instruct-4bit

Important observation: the backend logs the final assistant content ('OK') before OpenClaw reports payloads=0.

Logs, screenshots, and evidence

Gateway log:
[agent/embedded] incomplete turn detected: runId=... sessionId=... stopReason=stop payloads=0 — surfacing error to user
⚠️ Agent couldn't generate a response. Please try again.

CLI output:
openclaw agent --agent main --message "Antworte nur mit OK"
⚠️ Agent couldn't generate a response. Please try again.

Backend log excerpt:
Request received: /v1/chat/completions
Incoming body keys: ['model', 'messages', 'stream', 'store', 'max_completion_tokens', 'tools']
Incoming path: /v1/chat/completions
Sanitized payload keys: ['model', 'messages', 'max_tokens', 'temperature', 'stream']
Sanitized message count: 2
Sanitized max_tokens: 64
Sanitized message 1: role=system content='You are a personal assistant running inside OpenClaw...'
Sanitized message 2: role=user content='[Mon 2026-04-20 13:13 GMT+2] Antworte nur mit OK'
Upstream response keys: ['id', 'system_fingerprint', 'object', 'model', 'created', 'choices', 'usage']
Upstream first choice keys: ['index', 'finish_reason', 'message']
Assistant content preview: 'OK'
Request finished (11.63s)

Direct backend calls to /v1/completions and /v1/chat/completions succeed.

Impact and severity

Affected: Users of custom OpenAI-compatible providers in OpenClaw embedded agent flows. Severity: High (agent replies are lost even though the backend returns valid assistant content). Frequency: Reproduced consistently in my setup. Consequence: The agent does not surface a visible reply and the turn ends with payloads=0.

Additional information

Reproduced on:

  • 2026.3.8
  • 2026.4.14
  • 2026.4.19-beta.1

Direct backend calls succeed, including /v1/completions and /v1/chat/completions.

The backend logs the final assistant content ('OK') before OpenClaw reports payloads=0.

This appears to be an embedded-agent reply assembly / payload extraction issue for custom OpenAI-compatible providers, not a backend inference failure.

extent analysis

TL;DR

The issue is likely due to a payload extraction or reply assembly problem in OpenClaw's embedded agent when using a custom OpenAI-compatible provider, and a workaround may involve verifying the payload handling in the custom provider or the OpenClaw configuration.

Guidance

  1. Verify payload handling: Check the custom OpenAI-compatible provider's implementation to ensure it correctly handles and returns payloads from the backend, especially for /v1/chat/completions requests.
  2. Review OpenClaw configuration: Confirm that the OpenClaw configuration in ~/.openclaw/openclaw.json is correctly set up for the custom provider, including any necessary settings for payload extraction or reply assembly.
  3. Compare backend and OpenClaw logs: Analyze the backend logs and OpenClaw logs to identify any discrepancies in the payload handling or reply assembly process that could indicate where the issue lies.
  4. Test with a standard provider: If possible, test OpenClaw with a standard OpenAI provider to see if the issue is specific to the custom provider or a more general problem with OpenClaw's embedded agent.

Example

No specific code example can be provided without more details on the custom provider's implementation or the OpenClaw configuration. However, ensuring that the custom provider correctly returns a payload with the assistant's response, such as {"choices": [{"text": "OK"}]}, could be a starting point for investigation.

Notes

The issue seems specific to the interaction between OpenClaw's embedded agent and custom OpenAI-compatible providers. The fact that direct backend calls succeed suggests the problem lies in how OpenClaw handles the response from the custom provider.

Recommendation

Apply a workaround by closely inspecting and potentially adjusting the custom provider's payload handling or the OpenClaw configuration to ensure correct reply assembly and payload extraction. This approach is recommended because the issue appears to be related to the specific setup and interaction between OpenClaw and the custom provider, rather than a general problem with OpenClaw or the backend model.

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 custom provider returns a valid assistant chat completion with content "OK", OpenClaw should surface "OK" as the agent reply.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING