Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin appends value to PATH for terminal such that terminal PATH is different than VSCode's #3597

Closed
dsherret opened this issue Dec 27, 2024 · 13 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@dsherret
Copy link

dsherret commented Dec 27, 2024

  • Copilot Chat Extension Version: 0.23.2
  • VS Code Version: 1.254.0
  • OS Version: Windows 11
  • Logs:

Steps to Reproduce:

  1. Enable extension
  2. Open vscode terminal
  3. View the PATH env var
  4. Close vscode terminal
  5. Disable extension
  6. Restart extensions
  7. Open vscode terminal
  8. View the PATH env var (in my case, it now has ;c:\Users\david\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand appended so it differs from vscode)

This is a problem because many tools will do stuff like recompile when changes to the env vars (specifically PATH) happen. So for example, you run cargo check in the terminal, then your editor does cargo check and now a recompile happens because certain dependencies cache bust on the PATH changing.

Related issue microsoft/vscode#237338

@github-actions github-actions bot added the triage-needed Issues needing to be assigned to the prospective feature owner label Dec 27, 2024
@sbatten sbatten assigned connor4312 and unassigned isidorn Dec 28, 2024
@vs-code-engineering vs-code-engineering bot removed the triage-needed Issues needing to be assigned to the prospective feature owner label Dec 28, 2024
@connor4312
Copy link
Member

You can turn this off with the setting "github.copilot.chat.startDebugging.enabled": false,

@connor4312 connor4312 added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Jan 6, 2025
@dsherret
Copy link
Author

dsherret commented Jan 6, 2025

@connor4312 I set that setting and the path in the terminal still contains c:\Users\david\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand

@connor4312
Copy link
Member

After changing that setting, you'll need to reload any existing terminals you have or recreate a new terminal where that path won't be present

@dsherret
Copy link
Author

dsherret commented Jan 6, 2025

I restarted vscode.

@dsherret
Copy link
Author

dsherret commented Jan 6, 2025

Also, I tried appending this to the path before launching vscode (in hopes that the path would remain the same if that string was already on the path) and it results in duplicate entries in the path:

;c:\Users\david\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand;c:\Users\david\AppData\Roaming\Code\User\globalStorage\github.copilot-chat\debugCommand

@dsherret
Copy link
Author

dsherret commented Jan 6, 2025

I added some code in registerEnvironment() where this code appends to the path and I can see the configuration is disabled for startDebugging on the configuration service, yet it still appends to the PATH:

{
  "_store": { "_toDispose": {}, "_isDisposed": false },
  // ...
  "config": {
    // ...
    "chat": {
      // ...
      "startDebugging": { "enabled": false },
       // ...
    }
  }
}

@connor4312
Copy link
Member

This appears to work well for me 🤔

25-01-922c4da0-b763-412f-bbdf-5b1a409e4755.mp4

@dsherret
Copy link
Author

dsherret commented Jan 9, 2025

Hmmm weird. I tried setting:

"github.copilot.chat.startDebugging.enabled": false,
"github.copilot.chat.copilotDebugCommand.enabled": false

In both my user settings and local project .vscode settings. Then I tried the pre-release of the extension and vscode insiders, but no luck. This would be a lot easier if this extension was open source because I could debug it locally without having to wade through minified code.

@connor4312 connor4312 reopened this Jan 9, 2025
@dsherret
Copy link
Author

dsherret commented Jan 9, 2025

Figured it out. I needed to comment out the third parameter in this code otherwise it always returns true:

U.TerminalToDebuggerEnabled = Xt(
			"chat.copilotDebugCommand.enabled",
			!0,
			//ci,
		);

I think due to it being internal && valueIgnoredForExternals? My guess is that it works for you being a developer on the team, but not for me due to that.

this._isInternal === t.isInternal &&
					this._isTeamMember === t.isTeamMember ||
				(this._isInternal = t.isInternal,
					this._isTeamMember = t.isTeamMember,
					this._onDidChangeConfiguration.fire({
						affectsConfiguration: () => !0,
					}));

@sgoev
Copy link

sgoev commented Jan 9, 2025

Figured it out. I needed to comment out the third parameter in this code otherwise it always returns true:

U.TerminalToDebuggerEnabled = Xt(
			"chat.copilotDebugCommand.enabled",
			!0,
			//ci,
		);

I think due to it being internal && valueIgnoredForExternals? My guess is that it works for you being a developer on the team, but not for me due to that.

this._isInternal === t.isInternal &&
					this._isTeamMember === t.isTeamMember ||
				(this._isInternal = t.isInternal,
					this._isTeamMember = t.isTeamMember,
					this._onDidChangeConfiguration.fire({
						affectsConfiguration: () => !0,
					}));

I faced the same issue:

"github.copilot.chat.startDebugging.enabled": false,
"github.copilot.chat.copilotDebugCommand.enabled": false

These settings don’t solve the problem.

The PATH variable in VS Code picks up this unescaped string.

Can you tell me where you are making these changes?

@dsherret
Copy link
Author

dsherret commented Jan 9, 2025

@sgoev in the folder where extensions are installed, there is a github.copilot-chat-xxxx extension folder where the -xxx corresponds to the version installed. Inside it in the dist/extension.js file, it is possible to search for the TerminalToDebuggerEnabled and there is a ci parameter:

Image

I just realized that might go against the extension's license and I did not mean to break it (I'm not 100% sure though). I'm only providing this information in hopes of getting this issue fixed.

@connor4312
Copy link
Member

Ahh, good debugging. I never removed that check when the feature was released 🤦

@sgoev
Copy link

sgoev commented Jan 9, 2025

Oh yes, this works! Thank you so much! I’m also eagerly waiting for fixes; this issue ruined my first day at work…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

4 participants