copilot: Fix Copilot fails to sign in on newer versions (#36195)

Follow-up for #36093 and
https://github.com/zed-industries/zed/pull/36138

Since v1.355.0, `@github/copilot-language-server` has stopped responding
to `CheckStatus` requests if a `DidChangeConfiguration` notification
hasn’t been sent beforehand. This causes `CheckStatus` to remain in an
await state until it times out, leaving the connection stuck for a long
period before finally throwing a timeout error.

```rs
let status = server
    .request::<request::CheckStatus>(request::CheckStatusParams {
        local_checks_only: false,
    })
    .await
    .into_response() // bails here with ConnectionResult::Timeout
    .context("copilot: check status")?;
````

This PR fixes the issue by sending the `DidChangeConfiguration`
notification before making the `CheckStatus` request. It’s just an
ordering change i.e. no other LSP actions occur between these two calls.
Previously, we only updated our internal connection status and UI in
between.

Release Notes:

- Fixed an issue where GitHub Copilot could get stuck and fail to sign
in.
This commit is contained in:
smit 2025-08-14 23:28:15 +05:30 committed by GitHub
parent 1a169e0b16
commit 2acfa5e948
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 83 additions and 84 deletions

View file

@ -29,13 +29,11 @@ pub struct NodeBinaryOptions {
pub use_paths: Option<(PathBuf, PathBuf)>,
}
#[derive(Default)]
pub enum VersionCheck {
/// Check whether the installed and requested version have a mismatch
VersionMismatch,
/// Only check whether the currently installed version is older than the newest one
#[default]
OlderVersion,
pub enum VersionStrategy<'a> {
/// Install if current version doesn't match pinned version
Pin(&'a str),
/// Install if current version is older than latest version
Latest(&'a str),
}
#[derive(Clone)]
@ -295,8 +293,7 @@ impl NodeRuntime {
package_name: &str,
local_executable_path: &Path,
local_package_directory: &Path,
latest_version: &str,
version_check: VersionCheck,
version_strategy: VersionStrategy<'_>,
) -> bool {
// In the case of the local system not having the package installed,
// or in the instances where we fail to parse package.json data,
@ -317,13 +314,20 @@ impl NodeRuntime {
let Some(installed_version) = Version::parse(&installed_version).log_err() else {
return true;
};
let Some(latest_version) = Version::parse(latest_version).log_err() else {
return true;
};
match version_check {
VersionCheck::VersionMismatch => installed_version != latest_version,
VersionCheck::OlderVersion => installed_version < latest_version,
match version_strategy {
VersionStrategy::Pin(pinned_version) => {
let Some(pinned_version) = Version::parse(pinned_version).log_err() else {
return true;
};
installed_version != pinned_version
}
VersionStrategy::Latest(latest_version) => {
let Some(latest_version) = Version::parse(latest_version).log_err() else {
return true;
};
installed_version < latest_version
}
}
}
}