OpenCode plugin: console window flashes on every tool call on Windows (execFileSync missing windowsHide)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 92/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bun, go, javascript
- Ambito
- developer-experience, tooling
Direzione di ricerca
Inizia da internal/agents/opencode/plugin/gortex.js, alla chiamata a execFileSync descritta intorno alla riga 352, quindi controlla il file golden renderizzato cmd/gortex/testdata/agent-render/opencode.txt. Aggiungi l’opzione mancante nel template e rigenera il golden in modo che entrambi gli artefatti corrispondano. Estendi internal/agents/opencode/plugin_test.go per verificare che l’opzione sia presente ed esegui i test Go pertinenti in internal/agents/opencode. Il lavoro è completo quando il plugin OpenCode generato nasconde le console child su Windows mantenendo il contratto esistente dell’hook stdin/stdout.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 1.9k
- Fork
- 171
- Merge medio
- 12h 43m
- PR unite (30g)
- 347
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zzet/gortex
-
ci-tests worktrees
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
ci-tests mcp
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
bug ci-tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
factory:subtask
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
OneBusAway/watchdog#470 ·
I maintainer di solito rispondono entro 1 giorno
-
area: session
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
charmbracelet/crush#4484 ·
I maintainer di solito rispondono entro 1 giorno
-
accepted good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 95/100
-
[Resource]: HearthApertaresource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
hesreallyhim/awesome-claude-code#3713 · 1 commento ·