nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Auto Accept not Auto Accepting

Open JimStenstrom opened this issue 11 months ago • 6 comments

Reported by holger in discord.

— December 24th 2025 at 22:03 With auto accept on (enabled with shift+tab), nanocoder still ask for for confirmation at every turn. Is this intended

Auto-accept mode does not work correctly - tools still require confirmation even when auto-accept is enabled. This is caused by a state synchronization bug where the React state and global mode context get out of sync. Environment

OS: Any (bug is in application logic)
Node version: Any
Nanocoder version: Latest (as of commit b2cee65)
Provider: Any
Model: Any

Steps to Reproduce

Scenario 1: Non-interactive mode

Run nanocoder in non-interactive mode with a prompt: nanocoder --prompt "create a file called test.txt"
Observe that tools still require approval despite non-interactive mode setting auto-accept

Scenario 2: switch_mode tool

Start nanocoder in normal mode
Ask the AI to switch to auto-accept mode (triggers the switch_mode tool)
Observe that subsequent file write operations still require confirmation

Expected Behavior

In non-interactive mode, tools should auto-execute without requiring approval
After using the switch_mode tool to enable auto-accept, file operations should execute without confirmation prompts

Actual Behavior

Tools continue to require approval because the global mode context (checked by getCurrentMode()) is never updated, remaining at 'normal' while React state shows 'auto-accept'. Logs/Screenshots

Root Cause Analysis:

There are two sources of mode state:

React state: useState<DevelopmentMode>('normal') in useAppState.tsx:117
Global context: currentMode variable in mode-context.ts:8

The toggle handler (useAppHandlers.tsx:141-142) correctly updates both:

setCurrentModeContext(nextMode); // ✅ Updates global context return nextMode; // ✅ Updates React state

However, two other locations only update React state:

useNonInteractiveMode.ts:51

setDevelopmentMode('auto-accept'); // ❌ Missing: setCurrentModeContext('auto-accept')

useToolHandler.tsx:245

setDevelopmentMode(requestedMode); // ❌ Missing: setCurrentModeContext(requestedMode)

Tools check getCurrentMode() to determine approval requirements, so they see stale 'normal' value. Additional Context

I have searched existing issues to ensure this is not a duplicate
I can reproduce this issue consistently
This issue occurs with the latest version of nanocoder

Suggested Fix:

Add setCurrentModeContext() calls to both locations:

// useNonInteractiveMode.ts:51 import { setCurrentMode as setCurrentModeContext } from '@/context/mode-context'; // ... setDevelopmentMode('auto-accept'); setCurrentModeContext('auto-accept'); // Add this line

// useToolHandler.tsx:245 import { setCurrentMode as setCurrentModeContext } from '@/context/mode-context'; // ... setDevelopmentMode(requestedMode); setCurrentModeContext(requestedMode); // Add this line

JimStenstrom avatar Dec 26 '25 02:12 JimStenstrom

I'll take this with a PR coming in hot.

JimStenstrom avatar Dec 26 '25 03:12 JimStenstrom

Hello, auto-accept on my M1 MBA still does not work. It always asks for permission before, say, doing an execute_bash. I installed nanocoder within the last hour so I know I have the latest version.

moontato avatar Jan 05 '26 15:01 moontato

Hello, auto-accept on my M1 MBA still does not work. It always asks for permission before, say, doing an execute_bash. I installed nanocoder within the last hour so I know I have the latest version.

Hey! Execute bash is the one tool that's blocked out from auto-accept mode for the pure fact that allowing a model to auto-execute bash commands could very destructive if the wrong command is executed. We are currently working on config options where the user can configure tools and their permissions manually if they want (@namar0x0309).

will-lamerton avatar Jan 05 '26 15:01 will-lamerton

Hello, auto-accept on my M1 MBA still does not work. It always asks for permission before, say, doing an execute_bash. I installed nanocoder within the last hour so I know I have the latest version.

Hey! Execute bash is the one tool that's blocked from out from auto-accept mode for the pure fact that allowing a model to auto-execute bash commands could very destructive if the wrong command is executed. We are currently working on config options where the user can configure tools and their permissions manually if they want (@namar0x0309).

Oh I see, that makes sense. Thank you for the quick reply!

moontato avatar Jan 05 '26 15:01 moontato

Could we execute_bash look for command and/or subcommand in the CWD for auto accept? Like for ls and ls -al?

JimStenstrom avatar Jan 05 '26 20:01 JimStenstrom

Could we execute_bash look for command and/or subcommand in the CWD for auto accept? Like for ls and ls -al?

This could be a really decent addition. Like Claude Code. We could create a separate issue for this and happy for you to tackle if you wanted :)

will-lamerton avatar Jan 05 '26 22:01 will-lamerton