Skip to content

fix(ui): honor OBOL_NONINTERACTIVE on a real TTY - #789

Merged
OisinKyne merged 1 commit into
mainfrom
fix/noninteractive-prompt-guard
Jul 20, 2026
Merged

fix(ui): honor OBOL_NONINTERACTIVE on a real TTY#789
OisinKyne merged 1 commit into
mainfrom
fix/noninteractive-prompt-guard

Conversation

@bussyjd

@bussyjd bussyjd commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Problem

OBOL_NONINTERACTIVE=true had no effect on a real TTY. internal/ui/prompt.go's
isInteractive() gated prompting on JSON-output mode and TTY detection only:

func (u *UI) isInteractive() bool {
	return !u.IsJSON() && u.IsTTY()
}

It never consulted the env var, so scripted/automated runs launched from a real
terminal (e.g. CI runners with a pty, installer wrappers) still hit every
Confirm/Select/Input call and blocked waiting on stdin — including the
"start cluster now?" and Ollama-model prompts during obol stack up.

Audited every Confirm/Select call site in the codebase (internal/app,
internal/openclaw, internal/network, internal/tunnel, internal/stackbackup,
internal/hermes, internal/stack/safety.go, cmd/obol/*.go): all of them
already route through UI.Confirm/UI.Select, and there is no raw
survey/promptui prompt anywhere in internal/. The Ollama-detection logic in
internal/stack/stack.go only warns/logs when no models are pulled — it
never calls Confirm. So the single isInteractive() guard is the one and
only chokepoint; no other call site needed touching.

Fix

isInteractive() now also requires OBOL_NONINTERACTIVE is not "true":

func (u *UI) isInteractive() bool {
	return !u.IsJSON() && u.IsTTY() && os.Getenv("OBOL_NONINTERACTIVE") != "true"
}

Every prompt (Confirm, Select, Input, InputWithSuffix, SecretInput)
already short-circuits through isInteractive() and falls back to its
default/error path, so this one guard covers all of them.

Diagram

flowchart LR
    A[OBOL_NONINTERACTIVE env var] --> D{isInteractive guard}
    B[IsJSON] --> D
    C[IsTTY] --> D
    D -- "any condition false" --> E["Confirm/Select/Input\nreturn default (no prompt)"]
    D -- "all true" --> F["Confirm/Select/Input\nprompt on stdin"]
Loading

Validation

$ gofmt -l internal/ui/prompt.go internal/ui/prompt_test.go
(no output)

$ go build ./...
(exit 0)

$ go test ./internal/ui/... -count=1 -v
=== RUN   TestIsInteractive_OBOLNonInteractive
--- PASS: TestIsInteractive_OBOLNonInteractive (0.00s)
=== RUN   TestConfirm_OBOLNonInteractiveReturnsDefault
--- PASS: TestConfirm_OBOLNonInteractiveReturnsDefault (0.00s)
PASS
ok  	github.com/ObolNetwork/obol-stack/internal/ui	0.533s

https://claude.ai/code/session_01PnhCQLz7CHuDBUhWd5xF8v

@OisinKyne
OisinKyne force-pushed the fix/noninteractive-prompt-guard branch from a04c05d to 24a511d Compare July 20, 2026 14:57
@OisinKyne
OisinKyne enabled auto-merge (rebase) July 20, 2026 14:57
@OisinKyne
OisinKyne merged commit b0ce4a3 into main Jul 20, 2026
9 checks passed
@OisinKyne
OisinKyne deleted the fix/noninteractive-prompt-guard branch July 20, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants