Session hangs after file write tool execution with massive latency spike #2681

Open
opened 2026-02-16 17:36:48 -05:00 by yindo · 15 comments
Owner

Originally created by @actellim on GitHub (Nov 7, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Bug Description

When models execute file write tool calls, the write operation completes successfully but control never returns to the session. The session hangs indefinitely.

Model Provider

This happened with big pickle and my llama.cpp server hosing gpt-oss-20b.

Log Highlight

INFO 2025-11-08T00:27:35 +89884ms service=default directory=/home/actellim/Projects/dll-experiment disposing instance

I manually killed it after ~1.5m with ctrl+c.

Expected Behavior

After file write completion, control should return to the session immediately for continued interaction.

Actual Behavior

Session hangs indefinitely after file write, requiring manual termination.

Additional Context

  • The file write operation itself succeeds (files are created/modified).
  • The issue appears to be in the post-write cleanup or response handling.
  • The massive ms timestamp suggests a timeout or deadlock in the cleanup process.

OpenCode version

1.0.39-1.0.44

Steps to reproduce

(I suspect this isn't a problem for everyone so I'm not sure what exactly is going sideways here).

  1. Start an opencode session.
  2. Request a model perform a file write operation.
  3. Session hangs and never returns control to the user

Screenshot and/or share link

2025-11-08T002103.log

Operating System

Ubuntu 24.04

Terminal

Kitty

Originally created by @actellim on GitHub (Nov 7, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description ## Bug Description When models execute file write tool calls, the write operation completes successfully but control never returns to the session. The session hangs indefinitely. ## Model Provider This happened with big pickle and my llama.cpp server hosing gpt-oss-20b. ## Log Highlight `INFO 2025-11-08T00:27:35 +89884ms service=default directory=/home/actellim/Projects/dll-experiment disposing instance` I manually killed it after ~1.5m with `ctrl+c`. ## Expected Behavior After file write completion, control should return to the session immediately for continued interaction. ## Actual Behavior Session hangs indefinitely after file write, requiring manual termination. ## Additional Context - The file write operation itself succeeds (files are created/modified). - The issue appears to be in the post-write cleanup or response handling. - The massive ms timestamp suggests a timeout or deadlock in the cleanup process. ### OpenCode version 1.0.39-1.0.44 ### Steps to reproduce (I suspect this isn't a problem for everyone so I'm not sure what exactly is going sideways here). 1. Start an opencode session. 2. Request a model perform a file write operation. 3. Session hangs and never returns control to the user ### Screenshot and/or share link [2025-11-08T002103.log](https://github.com/user-attachments/files/23427689/2025-11-08T002103.log) ### Operating System Ubuntu 24.04 ### Terminal Kitty
yindo added the bug label 2026-02-16 17:36:48 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 7, 2025):

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

  • #3975: Session hanging in VSCode Terminal after tool permission operations
  • #3846: Session becomes completely unresponsive to user input, requiring process termination
  • #3944: App freezes after tool permission interactions during parallel tool calls (closed but may be related)

All these issues describe similar symptoms: session hangs/freezes after tool execution with complete loss of control, requiring manual termination. The pattern suggests a systemic issue with tool execution cleanup/response handling.

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

@github-actions[bot] commented on GitHub (Nov 7, 2025): This issue might be a duplicate of existing issues. Please check: - #3975: Session hanging in VSCode Terminal after tool permission operations - #3846: Session becomes completely unresponsive to user input, requiring process termination - #3944: App freezes after tool permission interactions during parallel tool calls (closed but may be related) All these issues describe similar symptoms: session hangs/freezes after tool execution with complete loss of control, requiring manual termination. The pattern suggests a systemic issue with tool execution cleanup/response handling. Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Nov 7, 2025):

@actellim what kinda file is it? It may be a formatter or lsp?

@rekram1-node commented on GitHub (Nov 7, 2025): @actellim what kinda file is it? It may be a formatter or lsp?
Author
Owner

@rekram1-node commented on GitHub (Nov 7, 2025):

is it a .c/.cpp/.h or .py file

@rekram1-node commented on GitHub (Nov 7, 2025): is it a .c/.cpp/.h or .py file
Author
Owner

@actellim commented on GitHub (Nov 7, 2025):

It's a .cpp file. The model successfully makes the edits, but control isn't returned. For the heck of it I sent a prompt after ~1.5m and it started going again, without any sort of feedback. I'm encoding the video of the session: https://github.com/user-attachments/assets/563f4e3a-a66e-405e-a98c-ea2f03b59e68

@actellim commented on GitHub (Nov 7, 2025): It's a `.cpp` file. The model successfully makes the edits, but control isn't returned. For the heck of it I sent a prompt after ~1.5m and it started going again, without any sort of feedback. I'm encoding the video of the session: https://github.com/user-attachments/assets/563f4e3a-a66e-405e-a98c-ea2f03b59e68
Author
Owner

@actellim commented on GitHub (Nov 7, 2025):

@actellim what kinda file is it? It may be a formatter or lsp?

I don't have any of those specifically enabled/disabled in my opencode.json. I've read the docs and will try disabling the .cpp lsp server and formatter and get back to you with results. It was working prior to ~1.0.39.

opencode.json

@actellim commented on GitHub (Nov 7, 2025): > [@actellim](https://github.com/actellim) what kinda file is it? It may be a formatter or lsp? I don't have any of those specifically enabled/disabled in my `opencode.json`. I've read the docs and will try disabling the `.cpp` lsp server and formatter and get back to you with results. It was working prior to ~1.0.39. [opencode.json](https://github.com/user-attachments/files/23427999/opencode.json)
Author
Owner

@rekram1-node commented on GitHub (Nov 7, 2025):

@actellim i feel like its the lsp try disabling clangd ( in ur config )and it may fix it

looks something like:

lsp:
“clangd”:
disabled: true

im typing on phone thats why it isnt json haha

@rekram1-node commented on GitHub (Nov 7, 2025): @actellim i feel like its the lsp try disabling clangd ( in ur config )and it may fix it looks something like: lsp: “clangd”: disabled: true im typing on phone thats why it isnt json haha
Author
Owner

@actellim commented on GitHub (Nov 7, 2025):

No worries. I disabled both the lsp and the formatter in the config and I'm back in business. Would like to fix, could this be an issue with the way I've got my system setup?

@actellim commented on GitHub (Nov 7, 2025): No worries. I disabled both the lsp and the formatter in the config and I'm back in business. Would like to fix, could this be an issue with the way I've got my system setup?
Author
Owner

@rekram1-node commented on GitHub (Nov 7, 2025):

no i think its our fault ive heard someone have this before

we will address this over weekend

@rekram1-node commented on GitHub (Nov 7, 2025): no i think its our fault ive heard someone have this before we will address this over weekend
Author
Owner

@mschenk42 commented on GitHub (Nov 9, 2025):

I've had a similar experience. The memory and CPU usage keep going up, and the UI becomes unresponsive. I'll try disabling the lsp, formatters, and some of my permission settings to see if I can find the culprit.

@mschenk42 commented on GitHub (Nov 9, 2025): I've had a similar experience. The memory and CPU usage keep going up, and the UI becomes unresponsive. I'll try disabling the lsp, formatters, and some of my permission settings to see if I can find the culprit.
Author
Owner

@rekram1-node commented on GitHub (Nov 9, 2025):

@mschenk42 that may be due to really long sessions?

The formatters shouldnt cause memory spikes

If u are on latest and this still happens we have some performance improvements shipping soon

@rekram1-node commented on GitHub (Nov 9, 2025): @mschenk42 that may be due to really long sessions? The formatters shouldnt cause memory spikes If u are on latest and this still happens we have some performance improvements shipping soon
Author
Owner

@actellim commented on GitHub (Nov 9, 2025):

I've had a similar experience. The memory and CPU usage keep going up, and the UI becomes unresponsive. I'll try disabling the lsp, formatters, and some of my permission settings to see if I can find the culprit.

I have not experienced this issue in long sessions.

@actellim commented on GitHub (Nov 9, 2025): > I've had a similar experience. The memory and CPU usage keep going up, and the UI becomes unresponsive. I'll try disabling the lsp, formatters, and some of my permission settings to see if I can find the culprit. I have not experienced this issue in long sessions.
Author
Owner

@mschenk42 commented on GitHub (Nov 10, 2025):

@rekram1-node , the context was under 200K, and the number of files I changed might have been a factor too. The agent was validating a lot of small data files.

@mschenk42 commented on GitHub (Nov 10, 2025): @rekram1-node , the context was under 200K, and the number of files I changed might have been a factor too. The agent was validating a lot of small data files.
Author
Owner

@mschenk42 commented on GitHub (Nov 18, 2025):

I conducted additional testing and found that my issue seemed to be related to setting these permissions at the top level of my configuration.

  "permission": {
    "edit": "allow",
    "bash": "ask"
  },

When I used this configuration in the build mode, it prompted for permission frequently. Over time, this process became slow and almost unresponsive. I wonder if this is not a suitable use case for the permission system.

@mschenk42 commented on GitHub (Nov 18, 2025): I conducted additional testing and found that my issue seemed to be related to setting these permissions at the top level of my configuration. ``` "permission": { "edit": "allow", "bash": "ask" }, ``` When I used this configuration in the build mode, it prompted for permission frequently. Over time, this process became slow and almost unresponsive. I wonder if this is not a suitable use case for the permission system.
Author
Owner

@ojsef39 commented on GitHub (Dec 4, 2025):

When I used this configuration in the build mode, it prompted for permission frequently. Over time, this process became slow and almost unresponsive. I wonder if this is not a suitable use case for the permission system.

I think im facing a similar issue, at the beginning it works fine but the more opencode asks for permissions (not even meant in a quantitive way e.g. 3 requests at once, it also happens with just one reqeust) the slower it gets.

Sometimes i hit deny or allow and ill just sit there for a minute wondering if i just hit the numpad enter again (that wont work) or its just hanging… which is pretty annoying, ive switched back to claude code for now as i dont trust these models at all with commands so i want to get asked reliably and it should work fast to approve or deny if possible.

Nonetheless i love this project and im greatful for every contributor and i cant wait to come back :)

@ojsef39 commented on GitHub (Dec 4, 2025): > When I used this configuration in the build mode, it prompted for permission frequently. Over time, this process became slow and almost unresponsive. I wonder if this is not a suitable use case for the permission system. I think im facing a similar issue, at the beginning it works fine but the more opencode asks for permissions (not even meant in a quantitive way e.g. 3 requests at once, it also happens with just one reqeust) the slower it gets. Sometimes i hit deny or allow and ill just sit there for a minute wondering if i just hit the numpad enter again (that wont work) or its just hanging… which is pretty annoying, ive switched back to claude code for now as i dont trust these models at all with commands so i want to get asked reliably and it should work fast to approve or deny if possible. Nonetheless i love this project and im greatful for every contributor and i cant wait to come back :)
Author
Owner

@Loxia106 commented on GitHub (Jan 14, 2026):

I have exactly same issue.

  • It happens with 'write' , 'edit' tool use
  • Regardlees of the model or provider.
  • Regardless of LSP / Formatter / MCP disabled.
  • Regardless of the file type (writing/editing .txt also cause hang)
  • It only happens on one of my PCs.
  • happens on Windows conventional cmd.exe

+add
The error fixed by re-installing all packages via bun. (previously npm)

@Loxia106 commented on GitHub (Jan 14, 2026): I have exactly same issue. - It happens with 'write' , 'edit' tool use - Regardlees of the model or provider. - Regardless of LSP / Formatter / MCP disabled. - Regardless of the file type (writing/editing .txt also cause hang) - It only happens on one of my PCs. - happens on Windows conventional cmd.exe +add The error fixed by re-installing all packages via bun. (previously npm)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2681