Skip to content

fix file_edit dropping an explicit empty new_string - #3048

Merged
RaajeevChandran merged 1 commit into
mainfrom
fix/file-edit-empty-new-string
Oct 8, 2026
Merged

RaajeevChandran merged 1 commit into
mainfrom
fix/file-edit-empty-new-string

Conversation

@RaajeevChandran

Copy link
Copy Markdown
Contributor

Resolves #3031

  • file_edit rejected new_string: "" with "old_string given without new_string", even though "" is the documented way to delete a match
  • Root cause: SchemaValidator.dropEmptyOptionalStrings runs during preflight and removes optional string arguments that are empty. new_string is optional because the edits batch form exists, so it was removed before FileEditTool ever saw it
  • PR Harden file-edit tools for document drafting (Raptor + grok-4.3 proof) #2914 added the empty new_string handling inside FileEditTool, but its tests called the tool directly and never went through preflight, so the bug was never caught
  • Added preservedEmptyStringArguments to OsaurusTool (default empty). ToolRegistry.preflight passes it into coerceArguments(preservingEmpty:) and those arguments keep their empty value
  • Host file_edit keeps new_string. Sandbox file_write keeps new_string and content, which also fixes the documented content: "" truncate to an empty file
  • The wire schema is unchanged, so tool definitions sent to providers and the prompt prefix stay the same
  • Tests: a coercion unit test for preservingEmpty, plus a FileEditBatchTests case that runs the reporter's exact repro through preflight and then the tool

Changes

  • Behavior change
  • UI change (screenshots below)
  • Refactor / chore
  • Tests
  • Docs

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

@github-actions github-actions Bot added the bug Something isn't working label Oct 8, 2026
@RaajeevChandran
RaajeevChandran merged commit 41cc89e into main Oct 8, 2026
9 checks passed
@RaajeevChandran
RaajeevChandran deleted the fix/file-edit-empty-new-string branch October 8, 2026 14:21
@jjang-ai

jjang-ai commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This merged after the 0.25.20 tag was created, so it is not included in the 0.25.20 binary. The release workflow read the mutable draft later and accidentally listed/marked it released. I removed the incorrect public release note and restored pending release; #3049 corrects the same line in the appcast. Your fix remains merged for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pending release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

file_edit drops explicit empty new_string and cannot delete a unique match

2 participants