fix: redirect stderr into user's /dev/tty for guards
CI / All (ubuntu-latest) (push) Failing after 24s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-06-05 12:46:52 -06:00
parent acf69f7ed7
commit b6be2229cf
+5 -2
View File
@@ -507,7 +507,9 @@ open_link() {
guard_operation() { guard_operation() {
if [[ -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then if [[ -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
ans="$(confirm "${1:-Are you sure you want to continue?}")" # 2>/dev/tty: keep the prompt off the host-captured stderr pipe so it
# can't leak into tool_call_error JSON when the wrapped command fails.
ans="$(confirm "${1:-Are you sure you want to continue?}" 2>/dev/tty)"
if [[ "$ans" == 0 ]]; then if [[ "$ans" == 0 ]]; then
error "Operation aborted!" 2>&1 error "Operation aborted!" 2>&1
@@ -657,7 +659,8 @@ guard_path() {
confirmation_prompt="$2" confirmation_prompt="$2"
if [[ ! "$path" == "$(pwd)"* && -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then if [[ ! "$path" == "$(pwd)"* && -z "$AUTO_CONFIRM" && -z "$LLM_AGENT_VAR_AUTO_CONFIRM" ]]; then
ans="$(confirm "$confirmation_prompt")" # 2>/dev/tty: see guard_operation — prevents prompt text leaking via captured stderr.
ans="$(confirm "$confirmation_prompt" 2>/dev/tty)"
if [[ "$ans" == 0 ]]; then if [[ "$ans" == 0 ]]; then
error "Operation aborted!" >&2 error "Operation aborted!" >&2