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:
parent
ae6f4c5471
commit
8bf3202552
@ -1,7 +1,6 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import type { ShellType } from "../../shared"
|
import type { ShellType } from "../../shared"
|
||||||
import { HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from "./constants"
|
import { HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from "./constants"
|
||||||
import { isNonInteractive } from "./detector"
|
|
||||||
import { log, buildEnvPrefix } from "../../shared"
|
import { log, buildEnvPrefix } from "../../shared"
|
||||||
|
|
||||||
export * from "./constants"
|
export * from "./constants"
|
||||||
@ -47,9 +46,12 @@ export function createNonInteractiveEnvHook(_ctx: PluginInput) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isNonInteractive()) {
|
// NOTE: We intentionally removed the isNonInteractive() check here.
|
||||||
return
|
// 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
|
// 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.
|
// (via Git Bash, WSL, etc.), so we always use unix export syntax.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user