fix(chat): make --no-interactive truly non-interactive #2320
+17
−1
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.
Fix
--no-interactive
still prompting for confirmationCloses #1951
What & Why
Running
chat --no-interactive --trust-all-tools "<prompt>"
should execute automatically, but the model often responded with follow-up questions such as
“Would you like me to proceed?”. This broke scripted / CI usage.
Root cause: the model never knew the session was intended to be non-interactive.
Solution: inject a one-time system instruction at the very start of every
--no-interactive
session:NOTE: This session is running with '--no-interactive'.
Do not ask for confirmation or additional input.
Proceed automatically, using any necessary tools, and output the final result.
Implementation
crates/chat-cli/src/cli/chat/mod.rs
ChatArgs::no_interactive
istrue
, prepend the constantNON_INTERACTIVE_INSTRUCTION
to the first user prompt (or create an input if only stdin was provided).
Testing
y/n
confirmation.fs_write
immediately, createdhello.txt
, exited—no prompts.--no-interactive
unchanged.Thank you for reviewing! 🙌