Fix refresh failure caused by JSON-RPC sending [null] params to pet binary#1442
Merged
StellaHuang95 merged 1 commit intomicrosoft:mainfrom Apr 7, 2026
Merged
Fix refresh failure caused by JSON-RPC sending [null] params to pet binary#1442StellaHuang95 merged 1 commit intomicrosoft:mainfrom
StellaHuang95 merged 1 commit intomicrosoft:mainfrom
Conversation
edvilme
approved these changes
Apr 7, 2026
karthiknadig
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI checks are failing
"before all" hook for "All extension commands are registered"getEnvironments finds Python installations when availablerefreshEnvironments completes without errorRoot cause
getRefreshOptions()innativePythonFinder.tsreturnsundefinedwhen no specific search options are needed (the common case for a full refresh). Whenundefinedis passed toconnection.sendRequest('refresh', undefined, token), thevscode-jsonrpclibrary serializes it as positional params:[null].The pet binary's Rust deserializer handles
nulland[](empty array) correctly, but not[null](array containing null). Serde tries to interpret the 1-element array as aRefreshOptionsstruct with 2 fields and fails.Fix
Changed
getRefreshOptions()to return{}instead ofundefinedwhen no options are specified. This sends a proper empty JSON object over the wire, which the pet binary correctly deserializes intoRefreshOptions { search_kind: None, search_paths: None }— a full global search using configured workspace directories.Why
{}is safesearch_kindandsearch_pathsareOption<T>in Rust —Noneis the expected defaultnormalize_refresh_paramsalready convertsnull→{}, so{}is the canonical "no options" formatif let Some(...)guards — no.unwrap()callsRefreshOptions::default(){}with both fields asNonetriggers a full global search — identical behavior to beforeChanges
src/managers/common/nativePythonFinder.ts:getRefreshOptions()now returns{}instead ofundefined, and its return type is simplified fromRefreshOptions | undefinedtoRefreshOptions