zed icon indicating copy to clipboard operation
zed copied to clipboard

Agent Panel: zed decides to use cat to modify source

Open alex opened this issue 7 months ago • 1 comments

Summary

I don't really know how or why this is happening, but sometimes zed will decide it can't edit code with its builtin tools, so instead it will fall back to using a shell exec of cat to edit code.

Image

This is annoying because it has to prompt for permissions for the shell exec.

I think this may reflect an issue with the editing tools, though I have no idea what.

This is using claude sonnet 3.7 via github copilot chat.

Zed Version and System Specs

Zed: v0.185.15 (Zed) OS: macOS 15.4.1 Memory: 64 GiB Architecture: aarch64

alex avatar May 11 '25 22:05 alex

I experienced something similar. In "ask" profile, that don't have permissions to write files, zed try to modified anyway with cli commands.

eulke avatar May 12 '25 02:05 eulke

Ouch that's not good. Thanks for reporting.

notpeter avatar May 20 '25 22:05 notpeter

The Ask profile doesn't have the terminal tool enabled.

So one of two things is almost certainly happening:

  1. You've modified their Ask profile to enable the terminal tool, in which case it's working as expected
  2. The agent hallucinated its own ability to run a terminal command, and printed out cat foo.txt > bar with shell formatting, which looks like real tool call.

The "model concluding edit_file is broken after too many failed edit attempts and gives up and falls back on terminal" is a longstanding known behavior (particularly with newer models which have been fine tuned to try to more aggressively use tool calls) but not something we have a solution to at this time.

Thanks for reporting.

notpeter avatar May 20 '25 22:05 notpeter

My original report was not using the ask profile, it was the write profile.

alex avatar May 20 '25 22:05 alex