Skip to content

Serve mode can retain idle instances and stale subprocess state #21570

Closed as not planned

Description

@sjawhar

Description

Shared opencode serve instances can keep stale per-directory resources alive longer than intended: idle instances, subprocess handles, RPC/listener state, and related background cleanup work are not aggressively reclaimed. This shows up as long-lived server state even after the relevant worktree/session is no longer active.

The hardening work here adds explicit instance activity tracking, idle disposal, stale bash process reaping, and listener/cache cleanup so per-directory instances can shut down cleanly instead of accumulating background state.

Plugins

No response

OpenCode version

0.0.0--202604082056 (local built binary / dev branch work)

Steps to reproduce

  1. Start opencode serve against a project.
  2. Create activity that opens per-directory instances and starts subprocess-backed work (bash/task/LSP/session flows).
  3. Leave the server idle or switch away from the active worktree/directory.
  4. Observe that process/listener cleanup is incomplete and state can linger longer than expected.

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

Ghostty

Activity

  1. github-actions commented on Apr 8, 2026

    @github-actions
    Contributor

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

  2. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions