openclaw - ✅(Solved) Fix [Bug]: Bug Report: OpenClaw 2026.3.11 breaks all Tool Execution for `moonshotai/kimi-k2.5` via `openai-completions` [2 pull requests, 4 comments, 3 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#44549Fetched 2026-04-08 00:45:23
View on GitHub
Comments
4
Participants
3
Timeline
19
Reactions
0
Timeline (top)
subscribed ×7commented ×4cross-referenced ×3mentioned ×3

When using moonshotai/kimi-k2.5 (via NVIDIA NIM, api: openai-completions) as the primary agent in OpenClaw 2026.3.11, the agent completely fails to parse and execute any tools (including read, exec, web_search, etc.).

Error Message

Instead of correctly invoking the tool payload, Kimi leaks raw, hallucinatory tokens directly into the response (e.g. functionsweb_search53b7ac... or functionsessions_spawn...), causing the Gateway to reject the attempt with an error like Tool unknown not found.

Root Cause

When using moonshotai/kimi-k2.5 (via NVIDIA NIM, api: openai-completions) as the primary agent in OpenClaw 2026.3.11, the agent completely fails to parse and execute any tools (including read, exec, web_search, etc.).

Fix Action

Fix / Workaround

Environment:

  • OS: Linux
    • Model: nvidia-kimi/moonshotai/kimi-k2.5
      • Last known working version: 2026.2.25 Additional Context: The bug 400 This model only supports single tool-calls at once! originally reported and supposedly fixed by PR #39356 is a symptom of this. Even when the Gateway blocks parallel tool calls, Kimi physically cannot understand the new bloated tool schemas (specifically sessions_spawn and the overall schema payload) in v3.11, causing the payload generation to crash natively on the LLM side. We had to forcefully downgrade to 2026.2.25 to restore productivity.

PR fix notes

PR #2: OpenClaw 紧急未修复

Description (problem / solution / changelog)

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: The Gateway crashes with an unhandled promise rejection when the Discord API returns a 503 error, as response.json() is called without checking response.ok.
  • Why it matters: This causes the entire gateway process to exit, leading to a complete service interruption for all connected Discord channels for several minutes.
  • What changed: Added a check for response.ok before attempting to parse the JSON response. Errors are now emitted via this.emitter.emit("error") and this.handleReconnectionAttempt() is called to trigger a graceful reconnection attempt, preventing a full process crash. Updated tests to cover the 503 error path.
  • What did NOT change (scope boundary): Other identified issues (#44544, #44611, #44562, #44549) were either already fixed, determined not to be code bugs, or required a dedicated test environment for safe implementation and are not part of this PR.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #44529
  • Related #

User-visible / Behavior Changes

The gateway will no longer crash when the Discord API returns a 503 error during client registration. Instead, it will log the error and attempt to reconnect gracefully.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: Linux (typical Node.js environment)
  • Runtime/container: Node.js
  • Model/provider: N/A
  • Integration/channel (if any): Discord
  • Relevant config (redacted): N/A

Steps

  1. Configure OpenClaw Gateway with a Discord integration.
  2. During the GatewayPlugin.registerClient() call (e.g., when the health monitor triggers a Discord bot reconnection), simulate a Discord API returning a 503 HTTP status code with a non-JSON body.
  3. Observe the gateway process.

Expected

  • The gateway logs an error about the Discord 503 response.
  • The gateway attempts to reconnect to Discord without crashing the entire Node.js process.

Actual

  • The gateway process crashes with an unhandled promise rejection.

Evidence

  • Failing test/log before + passing after (New test should handle 503 response gracefully without crashing added to provider.proxy.test.ts which now passes.)
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Added and passed a new unit test specifically for the 503 error case in provider.proxy.test.ts, ensuring the response.ok check and error handling logic are correctly implemented.
  • Edge cases checked: Specifically addressed the case where response.json() would throw an error on a non-2xx response.
  • What you did not verify: Did not verify in a live production environment with an actual Discord 503 error.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert this PR.
  • Files/config to restore: N/A
  • Known bad symptoms reviewers should watch for: Gateway still crashing on Discord 503, or Discord reconnection issues.

Risks and Mitigations

  • Risk: The error handling or reconnection logic might not fully cover all edge cases of Discord API errors.
    • Mitigation: The current fix addresses the immediate crash by preventing response.json() on bad responses and uses existing reconnection mechanisms. Further monitoring of Discord integration health is always recommended.
<div><a href="https://cursor.com/agents/bc-7023bdfd-1d36-48c0-818c-2346ec9378b5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-7023bdfd-1d36-48c0-818c-2346ec9378b5"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div> <!-- CURSOR_AGENT_PR_BODY_END -->

Changed files

  • .detect-secrets.cfg (modified, +19/-4)
  • .github/FUNDING.yml (removed, +0/-1)
  • .github/ISSUE_TEMPLATE/bug_report.yml (modified, +31/-0)
  • .github/actions/ensure-base-commit/action.yml (added, +47/-0)
  • .github/actions/setup-node-env/action.yml (modified, +8/-4)
  • .github/actions/setup-pnpm-store-cache/action.yml (modified, +9/-7)
  • .github/codeql/codeql-javascript-typescript.yml (added, +18/-0)
  • .github/pull_request_template.md (modified, +7/-0)
  • .github/workflows/auto-response.yml (modified, +55/-0)
  • .github/workflows/ci.yml (modified, +85/-50)
  • .github/workflows/codeql.yml (added, +134/-0)
  • .github/workflows/docker-release.yml (modified, +77/-10)
  • .github/workflows/install-smoke.yml (modified, +63/-19)
  • .github/workflows/labeler.yml (modified, +256/-82)
  • .github/workflows/openclaw-npm-release.yml (added, +79/-0)
  • .github/workflows/sandbox-common-smoke.yml (modified, +1/-1)
  • .github/workflows/stale.yml (modified, +62/-3)
  • .gitignore (modified, +10/-0)
  • .npmignore (added, +1/-0)
  • .pi/prompts/reviewpr.md (modified, +37/-8)
  • .pre-commit-config.yaml (modified, +27/-1)
  • .secrets.baseline (modified, +229/-316)
  • .swiftformat (modified, +1/-1)
  • .swiftlint.yml (modified, +3/-1)
  • AGENTS.md (modified, +38/-0)
  • CHANGELOG.md (modified, +717/-137)
  • CONTRIBUTING.md (modified, +36/-4)
  • Dockerfile (modified, +165/-50)
  • Dockerfile.sandbox (modified, +6/-3)
  • Dockerfile.sandbox-browser (modified, +7/-5)
  • Dockerfile.sandbox-common (modified, +6/-4)
  • README.md (modified, +1/-1)
  • SECURITY.md (modified, +9/-0)
  • appcast.xml (modified, +499/-328)
  • apps/android/README.md (modified, +1/-1)
  • apps/android/app/build.gradle.kts (modified, +49/-4)
  • apps/android/app/proguard-rules.pro (modified, +1/-1)
  • apps/android/app/src/main/AndroidManifest.xml (modified, +1/-9)
  • apps/android/app/src/main/java/ai/openclaw/android/InstallResultReceiver.kt (removed, +0/-33)
  • apps/android/app/src/main/java/ai/openclaw/android/ScreenCaptureRequester.kt (removed, +0/-65)
  • apps/android/app/src/main/java/ai/openclaw/android/node/AppUpdateHandler.kt (removed, +0/-295)
  • apps/android/app/src/main/java/ai/openclaw/android/node/ScreenHandler.kt (removed, +0/-25)
  • apps/android/app/src/main/java/ai/openclaw/android/node/ScreenRecordManager.kt (removed, +0/-165)
  • apps/android/app/src/main/java/ai/openclaw/app/CameraHudState.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/DeviceNames.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/LocationMode.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/MainActivity.kt (renamed, +3/-7)
  • apps/android/app/src/main/java/ai/openclaw/app/MainViewModel.kt (renamed, +11/-10)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeApp.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeForegroundService.kt (renamed, +6/-28)
  • apps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.kt (renamed, +64/-44)
  • apps/android/app/src/main/java/ai/openclaw/app/PermissionRequester.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/SecurePrefs.kt (renamed, +45/-6)
  • apps/android/app/src/main/java/ai/openclaw/app/SessionKey.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/VoiceWakeMode.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/WakeWords.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/chat/ChatModels.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/BonjourEscapes.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceAuthPayload.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceAuthStore.kt (renamed, +4/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceIdentityStore.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayDiscovery.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayEndpoint.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewaySession.kt (renamed, +225/-20)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayTls.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/gateway/InvokeErrorParser.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/A2UIHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CalendarHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CameraCaptureManager.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CameraHandler.kt (renamed, +4/-4)
  • apps/android/app/src/main/java/ai/openclaw/app/node/CanvasController.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/ConnectionManager.kt (renamed, +9/-9)
  • apps/android/app/src/main/java/ai/openclaw/app/node/ContactsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DebugHandler.kt (renamed, +4/-4)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt (renamed, +3/-18)
  • apps/android/app/src/main/java/ai/openclaw/app/node/DeviceNotificationListenerService.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/GatewayEventHandler.kt (renamed, +3/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/node/InvokeCommandRegistry.kt (renamed, +14/-22)
  • apps/android/app/src/main/java/ai/openclaw/app/node/InvokeDispatcher.kt (renamed, +14/-24)
  • apps/android/app/src/main/java/ai/openclaw/app/node/JpegSizeLimiter.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/LocationCaptureManager.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/node/LocationHandler.kt (renamed, +4/-20)
  • apps/android/app/src/main/java/ai/openclaw/app/node/MotionHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/NodeUtils.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/NotificationsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SmsHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SmsManager.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/node/SystemHandler.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/protocol/OpenClawCanvasA2UIAction.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/protocol/OpenClawProtocolConstants.kt (renamed, +1/-12)
  • apps/android/app/src/main/java/ai/openclaw/app/tools/ToolDisplay.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/CameraHudOverlay.kt (renamed, +1/-1)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/CanvasScreen.kt (renamed, +2/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/ChatSheet.kt (renamed, +3/-3)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/ConnectTabScreen.kt (renamed, +5/-2)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/GatewayConfigResolver.kt (renamed, +24/-6)
  • apps/android/app/src/main/java/ai/openclaw/app/ui/MobileUiTokens.kt (renamed, +2/-2)

PR #44888: fix(agents): compact Kimi tool schemas for openai-completions

Description (problem / solution / changelog)

Fixes #44549

Summary

Kimi models behind OpenAI-compatible providers started failing tool calls after the 2026.3.x tool-schema growth, especially on sessions_spawn and other large tool payloads. Compared with v2026.2.25, the current function schemas carry substantially more metadata and heavyweight optional branches, which appears to push kimi-k2.5 into emitting malformed tool calls instead of standard OpenAI function-call payloads.

This change adds a Kimi-specific schema compaction pass for OpenAI-compatible tool payloads:

  • strip verbose JSON Schema metadata and validation noise before sending tools to Kimi-compatible models
  • omit the heaviest optional sessions_spawn branches (resumeSessionId, attachments, attachAs) for those models
  • keep the full schema shape for other providers/models

Why this approach

This keeps the 2026.3.x feature set intact for providers that handle the richer schemas correctly, while sending a smaller and more stable function schema to Kimi-compatible backends that regress on the larger payload.

Verification

Ran targeted regression checks:

  • pnpm exec oxfmt --check src/agents/schema/clean-for-kimi.ts src/agents/schema/clean-for-kimi.test.ts src/agents/pi-tools.schema.ts src/agents/pi-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping.test.ts
  • pnpm exec vitest run src/agents/schema/clean-for-kimi.test.ts src/agents/pi-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping.test.ts -t "clean-for-kimi|compacts tool schemas for Kimi-compatible OpenAI models"

Notes

AI-assisted: implemented with Codex.

Changed files

  • src/agents/pi-tools.create-openclaw-coding-tools.adds-claude-style-aliases-schemas-without-dropping.test.ts (modified, +36/-0)
  • src/agents/pi-tools.schema.ts (modified, +9/-3)
  • src/agents/schema/clean-for-kimi.test.ts (added, +154/-0)
  • src/agents/schema/clean-for-kimi.ts (added, +203/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

When using moonshotai/kimi-k2.5 (via NVIDIA NIM, api: openai-completions) as the primary agent in OpenClaw 2026.3.11, the agent completely fails to parse and execute any tools (including read, exec, web_search, etc.).

Steps to reproduce

  1. Configure moonshotai/kimi-k2.5 as the primary model using NVIDIA NIM (integrate.api.nvidia.com/v1) with api: openai-completions.
    1. Send a prompt that requires tool execution: openclaw agent --message "use the read tool to read MEMORY.md".
    1. The agent fails to use the tool, and the CLI/logs show hallucinated raw function strings instead of standard OpenAI tool schemas.

Expected behavior

The agent should successfully parse the tool schema and invoke the tool, as it did reliably in v2026.2.25. The complex schema expansions introduced in recent 2026.3.x updates seem to instantly break Kimi's ability to format tool calls, returning raw identifiers.

Actual behavior

Instead of correctly invoking the tool payload, Kimi leaks raw, hallucinatory tokens directly into the response (e.g. functionsweb_search53b7ac... or functionsessions_spawn...), causing the Gateway to reject the attempt with an error like Tool unknown not found.

OpenClaw version

2026.3.11

Operating system

Linux

Install method

npm global

Model

nvidia-kimi/moonshotai/kimi-k2.5

Provider / routing chain

openclaw -> NVIDIA NIM

Config file / key location

~/.openclaw/openclaw.json

Additional provider/model setup details

Environment:

  • OS: Linux
    • Model: nvidia-kimi/moonshotai/kimi-k2.5
      • Last known working version: 2026.2.25 Additional Context: The bug 400 This model only supports single tool-calls at once! originally reported and supposedly fixed by PR #39356 is a symptom of this. Even when the Gateway blocks parallel tool calls, Kimi physically cannot understand the new bloated tool schemas (specifically sessions_spawn and the overall schema payload) in v3.11, causing the payload generation to crash natively on the LLM side. We had to forcefully downgrade to 2026.2.25 to restore productivity.

Logs, screenshots, and evidence

Impact and severity

Affected: All users using Kimi-k2.5 via NVIDIA NIM with tool use. Severity: High (completely blocks tool use/agent functionality). Frequency: 100% repro on versions 2026.3.7+. Consequence: Agent cannot perform tasks requiring tools, hallucinates tool calls instead.

Additional information

No response

extent analysis

Fix Plan

To resolve the issue with moonshotai/kimi-k2.5 failing to parse and execute tools in OpenClaw 2026.3.11, we need to update the tool schema handling in the model configuration.

Here are the steps:

  • Update the openclaw.json configuration file to include the correct tool schema for the Kimi-k2.5 model.
  • Modify the tool_schema section to use the legacy schema format compatible with Kimi-k2.5.
  • Add a workaround to limit the model to single tool calls at a time.

Example openclaw.json configuration update:

{
  "model": "nvidia-kimi/moonshotai/kimi-k2.5",
  "tool_schema": {
    "version": "legacy",
    "max_tool_calls": 1
  }
}

Additionally, update the OpenClaw code to handle the legacy tool schema:

# openclaw/tools.py
def get_tool_schema():
    # ...
    if model_name == "nvidia-kimi/moonshotai/kimi-k2.5":
        return legacy_tool_schema
    # ...

Verification

To verify the fix, send a prompt that requires tool execution and check the agent's response. The agent should successfully parse the tool schema and invoke the tool without hallucinating raw function strings.

Example test prompt:

openclaw agent --message "use the read tool to read MEMORY.md"

The agent's response should indicate successful tool execution without any errors.

Extra Tips

  • Monitor the model's performance and adjust the tool_schema configuration as needed to ensure compatibility with future updates.
  • Consider updating the Kimi-k2.5 model to a version that supports the new tool schema format.
  • If issues persist, try downgrading to OpenClaw version 2026.2.25 as a temporary workaround.

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

The agent should successfully parse the tool schema and invoke the tool, as it did reliably in v2026.2.25. The complex schema expansions introduced in recent 2026.3.x updates seem to instantly break Kimi's ability to format tool calls, returning raw identifiers.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING