Repository navigation
Description
Bug
Two IConfigurationValue property accesses introduced in bb18007 use the IInspectValue<T> object property instead of the scalar value property, causing incorrect scope detection.
1. themeConfiguration.ts - findAutoConfigurationTarget()
Line 380 checks settings.userRemote instead of settings.userRemoteValue:
public findAutoConfigurationTarget(key: string) {
const settings = this.configurationService.inspect(key);
if (!types.isUndefined(settings.workspaceFolderValue)) { // ✓ scalar
return ConfigurationTarget.WORKSPACE_FOLDER;
} else if (!types.isUndefined(settings.workspaceValue)) { // ✓ scalar
return ConfigurationTarget.WORKSPACE;
} else if (!types.isUndefined(settings.userRemote)) { // ✗ IInspectValue object
return ConfigurationTarget.USER_REMOTE;
}
return ConfigurationTarget.USER;
}settings.userRemote is an IInspectValue<T> object ({value?, override?, overrides?}). It can be defined when only language-specific overrides exist in the remote config, even if no actual remote value is set. This causes theme settings to incorrectly target USER_REMOTE scope.
2. commandLineAutoApprover.ts - source target detection
Line 282 checks configInspectValue.workspaceFolder instead of configInspectValue.workspaceFolderValue:
const sourceTarget = (
checkTarget(configInspectValue.workspaceFolder) ? ConfigurationTarget.WORKSPACE_FOLDER
: checkTarget(configInspectValue.workspaceValue) ? ConfigurationTarget.WORKSPACE
: checkTarget(configInspectValue.userRemoteValue) ? ConfigurationTarget.USER_REMOTE
...
);configInspectValue.workspaceFolder is an IInspectValue<T> whose keys are {value, override, overrides}. The checkTarget function looks for tool-pattern keys (e.g., "git*") via hasOwnProperty, which never matches on IInspectValue. This means workspace-folder-scoped auto-approve rules are never detected as such and fall through to a lower-priority scope.
Root Cause
Both are from the same commit (bb18007) and follow the same pattern: the IConfigurationValue<T> interface exposes both scalar values (e.g., userRemoteValue: T) and inspect objects (e.g., userRemote: IInspectValue<T>). The similar naming makes it easy to pick the wrong one.
Fix
settings.userRemote->settings.userRemoteValueconfigInspectValue.workspaceFolder->configInspectValue.workspaceFolderValue
Activity
khalidsaidi commentedon Mar 14, 2026
A2ABench has an accepted answer for this imported thread.
partner-fast-2sandy081 commentedon Mar 18, 2026
Thank you for the detailed analysis! To help us investigate this further, could you provide specific steps to reproduce the issue? For example, a scenario where the configuration target is incorrectly detected — such as a setting unexpectedly targeting USER_REMOTE or a workspace-folder auto-approve rule not being recognized. While the code references are appreciated, having a concrete repro scenario would help us confirm the behavior and prioritize a fix. Thank you!
ShehabSherif0 commentedon Mar 19, 2026
Sandeep Somavarapu (@sandy081) Thank you for the quick response! Here are the detailed reproduction steps and the type-level analysis for both bugs.
Bug 2:
commandLineAutoApprover.ts(actively used, reproducible)Steps to reproduce:
.vscode/settings.json, add:{ "terminal.chat.agentTools.autoApprove": { "git*": true } }git*(e.g.,git status)sourceTargetExpected: The matched rule's
sourceTargetshould beConfigurationTarget.WORKSPACE_FOLDER, and the UI label should show "(workspace)".Actual: The
sourceTargetfalls through to a lower-priority scope becausecheckTarget(configInspectValue.workspaceFolder)passes theIInspectValueobject (with shape{value?, override?, overrides?}) instead of the scalar config value.Why it fails:
The
checkTargetfunction does:When called with
configInspectValue.workspaceFolder(anIInspectValue), the object's own keys are{value, override, overrides}. SohasOwnProperty(obj, "git*")always returnsfalse, and the workspace-folder scope is never matched.When called with
configInspectValue.workspaceFolderValue(the scalarT), the object is{"git*": true}. SohasOwnProperty(obj, "git*")correctly returnstrue.Note: The remaining scopes in the same ternary chain (
workspaceValue,userRemoteValue,userLocalValue,userValue,applicationValue) already use the correct*Valueproperties. OnlyworkspaceFolderwas wrong.Bug 1:
themeConfiguration.ts(currently dead code, but still incorrect)findAutoConfigurationTargetcurrently has zero callers in the codebase, so this has no runtime impact today. However, the code is still wrong for the same reason:settings.userRemoteisIInspectValue<T>, not the scalarTvalue. ThetoInspectValue()method inConfigurationInspectValue(configurationModels.ts#L574) returns a defined object when any ofvalue,override, oroverridesexist:This means
settings.userRemotecan be non-undefined (e.g., because language-specific overrides exist in the remote config) whilesettings.userRemoteValue(the actual scalar value) isundefined. So checking!types.isUndefined(settings.userRemote)can incorrectly returntrue.Root cause
Both are from commit bb18007 where these files were created as new files. The
IConfigurationValue<T>interface exposes both scalar values (e.g.,userRemoteValue: T) and inspect objects (e.g.,userRemote: IInspectValue<T>). The similar naming makes it easy to pick the wrong one.The fix (in PR #301472)
Both are single-property corrections:
configInspectValue.workspaceFolder->configInspectValue.workspaceFolderValuesettings.userRemote->settings.userRemoteValueThe PR also includes a regression test that stubs
configurationService.inspect()to return aworkspaceFolderValuecontaining a rule key and asserts the matched rule reportssourceTargetasConfigurationTarget.WORKSPACE_FOLDER.9 remaining items
gjsjohnmurray commentedon May 5, 2026
Case 2 looks similar to #301508. Alex Ross (@alexr00) when you removed this from the 1.117.0 milestone was it intentional that you didn't add it to another? I worry about it now being lost in space.
alexr00 commentedon May 5, 2026
John Murray (@gjsjohnmurray) as part of our weekly release process we ask team members to move their issues off of the milestone that we're releasing themselves. If they don't, then they risk losing their issues in space 🌠