Verified Solution

[microsoft/vscode] Remove preselectModelFromSessionHistory in favour of ChatModel.inputModel

Sponsored Content
### ROOT CAUSE The issue arises because the `preselectModelFromSessionHistory` method is not compatible with Copilot CLI requests and does not properly handle the initialization of the model with agent and model IDs. This method is being replaced by `ChatModel.inputModel`, which requires explicit model and agent ID initialization. The current implementation relies on session history for model selection, which is insufficient for CLI requests. ### CODE FIX To resolve this, replace the `preselectModelFromSessionHistory` method with `ChatModel.inputModel` and ensure the agent ID and model ID are properly passed. Here's the fix: ```typescript // Replace this: const model = preselectModelFromSessionHistory(session); // With this: const agentId = session.agentId || request.agentId; // Get agent ID from session or request const modelId = session.modelId || request.modelId; // Get model ID from session or request const chatModel = new ChatModel(agentId, modelId); // Initialize using ChatModel.inputModel ``` **Changes Made:** 1. Removed `preselectModelFromSessionHistory` as it is deprecated. 2. Added explicit initialization of `ChatModel` with agent and model IDs from the session or request. 3. Ensured the code handles cases where IDs are missing by using fallbacks. This change ensures compatibility with Copilot CLI requests and properly initializes the model with the required parameters.
Deploy on DigitalOcean ($200 Credit)

Related Fixes

[StackOverflow/go] Bazel coverage with cache
[StackOverflow/kubernetes] Is there a way to get the cluster name of Kubernetes in Grafana variables with prometheus data source?
[tensorflow/tensorflow] Numerical discrepancy in tf.linalg.matmul vs PyTorch torch.matmul for 3D float32 tensors