Repository navigation
cli: -no-cnv means one turn, and a non-TTY stdin ends the interactive loop (engine#561) - #145
Merged
bong-water-water-bong merged 1 commit intoOct 25, 2026
Conversation
…e#561) `llama-cli ... -no-cnv -p ... </dev/null` ran the interactive loop anyway, printing "> " into its output for as long as it lived: 169 MB in 20 s here, 9.4 GB and 2 x 20 GB in the field. Two causes, both fixed here: - `-no-cnv` / `--no-conversation` only switched the conversation template off; it did not say "one turn and exit". It now sets single_turn, which is what `-st` does, so the meaning people already expect from the flag is the behaviour. - the interactive loop read from a redirected or closed stdin and got an empty line forever. With stdin not a TTY the first empty read now ends the session instead of spinning. An unknown flag was already refused (`error: invalid argument: ...`, exit 1) and stays so; it is the third part of the report and needed no change. Verified with llama-cli built from this tree, Qwen3-0.6B, `</dev/null`, `-n 8`: -no-cnv before: 169,516,021 bytes of "> " in 20 s (killed by timeout) -no-cnv after : 1,034 bytes, exit 0 no -no-cnv : 1,034 bytes, exit 0 (previously the same loop) --unknown : exit 1, "error: invalid argument: --definitely-not-a-flag" Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Fixes engine#561.
llama-cli ... -no-cnv -p "..." -n 32 </dev/nullran the interactive loop anyway and printed>into its output for as long as the process lived — 9.4 GB and 2 × 20 GB were written in the field.Two causes, both fixed:
-no-cnv/--no-conversationonly switched the conversation template off. It now also setssingle_turn(what-stdoes), which is what the flag reads as and what people already expect of it.isatty/_isattyon Windows).The third part of the report — unknown flags silently falling into interactive mode — does not reproduce on this base:
common/arg.cppalready refuses them (error: invalid argument: --definitely-not-a-flag, exit 1), so no change was needed there; it is covered by the verification below.Verified (llama-cli built from this branch, Qwen3-0.6B Q4_K_M,
</dev/null,-n 8)-no-cnv -p "Say hi.">in 20 s, killed by timeout-p "Say hi."(no-no-cnv)--definitely-not-a-flagerror: invalid argumentNotes
-no-cnvnow behaves like-st; a scripted single-shot run that previously survived only because it was killed early behaves the same, and one that relied on the loop (none can, it never consumed input) is not affected.common/arg.cpp(the-cnv/-no-cnvhandler) andtools/cli/cli-context.cpp(the loop's stdin read).🤖 Generated with Claude Code