Skip to content

Opencode process doesn't terminate after exiting Neovim #237

Closed

Description

@TaterDoge

Bug Description

After starting the plugin and then exiting Neovim, the opencode process continues to run in the background instead of terminating properly.

Steps to Reproduce

  1. Open Neovim
  2. Start opencode.nvim (e.g., press <leader>og or run :Opencode)
  3. Use the plugin normally (optional)
  4. Exit Neovim (:q or :qa)
  5. Check running processes (e.g., ps aux | grep opencode)

Expected Behavior

The opencode process should be terminated when Neovim exits.

Actual Behavior

The opencode process remains running in the background after Neovim has been closed.

Environment

  • Neovim version: (please fill in)
  • opencode.nvim version: (latest/main)
  • Opencode CLI version: (please fill in, run opencode --version)
  • OS: (please fill in)

Additional Context

This appears to be a cleanup issue where the plugin is not properly terminating the opencode child process on Neovim exit. The process may need to be explicitly killed or a proper shutdown signal sent when the plugin is unloaded or Neovim exits.

Please let me know if you need any additional information or logs to help diagnose this issue.

Activity

  1. disrupted commented on Feb 5, 2026

    @disrupted
    Contributor

    I cannot reproduce this. are you sure an instance of opencode wasn't already running when you launched Neovim?
    also which OS and versions are you using? (your issue template is nice but you didn't actually fill it in)

  2. TaterDoge commented on Feb 5, 2026

    @TaterDoge
    Author

    I cannot reproduce this. are you sure an instance of opencode wasn't already running when you launched Neovim? also which OS and versions are you using? (your issue template is nice but you didn't actually fill it in)

    iShot_2026-02-05_20.07.35.mp4

    After entering nvim, start opencode.nvim and exit, repeating this three times; three processes were launched, and the first two processes should have been closed.

  3. sudo-tee commented on Feb 5, 2026

    @sudo-tee
    Owner

    @maobai405

    I also not able to reproduce the issue,

    However I modified the shutdown sequence to use SIGTERM and SIGKILL as a fallback. And also use the nvim intenal contstants for the signals to ensure crossplatform compatability.

    #239

    Let me know if it resolves the issue

  4. TaterDoge commented on Feb 6, 2026

    @TaterDoge
    Author

    @sudo-tee

    I tried that PR but couldn't resolve it. Anyway, I'll stop dwelling on this issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions