opencode process orphans when its parent exits #8994

Open
opened 2026-02-16 18:11:21 -05:00 by yindo · 1 comment
Owner

Originally created by @nickjvandyke on GitHub (Feb 10, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

https://github.com/nickjvandyke/opencode.nvim/issues/118

This is a big problem because:

  1. The plugin will auto-connect to orphaned opencode processes that have no TUI
  2. Even if I worked around the above, each opencode process consumes ~500MB of memory

Plugins

none

OpenCode version

1.1.53

Steps to reproduce

  1. Launch opencode in a way that gives it a parent process. e.g. Neovim's vim.fn.jobstart or, directly in your terminal, fish -c opencode or (untested, but presumably) bash -c opencode
  2. pgrep -fl opencode to find the parent and opencode PIDs
  3. kill -9 <parent_pid>
  4. pgrep -fl opencode, observe that opencode itself is still running
  5. ps -o ppid= -p <opencode_pid>, observe that opencode's parent PID is now 1

I'm not certain this is directly opencode's fault, but it appeared only recently, and I can't think what would have changed otherwise.

Screenshot and/or share link

Image

Operating System

macOS 15.6.1

Terminal

Ghostty

Originally created by @nickjvandyke on GitHub (Feb 10, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description https://github.com/nickjvandyke/opencode.nvim/issues/118 This is a big problem because: 1. The plugin will auto-connect to orphaned `opencode` processes that have no TUI 2. Even if I worked around the above, each `opencode` process consumes ~500MB of memory ### Plugins none ### OpenCode version 1.1.53 ### Steps to reproduce 1. Launch `opencode` in a way that gives it a parent process. e.g. Neovim's `vim.fn.jobstart` or, directly in your terminal, `fish -c opencode` or (untested, but presumably) `bash -c opencode` 2. `pgrep -fl opencode` to find the parent and `opencode` PIDs 3. `kill -9 <parent_pid>` 4. `pgrep -fl opencode`, observe that `opencode` itself is still running 5. `ps -o ppid= -p <opencode_pid>`, observe that `opencode`'s parent PID is now 1 I'm not certain this is directly `opencode`'s fault, but it appeared only recently, and I can't think what would have changed otherwise. ### Screenshot and/or share link <img width="1470" height="956" alt="Image" src="https://github.com/user-attachments/assets/65c70532-2ba8-457f-91e4-a9f2cf0521ba" /> ### Operating System macOS 15.6.1 ### Terminal Ghostty
yindo added the bugperf labels 2026-02-16 18:11:21 -05:00
Author
Owner

@nickjvandyke commented on GitHub (Feb 10, 2026):

This occurs in a more typical workflow too: run opencode directly in your terminal, and close the terminal window. The process sticks around.

Basically opencode doesn't seem to shut down correctly unless closed explicitly via ctrl-c in its TUI.

@nickjvandyke commented on GitHub (Feb 10, 2026): This occurs in a more typical workflow too: run `opencode` directly in your terminal, and close the terminal window. The process sticks around. Basically `opencode` doesn't seem to shut down correctly unless closed explicitly via ctrl-c in its TUI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8994