Bug type
Behavior bug (incorrect output/state without crash)
Summary
The function isRawToolCallBlock in the session history repair logic only recognizes camelCase tool call block types (toolUse, toolCall, functionCall), but does NOT handle the snake_case variants used by Anthropic and some other providers (tool_use, tool_call, function_call).
This causes repairToolCallInputs - which is supposed to sanitize corrupted history before sending to the model - to silently skip over broken tool_use blocks that are missing their input field.
Root Cause
In reply-Bm8VrLQh.js, the function:
function isRawToolCallBlock(block) {
if (!block || typeof block !== "object") return false;
const type = block.type;
return typeof type === "string" && (type === "toolCall" || type === "toolUse" || type === "functionCall");
}
Proposed Fix
function isRawToolCallBlock(block) {
if (!block || typeof block !== "object") return false;
const type = block.type;
return typeof type === "string" && (
type === "toolCall" || type === "toolUse" || type === "functionCall" ||
type === "tool_call" || type === "tool_use" || type === "function_call"
);
}
Impact
Users in Feishu groups experience persistent "corrupted session" errors that /new cannot reliably resolve, because the broken block survives the sanitization pass every time.
Steps to reproduce
- Use OpenClaw with Anthropic as provider in a Feishu group chat.
-
- A streamed tool call response is interrupted mid-stream (e.g., timeout, abort), leaving a tool_use block persisted in the session transcript without an input field.
-
- On the next message (even after /new), the history is loaded and passed through repairToolCallInputs, but the broken block is not detected because its type "tool_use" doesn't match the check.
-
- Anthropic's API rejects the request with: messages.N.content.N.tool_use.input: field required
-
- OpenClaw surfaces this as: "Session history looks corrupted (tool call input missing). Use /new to start a fresh session."
Expected behavior
The session history should be correctly repaired/sanitized, and Anthropic API should not reject the request due to missing input fields.
Actual behavior
The broken tool_use block is skipped during repair, leading to a "field required" error from Anthropic and a "Session history looks corrupted" error in OpenClaw.
OpenClaw version
2026.3.13
Operating system
macOS
Install method
npm global
Model
anthropic/claude-sonnet-4.5
Provider / routing chain
openclaw -> anthropic
Config file / key location
No response
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
Affected: Feishu group chat users using Anthropic as provider.
Severity: High (blocks workflow, persistent "corrupted session" errors).
Frequency: Always (reproducible when tool calls are interrupted).
Consequence: Agent cannot respond even after /new if broken content is in history.
Additional information
No response
Bug type
Behavior bug (incorrect output/state without crash)
Summary
The function isRawToolCallBlock in the session history repair logic only recognizes camelCase tool call block types (toolUse, toolCall, functionCall), but does NOT handle the snake_case variants used by Anthropic and some other providers (tool_use, tool_call, function_call).
This causes repairToolCallInputs - which is supposed to sanitize corrupted history before sending to the model - to silently skip over broken tool_use blocks that are missing their input field.
Root Cause
In reply-Bm8VrLQh.js, the function:
Proposed Fix
Impact
Users in Feishu groups experience persistent "corrupted session" errors that /new cannot reliably resolve, because the broken block survives the sanitization pass every time.
Steps to reproduce
Expected behavior
The session history should be correctly repaired/sanitized, and Anthropic API should not reject the request due to missing input fields.
Actual behavior
The broken tool_use block is skipped during repair, leading to a "field required" error from Anthropic and a "Session history looks corrupted" error in OpenClaw.
OpenClaw version
2026.3.13
Operating system
macOS
Install method
npm global
Model
anthropic/claude-sonnet-4.5
Provider / routing chain
openclaw -> anthropic
Config file / key location
No response
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
Affected: Feishu group chat users using Anthropic as provider.
Severity: High (blocks workflow, persistent "corrupted session" errors).
Frequency: Always (reproducible when tool calls are interrupted).
Consequence: Agent cannot respond even after /new if broken content is in history.
Additional information
No response