@@ -36,7 +36,10 @@ use std::sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock};
3636use std:: thread;
3737use std:: time:: { Duration , Instant } ;
3838
39- const DEFAULT_INITIALIZE_TIMEOUT_MS : u64 = 10_000 ;
39+ // Cold language-server runtimes can spend more than ten seconds loading their
40+ // bundles before answering initialize. This remains one bounded handshake,
41+ // independent of request deadlines, with normal cancellation and disposal.
42+ const DEFAULT_INITIALIZE_TIMEOUT_MS : u64 = 60_000 ;
4043const DEFAULT_REQUEST_TIMEOUT_MS : u64 = 30_000 ;
4144const DEFAULT_SHUTDOWN_TIMEOUT_MS : u64 = 2_000 ;
4245/// Upper bound of one build-provider request. A model request can load a
@@ -6233,6 +6236,28 @@ mod tests {
62336236 }
62346237 }
62356238
6239+ /// A real cold Windows language server can take longer than ten seconds.
6240+ /// Exercise the omitted-field default with an injected instant: it must
6241+ /// allow that handshake while still disposing of a server that never replies.
6242+ #[ test]
6243+ fn default_initialize_budget_survives_cold_start_and_still_expires ( ) {
6244+ let parsed: StartServerRequest = serde_json:: from_value ( json ! ( {
6245+ "providerId" : "cold-fixture" , "executablePath" : "/scripted-server" ,
6246+ "rootUri" : "file:///workspace" , "workingDirectory" : "/workspace"
6247+ } ) )
6248+ . unwrap ( ) ;
6249+ let harness = Harness :: start ( |request| {
6250+ request. initialize_timeout_milliseconds = parsed. initialize_timeout_milliseconds ;
6251+ } ) ;
6252+ let session = harness. session ( ) ;
6253+ let now = Instant :: now ( ) ;
6254+ session. expire_deadlines_at ( now + Duration :: from_secs ( 15 ) ) ;
6255+ assert_eq ! ( harness. snapshot( ) . state, LspLifecycleState :: Initializing ) ;
6256+ session. expire_deadlines_at ( now + Duration :: from_secs ( 61 ) ) ;
6257+ assert_eq ! ( harness. snapshot( ) . state, LspLifecycleState :: Failed ) ;
6258+ assert ! ( session. process. exit_status( ) . is_some( ) ) ;
6259+ }
6260+
62366261 /// Criterion 1: a spawned process that never initializes cannot become ready.
62376262 #[ test]
62386263 fn a_server_that_never_answers_initialize_fails_instead_of_becoming_ready ( ) {
0 commit comments