When the extension reconstructs the messages in convert.ts, specifically in the role handling in func mapRole, system is never an option and default is set to "user", VSCode's internal LanguageModelChatMessageRole only returns role ids for user and assistant too. The "tool" role seems to be set in some other manner (I didn't dive deeper), as it's being set correctly.
This results in the role system being set as role user (image below) which may lead to the model treating the system instructions as just another conversational turn rather than binding rules, making it more likely to ignore them, make it more susceptible to context window pollution and degraded tool performance. That said, the impact is probably model dependent. How strictly DeepSeek enforces the system role vs. treating a user message as authoritative, and how DeepSeek treats the system role when it comes to it's attention techniques (CSA, HCA, Sliding Window, Attention Sink). Without benchmarks, this is only a plausible concern, not a proven effect.
VSCode internal LanguageModelChatMessageRole
/**
* Represents the role of a chat message. This is either the user or the assistant.
*/
export enum LanguageModelChatMessageRole {
/**
* The user role, e.g the human interacting with a language model.
*/
User = 1,
/**
* The assistant role, e.g. the language model generating responses.
*/
Assistant = 2
}
|
function mapRole(role: vscode.LanguageModelChatMessageRole): 'user' | 'assistant' { |
function mapRole(role: vscode.LanguageModelChatMessageRole): 'user' | 'assistant' {
switch (role) {
case vscode.LanguageModelChatMessageRole.User:
return 'user';
case vscode.LanguageModelChatMessageRole.Assistant:
return 'assistant';
default:
return 'user';
}
}
Resulting in
A potential fix could be forcefully set the first message of any chat as a system prompt.
When the extension reconstructs the messages in convert.ts, specifically in the role handling in func mapRole, system is never an option and default is set to "user", VSCode's internal LanguageModelChatMessageRole only returns role ids for user and assistant too. The "tool" role seems to be set in some other manner (I didn't dive deeper), as it's being set correctly.
This results in the role system being set as role user (image below) which may lead to the model treating the system instructions as just another conversational turn rather than binding rules, making it more likely to ignore them, make it more susceptible to context window pollution and degraded tool performance. That said, the impact is probably model dependent. How strictly DeepSeek enforces the system role vs. treating a user message as authoritative, and how DeepSeek treats the system role when it comes to it's attention techniques (CSA, HCA, Sliding Window, Attention Sink). Without benchmarks, this is only a plausible concern, not a proven effect.
VSCode internal LanguageModelChatMessageRole
deepseek-v4-for-copilot/src/provider/convert.ts
Line 113 in 30dae47
Resulting in
A potential fix could be forcefully set the first message of any chat as a system prompt.