nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Multiple conflicting default mode settings between agents.config.json, package.json manifest, and ACP backend

Open akramcodez opened this issue 1 month ago • 6 comments

Description

There are multiple conflicting sources of truth for default session mode:

  1. SettingsManager.updateSetting('defaultMode', ...) writes to agents.config.json under nanocoder.defaultMode.
  2. The extension manifest (plugins/vscode/package.json) defines "nanocoder.mode" with default "auto-accept".
  3. acpClient._createSession() reads vscode.workspace.getConfiguration('nanocoder').get('mode') || 'auto-accept'. Because the manifest defines a default value, config.get('mode') is always populated, completely masking any defaultMode set in agents.config.json.
  4. The backend ACP agent (source/acp/acp-agent.ts:821) hardcodes initialMode: 'auto-accept'.

Editing the default mode in the extension's Settings panel writes to agents.config.json, which has zero effect on new sessions.

Environment

  • OS: Linux (reviewed); macOS / Windows potentially affected
  • Node version: >= 22.0.0
  • Nanocoder version: 1.31.0

Steps to Reproduce

  1. Open the Nanocoder Settings panel in VS Code.
  2. Change the default mode to normal or plan.
  3. Start a new session.
  4. Check the mode assigned to the newly created session.

Expected Behavior

Settings configured in the UI should control new session defaults with a documented precedence hierarchy respecting Nanocoder's project and global configuration resolution: Explicit session selection > VS Code explicit setting (nanocoder.mode) > Project/global configuration (defaultMode) > Fallback default (auto-accept).

Actual Behavior

Changes made in the Settings panel update agents.config.json, but acpClient always applies the manifest default of nanocoder.mode.

Additional Context

  • [x] No matching open issue found in issue search performed on 2026-10-12
  • [x] Relevant code paths inspected at commit d5ff9c37

Implementation Notes (optional)

  • Files:
    • plugins/vscode/src/settings-manager.ts:167
    • plugins/vscode/src/acp-client.ts:228-250
    • source/acp/acp-agent.ts:815-825
  • In _createSession(), check whether nanocoder.mode was explicitly configured by the user (using inspect('mode')). If not explicitly configured, resolve defaultMode from project/global Nanocoder configuration before falling back to auto-accept.

akramcodez avatar Oct 12 '26 11:10 akramcodez

@addyCooks can i go for it

Dhirenderchoudhary avatar Oct 12 '26 17:10 Dhirenderchoudhary

I'd like to pick this up. Proposed resolution order:

  1. nanocoder.defaultMode in agents.config.json is the source of truth.
  2. The VS Code nanocoder.mode setting only overrides it when the user set it explicitly. Use config.inspect('mode') instead of get('mode'), since get always returns the manifest default.
  3. The ACP agent reads the configured default instead of hardcoding initialMode: 'auto-accept', and falls back to auto-accept only when nothing is set.

Values get validated against the allowed modes, with unit tests for the resolution order. Could you assign it to me?

Mahdi-Hasan avatar Nov 02 '26 11:11 Mahdi-Hasan

Hi @Mahdi-Hasan, thanks for your interest! @Dhirenderchoudhary asked to be assigned to this issue first, so I've assigned it to them. Please have a look at our other open issues, and I'd be happy to assign you one of those.

addyCooks avatar Nov 03 '26 06:11 addyCooks

Thanks @addyCooks, no problem. I've closed #1928.

I'd be glad to take #1930 (string_replace on CRLF files) or #1932 (MCP results keep only the first content block). Neither has a claim yet. Could you assign one of them to me?

Mahdi-Hasan avatar Nov 03 '26 06:11 Mahdi-Hasan

Thanks @Mahdi-Hasan for closing #1928. Both #1930 and #1932 are good picks. Which one would you like to take? Please comment on that issue saying you're picking it up, and I'll assign it to you.

addyCooks avatar Nov 04 '26 06:11 addyCooks

Thanks @addyCooks. I've commented on #1932 saying I'm picking it up.

Mahdi-Hasan avatar Nov 04 '26 06:11 Mahdi-Hasan