Bug Description
The edit tool's parameter validation treats empty string "" and whitespace-only strings (e.g., "\n") as missing parameters, returning:
Missing required parameter: newText (newText or new_string)
This happens even though the model correctly sends newText in the tool call arguments. The validation appears to use a falsy check (if (!newText)) instead of a proper null/undefined check (=== undefined || === null).
Reproduction
When the model (tested with openai-codex/gpt-5.2) sends an edit tool call to delete a line:
{
"path": "some/file.kt",
"oldText": "import kotlinx.serialization.json.Json\n",
"newText": ""
}
Gateway returns error: Missing required parameter: newText (newText or new_string)
Similarly fails with newText: "\n".
However, a non-empty replacement like newText: "// removed\n" succeeds.
Evidence
From session logs, 6 consecutive failures all with the same pattern:
| newText value |
Result |
"" (empty string) |
Error - Missing required parameter |
"" (empty string) |
Error - Missing required parameter |
"" (empty string) |
Error - Missing required parameter |
"" (empty string) |
Error - Missing required parameter |
"\n" (newline only) |
Error - Missing required parameter |
"// import ... (unused)\n" |
Success |
Expected Behavior
newText: "" should be a valid value, as it represents deletion of the matched oldText content (a common edit operation).
Environment
- OpenClaw version:
2026.2.13 (npm installed)
- Config version:
2026.2.12
- Model:
openai-codex/gpt-5.2
- Platform: Windows 11
- Gateway mode: local
Suggested Fix
In the edit tool parameter validation, change from falsy check to explicit null/undefined check:
- if (!newText) {
+ if (newText === undefined || newText === null) {
throw new Error('Missing required parameter: newText (newText or new_string)');
}
Bug Description
The
edittool's parameter validation treats empty string""and whitespace-only strings (e.g.,"\n") as missing parameters, returning:This happens even though the model correctly sends
newTextin the tool call arguments. The validation appears to use a falsy check (if (!newText)) instead of a proper null/undefined check (=== undefined || === null).Reproduction
When the model (tested with
openai-codex/gpt-5.2) sends an edit tool call to delete a line:{ "path": "some/file.kt", "oldText": "import kotlinx.serialization.json.Json\n", "newText": "" }Gateway returns error:
Missing required parameter: newText (newText or new_string)Similarly fails with
newText: "\n".However, a non-empty replacement like
newText: "// removed\n"succeeds.Evidence
From session logs, 6 consecutive failures all with the same pattern:
""(empty string)""(empty string)""(empty string)""(empty string)"\n"(newline only)"// import ... (unused)\n"Expected Behavior
newText: ""should be a valid value, as it represents deletion of the matchedoldTextcontent (a common edit operation).Environment
2026.2.13(npm installed)2026.2.12openai-codex/gpt-5.2Suggested Fix
In the edit tool parameter validation, change from falsy check to explicit null/undefined check: