#Thanks!
1 messages · Page 1 of 1 (latest)
- Keep one canonical required parameter in the outbound schema
For read, that should be path.
Do not remove path from required just because aliases exist. Aliases should be accepted on input, but the schema shown to the model should still strongly communicate one required field. Kimi’s own docs explicitly show required as the way to tell the model which parameters are mandatory.
Best pattern:
outbound schema to model:
properties.path
required: ["path"]
inbound runtime normalization:
accept path | file_path | filePath | file
That gives the model a single strong target, while still being tolerant of variant spellings at execution time.
- Normalize aliases before validation
At runtime, convert alias inputs into a canonical shape first, then validate.
For example:
function normalizeReadArgs(args: Record<string, unknown>) {
const path =
typeof args.path === "string" && args.path.trim() ? args.path :
typeof args.file_path === "string" && args.file_path.trim() ? args.file_path :
typeof args.filePath === "string" && args.filePath.trim() ? args.filePath :
typeof args.file === "string" && args.file.trim() ? args.file :
undefined;
return path ? { path } : {};
}
Then validate the normalized output:
const normalized = normalizeReadArgs(args);
if (!normalized.path) {
return toolInputError("read", "Missing required parameter: path");
}
This also protects you from the older alias bugs OpenClaw has already seen, where path and file_path drifted between schema and handler expectations.
- Do not apply the Claude-compatibility schema patch to Kimi/OpenAI-style providers
This is probably the most important structural fix.
If patchToolSchemaForClaudeCompatibility is broadening aliases and clearing required, it should be gated so it only applies on the provider path that actually needs it. OpenClaw has at least one Kimi-specific issue describing failures after the 2026.2.12-era changes, and another issue showing empty {} arguments in Kimi sessions.
So the patch logic should look more like:
if (provider.family === "anthropic") {
schema = patchToolSchemaForClaudeCompatibility(schema);
}
and not run for:
Moonshot / Kimi OpenAI-compatible
other OpenAI-style providers
local OpenAI-compatible adapters
- Treat {} as a terminal tool-input error, not a retryable execution failure
Your loop every ~3 seconds is a separate defect.
If the tool call arguments are empty, repeating the same call without changing the prompt or schema is not useful. OpenClaw has other reports where repeated invalid tool invocations spiral until loop protection kicks in.
Recommended behavior:
if arguments normalize to empty and required fields are absent:
return a structured tool-input error once
mark the call as non-retryable
ask the model to regenerate arguments only if the orchestration layer can actually alter context
For example:
return {
status: "error",
type: "tool_input_error",
retryable: false,
message: "Tool 'read' requires 'path'."
};
- Add a one-shot repair path for empty args
Instead of blind retries, do one targeted regeneration turn:
“Your previous tool call for read had empty arguments {}. Reissue the tool call with a JSON object containing the required path string.”
Then stop if it fails again.
This is useful because one OpenClaw report shows Kimi sometimes goes from {} to an empty string and then finally to a valid path on retry, which suggests a single repair turn can help, but repeated blind retries are harmful.
- Tighten tool descriptions so the model knows what to emit
Kimi’s docs emphasize that description and parameter descriptions help the model generate the right arguments.
For read, use something explicit:
{
"type": "object",
"required": ["path"],
"properties": {
"path": {
"type": "string",
"description": "Required. Absolute or workspace-relative file path to read."
}
}
}
Avoid surfacing multiple equivalent names in the schema unless you have clear evidence that the provider benefits from it.
The patch I would recommend
In practice, I would implement this:
Revert the Kimi/OpenAI-visible tool schema for read, edit, write, lcm_grep to a single canonical required parameter set.
Keep aliases only in the server-side input normalizer.
Run patchToolSchemaForClaudeCompatibility only on Anthropic/Claude paths.
Mark missing-required-field errors as non-retryable.
Allow at most one structured repair turn for {}.
Thanks, this analysis matches exactly what we found. The issue is that patchToolSchemaForClaudeCompatibility runs on our kimi-coding provider path too.
We can't patch the gateway binary ourselves. Is there a config option to disable the Claude compatibility schema patch for specific providers? Or a way to force required: ["path"] in the outbound tool schema?
We also tried switching kimi-coding from anthropic-messages to openai-completions API adapter — that improved things (read/write work, but edit still occasionally fails). Does the openai-completions path skip the Claude compatibility patch?
Should we file a GitHub issue for this?