Skip to content

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

Closed

Description

@actellim

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

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 8, 2025
  2. github-actions commented on Nov 8, 2025

    @github-actions
    Contributor

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

    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.

  3. rekram1-node commented on Nov 8, 2025

    @rekram1-node
    Contributor

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

  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 8, 2025
  5. self-assigned this
    on Nov 8, 2025
  6. rekram1-node commented on Nov 8, 2025

    @rekram1-node
    Contributor

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

  7. actellim commented on Nov 8, 2025

    @actellim
    Author

    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

  8. actellim commented on Nov 8, 2025

    @actellim
    Author

    @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

  9. rekram1-node commented on Nov 8, 2025

    @rekram1-node
    Contributor

    @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

  10. actellim commented on Nov 8, 2025

    @actellim
    Author

    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?

  11. rekram1-node commented on Nov 8, 2025

    @rekram1-node
    Contributor

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

    we will address this over weekend

  12. mschenk42 commented on Nov 9, 2025

    @mschenk42

    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.

  13. rekram1-node commented on Nov 10, 2025

    @rekram1-node
    Contributor

    @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

  14. actellim commented on Nov 10, 2025

    @actellim
    Author

    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.

  15. mschenk42 commented on Nov 10, 2025

    @mschenk42

    @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.

  16. mschenk42 commented on Nov 19, 2025

    @mschenk42

    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.

  17. ojsef39 commented on Dec 4, 2025

    @ojsef39

    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 :)

  18. Loxia106 commented on Jan 15, 2026

    @Loxia106

    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)

  19. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions