OpenCode plugin: console window flashes on every tool call on Windows (execFileSync missing windowsHide)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 92/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bun, go, javascript
調査の方向性
まず internal/agents/opencode/plugin/gortex.js の352行目付近で説明されている execFileSync の呼び出しを確認し、続いてレンダリングされた golden ファイル cmd/gortex/testdata/agent-render/opencode.txt をチェックします。テンプレートに不足しているオプションを追加し、golden を再生成して両方の成果物が一致するようにします。internal/agents/opencode/plugin_test.go を拡張して、そのオプションが存在することを検証し、internal/agents/opencode 内の関連する Go テストを実行します。完了の基準は、生成された OpenCode プラグインが Windows で子コンソールを非表示にしながら、既存の stdin/stdout フック契約を維持することです。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
On Windows, OpenCode flashes a console window (opens and closes) on every tool call and every user message once the Gortex OpenCode bridge plugin is installed. The plugin runs gortex hook --agent=opencode via execFileSync without windowsHide: true, so Windows allocates a new console for the child process.
The plugin host runs inside OpenCode's Bun process, which has no console attached, so each hook invocation gets its own console window. With the default hooks this happens:
- once per tool call (
tool.execute.before/execute.before) - once per permission prompt (
permission.ask/permission.evaluate) - twice per user message (
sessionbriefing on the first turn +chat.message)
To Reproduce
- On Windows 11, run
gortex install(orgortex init --agents opencode) with OpenCode detected. - Open OpenCode in any repo.
- Run a tool, e.g. ask the agent to run
git status. - A console window flashes for each hook invocation. Restarting the TUI does not help; the flash correlates 1:1 with tool calls.
Root cause
internal/agents/opencode/plugin/gortex.js (tag v0.64.11, still present on main), call site at line 352:
const out = execFileSync(GORTEX_BIN, HOOK_ARGV.slice(1), {
input: JSON.stringify(envelope),
encoding: "utf8",
maxBuffer: 16 * 1024 * 1024,
timeout: HOOK_TIMEOUT_MS,
stdio: ["pipe", "pipe", "ignore"],
// windowsHide missing
});
windowsHide defaults to false. Node's docs: "Hide the subprocess console window that would normally be created on Windows systems. Default: false."
Bun ships a lint rule for this exact failure mode (bun/no-console-window-flash):
On Windows, a child process started from an app without a console gets its own console window. The window opens and closes again as the process runs, which users see as a black flash.
windowsHide: trueprevents it and has no effect on other systems.
For contrast, the sibling rtk OpenCode plugin already sets windowsHide: true on both of its execFile calls (lines 84 and 121 of its rtk.ts), so the pattern is established in OpenCode plugins on Windows.
Expected behavior
No console window is created; the hook runs hidden and the TUI stays clean.
Proposed fix (one line)
stdio: ["pipe", "pipe", "ignore"],
+ windowsHide: true,
});
windowsHide is ignored on Linux/macOS, so there is no behavior change outside Windows. The hook still receives its envelope on stdin and writes its decision on stdout through the existing pipes.
Blast radius for the generated artifacts:
internal/agents/opencode/plugin/gortex.js— the template above.cmd/gortex/testdata/agent-render/opencode.txt— rendered golden, must be regenerated.internal/agents/opencode/plugin_test.go:394already asserts exactly oneexecFileSync(call site; adding astrings.Contains(pluginSource, "windowsHide: true")assertion would lock the fix in.
Verified locally
I patched the generated ~/.config/opencode/plugin/gortex.js on my machine with the one-line change:
bun -e 'await import("file:///.../plugin/gortex.js")'→ parses cleanly under Bun 1.4.5 (OpenCode's runtime).- Replicated the exact options object and invoked
gortex hook --agent=opencodewith atool.execute.beforeenvelope → returns its decision JSON ({}for a benigngit status), so the hook contract is unaffected. - After restarting the TUI, the flash is gone.
Note that this file is generated, so the local patch is overwritten by gortex install / gortex init --agents opencode; the fix has to land in the adapter template to persist.
Environment
$ gortex version
gortex v0.64.11+c7abb9b
commit: c7abb9b
built: 2026-10-26T21:52:09Z
go: go1.27.3
os/arch: windows/amd64
go version is unavailable on this machine — Gortex was installed from the release binary, so no Go toolchain is present.
- OS: Windows 11 Pro 10.0.26300
- OpenCode:
v2.4.2(Bun 1.4.5) - Adapter:
opencode(user-level plugin at~/.config/opencode/plugin/gortex.js)
Additional context
Related closed Windows console-window issues are all on the daemon side (#217 "gortex daemon start --detach make terminals flicker in Windows", #783 "Windows daemon can spawn visible go.exe console windows via go/packages"), fixed with HideWindow / CREATE_NO_WINDOW. The OpenCode bridge path was missed. No open issue or PR currently mentions windowsHide or the plugin console flash.
- 主要言語
- Go
- スター
- 1.9k
- フォーク
- 171
- 平均マージ
- 12時間 43分
- マージ済み PR(30日)
- 347
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
zzet/gortex のほかの issue
-
ci-tests worktrees
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
ci-tests mcp
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
bug ci-tests
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
factory:subtask
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
OneBusAway/watchdog#470 ·
メンテナーはふだん 1 日以内に返信
-
area: session
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
charmbracelet/crush#4484 ·
メンテナーはふだん 1 日以内に返信
-
accepted good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 95/100
-
[Resource]: Hearthオープンresource-submission validation-passed
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
hesreallyhim/awesome-claude-code#3713 · コメント 1 件 ·