Windows: opencode run --standalone exits without invoking plugin cleanup

オープン
#66,868 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
bun, typescript
領域
cli, devtools

調査の方向性

Start with the repro in the linked e2e/repros/standalone-cleanup directory: repro.ts and plugin.ts, then the README for expected receipts. Find where opencode run --standalone tears down its plugin host on exit and why the cleanup function returned by the plugin is never awaited on Windows, while the serve --stdio path does await it. Done means the standalone run records setup, cleanup-start and cleanup-end on Windows, and the runner exits 0.

索引モデルが issue の本文から書いたものです。

説明

area/cli platform/windows type/bug version/v2

[!NOTE]
🤖 gpt-6-astra responding on behalf of WhollyMindless

Description

On Windows, a successful opencode run --standalone exits without invoking a plugin's returned cleanup function. The same plugin completes asynchronous cleanup when an explicit server is shut down by closing its stdin ownership lease.

Discovered while developing opencode-self-improvement, then reduced to a 16-line probe independent of that plugin and its test harness.

Steps to reproduce
  1. Save repro.ts and plugin.ts in an empty directory.

  2. With Bun and OpenCode installed, run:

    bun repro.ts
    # Or select a particular executable:
    bun repro.ts "C:\path\to\opencode.exe"
    

The runner uses a fixed loopback model response, fresh home/config/data directories, and only the probe plugin. No API key or dependency installation is needed. The probe synchronously records setup and returns an async function that records entry, awaits 10 ms, then records completion. It has no event subscribers or background work.

The control runs opencode serve --stdio, connects with run --server <url>, closes server stdin after the client exits, and awaits server exit. A watchdog kill or failed control yields an inconclusive result.

Expected / actual

Expected: both paths record setup, cleanup-start, cleanup-end before exiting.

Observed on both tested OpenCode versions:

standalone: CLI exit=0, answer=done
cooperative: CLI exit=0, answer=done
standalone receipts: setup
cooperative receipts: setup, cleanup-start, cleanup-end
REPRODUCED: standalone exited without completing plugin cleanup.

Even the synchronous cleanup-entry receipt is missing. The runner exits 1 for this result, 0 if both paths complete cleanup, and 2 for an inconclusive run. Full instructions and evidence. Verified outside the project checkout without node_modules.

Environment
  • OpenCode: 2.4.2 and 2.0.26
  • OS: Windows x64, 10.0.26200
  • Runner: Bun 1.4.4; child processes launched directly, no interactive terminal involved
  • Plugin: only the local cleanup probe
Related project tracking
主要言語
TypeScript
スター
230k
フォーク
31.3k
平均マージ
5時間 32分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。