Repository navigation
fix(vscode): start new sessions in the configured defaultMode - #2468
Open
Dhirenderchoudhary wants to merge 1 commit into
Open
Dhirenderchoudhary wants to merge 1 commit into
Dhirenderchoudhary wants to merge 1 commit into
Conversation
Dhirenderchoudhary
requested review from
addyCooks,
akramcodez and
will-lamerton
as code owners
November 29, 2026 12:10
Contributor
|
nc-review could not produce a verdict this run (agent exit |
will-lamerton
approved these changes
Nov 29, 2026
will-lamerton
left a comment
Member
There was a problem hiding this comment.
Thanks @Dhirenderchoudhary, this is correct and well documented:
- Precedence is explicit
nanocoder.mode>--mode>defaultMode>auto-accept, and the code,docs/features/acp.mdandvscode-extension.mdagree. Usingconfig.inspect()instead ofget()stops the manifest default from forcing a mode, including when the setting is cleared. - No mode from the client: the ACP agent reads
defaultModefrom the session folder's config vialoadDefaultMode()and validates it againstVALID_MODES. - No new exposure: a project
agents.config.jsonsettingdefaultModebehaves as it already does in the CLI, and ACP sessions require the folder to pass the directory-trust check. Specs pass (181/181).
Nit: the changeset could mention that a trusted project's defaultMode now sets the sidebar's starting mode, since that's new for extension users.
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
Fixes #1722.
Changing Default mode in the VS Code Settings tab did nothing for new sidebar sessions:
_createSession()usedconfig.get('mode') || 'auto-accept'. The manifest declares a default fornanocoder.mode, soget()always returned a value and the client forced every new session into it.nanocoder.defaultMode. Sessions started in--mode(or the profile mode), elseauto-accept.get()too, so clearingnanocoder.modeswitched the open session to the manifest default.What changed:
acp-agent.ts:registerSessionusesinitialMode ?? loadDefaultMode(). It runs inside the session's context, so it reads the session folder's config (profile, project, then global).loadDefaultModealready validates against the known modes.acp-client.ts: a smallexplicitModeSetting()readsconfig.inspect('mode')(folder, workspace, then user value) and ignores the manifest default. A new session is only switched when the user setnanocoder.mode. The change listener uses the same helper.newSession.Precedence for a new sidebar session is now: explicit
nanocoder.mode(if it's one of the agent's modes) >--mode>defaultMode>auto-accept.The mode selector still saves the picked mode to
nanocoder.mode, as before, so after a pick that value outranksdefaultModeuntil it's cleared. The docs and the setting description now say this. I didn't change the selector, to keep this PR to the precedence fix.Type of Change
Changeset
pnpm changeset) describing this change for the changelogDocs-only or internal chores need no changeset (or run
pnpm changeset --emptyto note that intentionally).Testing
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
acp-client.spec.ts: an unsetnanocoder.modekeeps the agent's mode, an explicit one overrides it, a workspace value beats a user value, an unknown value is ignored, and clearing the setting doesn't switch the open session.acp-agent.spec.ts: new, load and resume start in the project'sdefaultMode,--modebeats it, and an unknowndefaultModefalls back toauto-accept.The "unset keeps the agent's mode", "clearing doesn't switch" and "starts in defaultMode" tests fail on main. The
vscodetest stub gainedinspect(). Rantsc --noEmitfor both projects,pnpm test:format,pnpm test:lint,pnpm test:knip, and ava onplugins/vscodeandsource/acp(814 tests).Manual Testing
Checklist
Docs:
docs/features/vscode-extension.md,docs/features/acp.mdanddocs/configuration/index.mdnow describe the order. No new logging.