anomalyco / anomalyco/opencode

Plugin dispose is not called after one-shot run final stop

Open
#48,340 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Sep 10, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

On opencode-ai 1.18.29, opencode run --format json --model mock/mock-model --auto ... emits the final step_finish with reason: "stop", but the process remains alive and never calls the loaded plugin dispose hook.

Reproduction: load a plugin whose setup starts an RPC listener and a child process and whose returned hooks include dispose that stops both. Execute one tool in opencode run. After the final stop event, the process remains alive indefinitely. Disabling only the RPC listener still hangs; shutting down only the child-process pool still hangs; disabling the RPC listener and shutting down the pool together allows the run to exit. This shows both plugin-owned handles are retained because host teardown never invokes dispose.

Expected: after a one-shot run reaches final stop, invoke plugin dispose hooks so plugins can release long-lived handles and the CLI can exit.

Observed under an isolated HOME plus XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_CACHE_HOME/XDG_RUNTIME_DIR, with default plugins disabled.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.