Skip to content

fix(chat): make --no-interactive truly non-interactive #2320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

laharigandrapu11
Copy link

Fix --no-interactive still prompting for confirmation

Closes #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
    • When ChatArgs::no_interactive is true, prepend the constant NON_INTERACTIVE_INSTRUCTION
      to the first user prompt (or create an input if only stdin was provided).
    • Instruction is added once and does not affect later prompts.

Testing

# style / lints
cargo +nightly fmt
cargo clippy --all-targets -- -D warnings

# full test suite
cargo test   # 216 passed

# manual check
cargo run --bin chat_cli -- login   # one-time auth

cargo run --bin chat_cli -- \
  chat --no-interactive --trust-all-tools \
  "Create a simple hello.txt file"
  • Before patch: CLI asked for y/n confirmation.
  • After patch: CLI executed fs_write immediately, created hello.txt, exited—no prompts.
  • Behaviour without --no-interactive unchanged.
image

Thank you for reviewing! 🙌

@laharigandrapu11 laharigandrapu11 changed the title fix: make --no-interactive truly non-interactive fix(chat): make --no-interactive truly non-interactive Jul 16, 2025
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.

Chat stops because it expects user interaction while running with --no-interactive option
1 participant