cli: render OpTracker as plain lines on non-interactive stderr#2421
Open
dstotijn wants to merge 1 commit intoencoredev:mainfrom
Open
cli: render OpTracker as plain lines on non-interactive stderr#2421dstotijn wants to merge 1 commit intoencoredev:mainfrom
dstotijn wants to merge 1 commit intoencoredev:mainfrom
Conversation
The build progress UI uses ANSI cursor save/restore for in-place spinner updates, which only works on a TTY. When stderr is piped into mise, a log aggregator, or CI, every 100ms refresh becomes a new line and floods the output. Detect the CLI's stderr TTY state and pass it through to the daemon as a new non_interactive bool on RunRequest, ExecScriptRequest, and ExecSpecRequest. The OpTracker now renders one plain line per state transition (start / done / failed) instead of the spinner when interactive is false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The build-progress UI (
Building Encore application graph...,Analyzing service topology..., etc.) is rendered byinternal/optracker.OpTracker, which uses ANSI cursor save/restore for in-place spinner updates. That works on a TTY, but when stderr is piped —mise run, log aggregators, CI,tee, Docker logs — every 100ms refresh becomes a new line and floods the output.Fix
non_interactiveonRunRequest,ExecScriptRequest,ExecSpecRequest. Defaults to false → existing behavior, fully backwards compatible.!term.IsTerminal(int(os.Stderr.Fd())).optracker.Newgains aninteractive boolparameter. In interactive mode rendering is unchanged. In non-interactive mode the spinner goroutine is skipped, ANSI cursor manipulation is dropped, and the tracker emits one plain line per state transition (start / done / failed / canceled) — no duplicates across refresh calls.Example non-interactive output:
Alternatives considered
--quietflag /ENCORE_QUIETenv var — rejected. The flooding is an output-format bug, not a verbosity preference; surfacing it as user config asks people to opt out of broken behavior.Test plan
encore runfrom a TTY shows the spinner UI as before.encore run 2>&1 | catproduces plain one-line-per-event output, no spinner / cursor escapes.encore exec(Go and TS apps).go test ./internal/optracker/... ./cli/daemon/... ./cli/cmd/encore/...