OpenCode plugin: console window flashes on every tool call on Windows (execFileSync missing windowsHide)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 92/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- bun, go, javascript
- Área
- developer-experience, tooling
Línea de trabajo
Comienza con internal/agents/opencode/plugin/gortex.js, en la llamada a execFileSync descrita alrededor de la línea 352, y comprueba después el archivo golden renderizado cmd/gortex/testdata/agent-render/opencode.txt. Añade la opción que falta en la plantilla y regenera el golden para que ambos artefactos coincidan. Amplía internal/agents/opencode/plugin_test.go para comprobar que la opción está presente y ejecuta las pruebas relevantes de Go en internal/agents/opencode. Se considera terminado cuando el plugin de OpenCode generado oculta las consolas secundarias en Windows y mantiene el contrato existente del hook de stdin/stdout.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 1.9k
- Forks
- 171
- Merge medio
- 12 h 43 min
- PR fusionados (30 d)
- 347
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de zzet/gortex
-
ci-tests worktrees
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
ci-tests mcp
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
bug ci-tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
Todos los issues de zzet/gortex
Issues similares
-
factory:subtask
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
OneBusAway/watchdog#470 ·
Los mantenedores suelen responder en 1 día
-
area: session
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
charmbracelet/crush#4484 ·
Los mantenedores suelen responder en 1 día
-
accepted good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 95/100
-
[Resource]: HearthAbiertoresource-submission validation-passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
hesreallyhim/awesome-claude-code#3713 · 1 comentario ·