You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] VS Code extension inconsistently applies nanocoder.cwd to new sessions, settings, and mention search #1720
The extension provides a nanocoder.cwd configuration setting. AcpProcessManager and the top-level nanocoder.openConfig command respect this setting. However, multiple other components in the extension host hardcode vscode.workspace.workspaceFolders?.[0]?.uri.fsPath || process.cwd().
Consequently, new session creation (newSession), settings-panel inspection, and @ mention file searches default to the first workspace folder rather than the configured nanocoder.cwd.
Environment
OS: Linux (reviewed); macOS / Windows potentially affected
Set "nanocoder.cwd" in VS Code settings to a specific subdirectory or secondary project path.
Open a workspace where the first workspace folder differs from nanocoder.cwd.
Start the extension and trigger session initialization (getOrCreateSession) or @ mention file search.
Expected Behavior
The extension should consistently respect nanocoder.cwd for new session creation, settings inspection, and mention searches rather than falling back to workspaceFolders?.[0]. Once a session starts, its working directory should remain stable rather than changing when editor focus moves.
Actual Behavior
AcpProcessManager.ts:113 and extension.ts:120 respect nanocoder.cwd, but chat-webview-provider.ts:512, 557, 570, 605, 679, 747, 884 bypass it and default to workspaceFolders?.[0].
Create a shared helper resolveExtensionCwd(): string in src/workspace-utils.ts that checks config.get('cwd') before falling back to workspaceFolders?.[0].
Replace ad-hoc workspaceFolders?.[0]?.uri.fsPath || process.cwd() expressions in chat-webview-provider.ts for new sessions, settings reading, and mention search.
Hey @akramcodez, I'd like to work on this issue. I'll follow the suggested approach by introducing a shared helper to resolve the working directory and updating the affected code paths to use it consistently.
Hey @akramcodez, @addyCooks the PR is ready for review Just one quick question: should I add an empty changeset or a patch changeset for this fix, since nanocoder-vscode is listed in the ignore section of .changeset/config.json?
Also @akramcodez, I've made the suggested changes, but I noticed a potential UX edge case. Please correct me if I'm wrong.
With the current approach, an explicitly configured nanocoder.cwd takes priority over the opened VS Code workspace.
For example, suppose I'm working on Project A, which has frontend and backend folders, and I explicitly set nanocoder.cwd to the backend directory. A few weeks later, I open a completely different Project B in VS Code but forget to update that setting.
In this case, Nanocoder would still use Project A's backend directory, including for @ mention searches, even though I'm now working in Project B.
This is technically correct since we're respecting the explicit configuration, but it could be confusing from a user's perspective.
Activity
Srinidhi444 commentedon Oct 12, 2026
Hey @akramcodez, I'd like to work on this issue. I'll follow the suggested approach by introducing a shared helper to resolve the working directory and updating the affected code paths to use it consistently.
akramcodez commentedon Oct 13, 2026
Sure @Srinidhi444 👍
Srinidhi444 commentedon Oct 13, 2026
Hey @akramcodez, @addyCooks the PR is ready for review Just one quick question: should I add an empty changeset or a patch changeset for this fix, since
nanocoder-vscodeis listed in theignoresection of.changeset/config.json?Srinidhi444 commentedon Oct 13, 2026
Also @akramcodez, I've made the suggested changes, but I noticed a potential UX edge case. Please correct me if I'm wrong.
With the current approach, an explicitly configured
nanocoder.cwdtakes priority over the opened VS Code workspace.For example, suppose I'm working on Project A, which has
frontendandbackendfolders, and I explicitly setnanocoder.cwdto thebackenddirectory. A few weeks later, I open a completely different Project B in VS Code but forget to update that setting.In this case, Nanocoder would still use Project A's
backenddirectory, including for@mention searches, even though I'm now working in Project B.This is technically correct since we're respecting the explicit configuration, but it could be confusing from a user's perspective.