apply_patch does not trigger formatter #7020

Closed
opened 2026-02-16 18:05:55 -05:00 by yindo · 3 comments
Owner

Originally created by @ranqn on GitHub (Jan 20, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Unlike edit and write, apply_patch does not trigger the formatters after create or edit files.

Plugins

No plugin.

OpenCode version

1.1.28

Steps to reproduce

  1. Configure formatters.
  2. Let GPT 5.2 Codex edit an ill-formatted code file. (apply_patch used)
  3. Notice the code is not formatted correctly.
  4. Manually run the formatter command.
  5. Notice the code is correctly formatted.
  6. Undo, let Claude Opus 4.5 redo the same edit. (edit used)
  7. Notice the code is correctly formatted by the formatter.

Logs

log-gpt-5-2-codex.log

log-opus-4-5.log

Operating System

Windows 11

Terminal

Windows Terminal

Originally created by @ranqn on GitHub (Jan 20, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description Unlike `edit` and `write`, `apply_patch` does not trigger the formatters after create or edit files. ### Plugins No plugin. ### OpenCode version 1.1.28 ### Steps to reproduce 1. Configure formatters. 2. Let GPT 5.2 Codex edit an ill-formatted code file. (`apply_patch` used) 3. Notice the code is not formatted correctly. 4. Manually run the formatter command. 5. Notice the code is correctly formatted. 6. Undo, let Claude Opus 4.5 redo the same edit. (`edit` used) 7. Notice the code is correctly formatted by the formatter. ### Logs [log-gpt-5-2-codex.log](https://github.com/user-attachments/files/24756117/log-gpt-5-2-codex.log) [log-opus-4-5.log](https://github.com/user-attachments/files/24756118/log-opus-4-5.log) ### Operating System Windows 11 ### Terminal Windows Terminal
yindo added the windowsbug labels 2026-02-16 18:05:55 -05:00
yindo closed this issue 2026-02-16 18:05:55 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 20, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #4051: Formatters not running after changes
  • #8387: On file edit it is also formatted (shows that edit tool does trigger formatters)
  • #8045: Opencode Doesn't Abide by Prompt or Run Formatter for Ruby Files

These issues collectively show a pattern of inconsistent formatter behavior across different tools (edit, write, and apply_patch). There may also be related discussions in:

  • #2535: Run formatters only on session end instead of after tool call

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 20, 2026): This issue might be a duplicate of existing issues. Please check: - #4051: Formatters not running after changes - #8387: On file edit it is also formatted (shows that edit tool does trigger formatters) - #8045: Opencode Doesn't Abide by Prompt or Run Formatter for Ruby Files These issues collectively show a pattern of inconsistent formatter behavior across different tools (edit, write, and apply_patch). There may also be related discussions in: - #2535: Run formatters only on session end instead of after tool call Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Jan 20, 2026):

ah

@rekram1-node commented on GitHub (Jan 20, 2026): ah
Author
Owner

@rekram1-node commented on GitHub (Jan 21, 2026):

fixed: https://github.com/anomalyco/opencode/commit/74bd52e8a7454864cc7edf36c87c9dadd68b2998

@rekram1-node commented on GitHub (Jan 21, 2026): fixed: https://github.com/anomalyco/opencode/commit/74bd52e8a7454864cc7edf36c87c9dadd68b2998
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7020