From 8bf3202552e95cd961dc04e666bb5ac77c10f069 Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Sun, 1 Feb 2026 18:06:05 +0900 Subject: [PATCH] fix(non-interactive-env): always inject env vars for git commands Remove isNonInteractive() check that was incorrectly added in PR #573. The check prevented env var injection when OpenCode runs in a TTY, causing git commands like 'git rebase --continue' to open editors (nvim) that hang forever. The agent cannot interact with spawned bash processes regardless of whether OpenCode itself is in a TTY. --- src/hooks/non-interactive-env/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hooks/non-interactive-env/index.ts b/src/hooks/non-interactive-env/index.ts index 00c1e19c1..c85c7efd6 100644 --- a/src/hooks/non-interactive-env/index.ts +++ b/src/hooks/non-interactive-env/index.ts @@ -1,7 +1,6 @@ import type { PluginInput } from "@opencode-ai/plugin" import type { ShellType } from "../../shared" import { HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from "./constants" -import { isNonInteractive } from "./detector" import { log, buildEnvPrefix } from "../../shared" export * from "./constants" @@ -47,9 +46,12 @@ export function createNonInteractiveEnvHook(_ctx: PluginInput) { return } - if (!isNonInteractive()) { - return - } + // NOTE: We intentionally removed the isNonInteractive() check here. + // Even when OpenCode runs in a TTY, the agent cannot interact with + // spawned bash processes. Git commands like `git rebase --continue` + // would open editors (vim/nvim) that hang forever. + // The env vars (GIT_EDITOR=:, EDITOR=:, etc.) must ALWAYS be injected + // for git commands to prevent interactive prompts. // The bash tool always runs in a Unix-like shell (bash/sh), even on Windows // (via Git Bash, WSL, etc.), so we always use unix export syntax.