Skip to content

"Global flags setting changed" notification appears on every connection #681

@blinkagent

Description

@blinkagent

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

  1. Install the VS Code Coder extension v1.11.5
  2. Leave coder.globalFlags at the default (empty array [])
  3. Connect to any Coder workspace
  4. Observe the notification appears
  5. 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)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions