Repository navigation
fix(vscode): make defaultMode the source of truth for new session mode - #1928
Closed
Mahdi-Hasan wants to merge 1 commit into
Closed
Mahdi-Hasan wants to merge 1 commit into
Mahdi-Hasan wants to merge 1 commit into
Conversation
Mahdi-Hasan
requested review from
addyCooks,
akramcodez and
will-lamerton
as code owners
November 2, 2026 12:19
Contributor
|
nc-review could not produce a verdict this run (agent exit |
The default mode had three sources that disagreed. The Settings tab
writes nanocoder.defaultMode to agents.config.json, but the ACP agent
started every session in auto-accept unless --mode was passed, and the
extension then forced nanocoder.mode on top. That setting declared an
auto-accept default, so config.get('mode') always returned a value and
defaultMode never took effect.
The ACP agent now starts a session in --mode, then defaultMode from
agents.config.json via loadDefaultMode(), which already validates the
value against VALID_MODES, then auto-accept. It reads defaultMode when
each session is registered, so a change from the Settings tab applies
to the next new chat without restarting the agent.
The extension reads nanocoder.mode with inspect() and only overrides
the agent's mode when the user set it at user, workspace or folder
level. A value the agent does not offer is logged and ignored. The
manifest default for nanocoder.mode is gone, so the settings UI no
longer shows a value that is not applied.
The mode selector still writes nanocoder.mode, so a mode picked there
keeps winning over defaultMode until the setting is cleared. The ACP
and extension docs describe that order.
Tests cover the agent order (defaultMode, --mode over it, invalid and
missing values, a change between sessions) and the extension side
(inspect scopes, unset setting keeps the agent mode, explicit setting
overrides it, unknown value is ignored).
Fixes Nano-Collective#1722
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mahdi-Hasan
force-pushed
the
fix/1722-default-mode-source-of-truth
branch
from
November 2, 2026 12:24
31293db to
ba834bd
Compare
Contributor
Author
|
Closing this since #1722 is assigned to @Dhirenderchoudhary. Thanks for taking a look! |
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes
defaultModeinagents.config.jsonthe source of truth for the starting mode of new sessions. Fixes #1722.Starting mode, highest priority first:
nanocoder.modein VS Code settings, only when the user set it explicitly (user, workspace or folder level)--modepassed to the ACP agentnanocoder.defaultModefromagents.config.jsonauto-acceptregisterSessionusesinitContext.initialMode ?? loadDefaultMode().loadDefaultMode()already validates againstVALID_MODES. It runs for each session, so changing the default in the Settings tab applies to the next new chat without restarting the agent._createSession()readsnanocoder.modewithconfig.inspect()instead ofget().get()always returned the manifest default, which hiddefaultMode. A value the agent doesn't offer is logged and ignored. I removed the manifest default fornanocoder.mode, so the settings UI no longer shows a value that is never applied.acp.mdandvscode-extension.mddescribe the new order.nanocoder.mode. A mode picked there keeps overridingdefaultModeuntil that setting is cleared.Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
New features include passing tests in
.spec.ts/tsxfilesAll existing tests pass (
pnpm test:allcompletes successfully)Tests cover both success and error scenarios
source/acp/acp-agent.spec.ts(5 new):defaultModeis used.--modebeats it.auto-accept.plugins/vscode/src/acp-client.spec.ts(6 new):inspectscope order.Format, types (root and vscode), lint, knip and audit pass.
I developed this on Windows, where
pnpm test:avahas many failures onmaintoo. This branch adds no new failures.Manual Testing
Checklist
Possible follow-ups, not in this PR:
defaultModeis unset, but sidebar chats fall back toauto-accept.validModesinsettings-manager.tsleaves outarchitect.🤖 Generated with Claude Code