-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Description
Users are reporting that a notification "Global flags setting changed. Reload window to apply." pops up every time they connect to a workspace, even when the coder.globalFlags setting is the default empty array and hasn't been modified.
Steps to Reproduce
- Install the VS Code Coder extension v1.11.5
- Leave
coder.globalFlagsat the default (empty array[]) - Connect to any Coder workspace
- Observe the notification appears
- Disconnect and reconnect - notification appears again
Expected Behavior
The notification should only appear when the user actually changes the coder.globalFlags setting value.
Actual Behavior
The notification appears on every connection, regardless of whether the setting has changed.
Root Cause Analysis
The bug was introduced in commit c394308 which added the watchSettings function in src/remote/remote.ts.
The current implementation uses e.affectsConfiguration(setting) to detect changes:
private watchSettings(
settings: Array<{ setting: string; title: string }>,
): vscode.Disposable {
return vscode.workspace.onDidChangeConfiguration((e) => {
for (const { setting, title } of settings) {
if (!e.affectsConfiguration(setting)) {
continue;
}
vscode.window
.showInformationMessage(
`${title} setting changed. Reload window to apply.`,
"Reload",
)
// ...
}
});
}The issue is that affectsConfiguration() can return true even when the actual value hasn't changed. This is a known VS Code API behavior - it fires when:
- The configuration scope changes (e.g., workspace vs user settings)
- VS Code re-reads settings during Remote SSH connection setup
- Settings are "touched" without the actual value changing
Suggested Fix
The watcher should compare the actual value before/after, not just check if the configuration "might" have changed. The previous watchLogDirSetting function that was replaced actually did this correctly:
const newLogDir = this.getLogDir(featureSet);
if (newLogDir === currentLogDir) {
return; // Skip if value unchanged
}A similar pattern should be applied to watchSettings - store the initial values of watched settings and only show the notification when the value actually differs.
Environment
- Extension version: v1.11.5
- VS Code version: Various
- OS: Various (reported on multiple platforms)