nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[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

Open addyCooks opened this issue 1 month ago • 3 comments

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

  1. Run nanocoder --trust-directory run "Use the execute_bash tool to run the command: echo hello".
  2. Run the same with --mode normal, then with --mode yolo.
  3. Put "alwaysAllow": ["execute_bash"] at the top level of agents.config.json (next to nanocoder) and run step 1 again.
  4. Move it inside the nanocoder object 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. In normal, suggest auto-accept or yolo. In auto-accept, suggest yolo or alwaysAllow. Show the real shape: {"nanocoder": {"alwaysAllow": ["execute_bash"]}}.
  • Add a test with the run mode set to auto-accept that checks the text does not say --mode auto-accept.
  • Optionally mention in docs/getting-started/index.md that run will 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

addyCooks avatar Oct 13 '26 12:10 addyCooks

Hey , @addyCooks Shall i pick up this one up ? :)

diyaavirmani avatar Oct 14 '26 07:10 diyaavirmani

Go for it @diyaavirmani

addyCooks avatar Oct 15 '26 07:10 addyCooks

@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!

diyaavirmani avatar Oct 24 '26 17:10 diyaavirmani