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.
This commit is contained in:
justsisyphus
2026-02-01 18:06:05 +09:00
parent ae6f4c5471
commit 8bf3202552

View File

@@ -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.