You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After I open opencode buffer, every time I want to exit I have to wait for quite some time.
I took a peek at the opencode server shutdown function and noticed that the shutdown_promise is only resolved when there is no job, thus the callback in VimLeavePre will wait for entire 2000ms before exiting.
I try to resolve the promise after killing the job in the shutdown function and wait time is slightly reduced, although still noticeable.
Activity
sudo-tee commentedon Feb 9, 2026
Seems related to #251
The shutdown sequence is problematic on OSX
fix(server): improve shutdown sequence to ensure reliable job termina…
sudo-tee commentedon Feb 9, 2026
@pirey
I played with the shutdown of the server in a PR, please let me know if it resolves the issue for you. As I was not experiencing this issue
#255
pirey commentedon Feb 10, 2026
Hey thanks.
I tried checking out the branch and found that the wait time is reduced from 2000ms to around 700ms-ish.
I'm using this to do simple time measurement
and this is the comparison before and after i checkout the branch
So I guess the fix is kinda working, but having to wait over 500ms is still noticeable and I wonder if we can reduce it further.
sudo-tee commentedon Feb 10, 2026
Thanks for confirming.
I will still work on it for a bit
fix(server): improve shutdown sequence to ensure reliable job termina…
sudo-tee commentedon Feb 10, 2026
@pirey
I simplified the shutdown logic to the minimum and added some logging
you can enable it in your config
{ logging { enabled = true, level = 'debug' } }Could you do me a favor and enable the log even if it works for you so I can see if there is an error in one of the SIGTERM or SIGKILL ?
file path should be
~/.local/state/nvim/opencode.logThank you very much
fix(server): improve shutdown sequence to ensure reliable job termina…