[Bug] "Tool approval required" in run mode tells you to use --mode auto-accept when you are already in it, and the alwaysAllow hint names the wrong place
Description
nanocoder run defaults to auto-accept, which still asks before running shell commands, so a typical first task ("write a function and run its test") stops with Tool approval required for: execute_bash. The message always says Re-run with --mode auto-accept or --mode yolo, ..., even when the run is already in auto-accept. It also says to add the tool to agents.config.json "alwaysAllow" without saying that the key must be inside the nanocoder object. A top-level alwaysAllow is ignored.
Environment
- OS: Windows 11 (10.0.26300)
- Node version: 22.22.3
- Nanocoder version: 1.31.0 (main at 9d88dda7)
- Provider: Ollama
- Model: qwen2.5:1.5b
Steps to Reproduce
- Run
nanocoder --trust-directory run "Use the execute_bash tool to run the command: echo hello". - Run the same with
--mode normal, then with--mode yolo. - Put
"alwaysAllow": ["execute_bash"]at the top level ofagents.config.json(next tonanocoder) and run step 1 again. - Move it inside the
nanocoderobject and run step 1 again.
Expected Behavior
The hint only suggests things that would change the result. In auto-accept it points to --mode yolo or to "nanocoder": {"alwaysAllow": ["execute_bash"]}.
Actual Behavior
default (auto-accept): nanocoder · Ollama · qwen2.5:1.5b · auto-accept
Tool approval required for: execute_bash. Re-run with --mode auto-accept or --mode yolo, or add the tools to agents.config.json "alwaysAllow". (exit 2)
--mode normal: same message (correct here)
--mode yolo: command runs, prints hello (exit 0)
top-level alwaysAllow: same "Tool approval required" message (exit 2)
nanocoder.alwaysAllow: command runs (exit 0)
Suggested Fix
source/plain/shell.ts:412-415: pass the current mode into the message. Innormal, suggestauto-acceptoryolo. Inauto-accept, suggestyolooralwaysAllow. Show the real shape:{"nanocoder": {"alwaysAllow": ["execute_bash"]}}.- Add a test with the run mode set to
auto-acceptthat checks the text does not say--mode auto-accept. - Optionally mention in
docs/getting-started/index.mdthatrunwill not run shell commands without this.
Additional Context
- Open PR #1665 edits the same area of
plain/shell.ts; coordinate with it. - [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
Hey , @addyCooks Shall i pick up this one up ? :)
Go for it @diyaavirmani
@addyCooks the fix for this is up in #1799 (review feedback addressed, all checks green, no conflicts). Would you be able to take a look when you have a moment? Thanks!