[PR #12854] fix(opencode): ACP File write should create the file if it doesn't exist #14402

Closed
opened 2026-02-16 18:19:12 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12854

State: closed
Merged: Yes


Fixes #12850

What does this PR do?

File creation through the ACP interface was not working, as it tried to read the file before writing it, even if it didn't exist

Bun.file() can be constructed on a file that doesn't exist, but reading the file will throw a NOENT error.

Now, we only read the file if it exists, setting content to emptystring otherwise.

How did you verify your code works?

Ran ACP through CodeCompanion.nvim, and had it create a file.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12854 **State:** closed **Merged:** Yes --- Fixes #12850 ### What does this PR do? File creation through the ACP interface was not working, as it tried to read the file before writing it, even if it didn't exist Bun.file() can be constructed on a file that doesn't exist, but reading the file will throw a NOENT error. Now, we only read the file if it exists, setting content to emptystring otherwise. ### How did you verify your code works? Ran ACP through CodeCompanion.nvim, and had it create a file.
yindo added the pull-request label 2026-02-16 18:19:12 -05:00
yindo closed this issue 2026-02-16 18:19:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14402