Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/extension/prompts/node/agent/allAgentPrompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import './anthropicPrompts';
import './geminiPrompts';
import './vscModelPrompts';
// vscModelPrompts must be imported before gpt5Prompt to ensure VSC model prompt resolvers are registered first.
import './zaiPrompts';
import './openai/defaultOpenAIPrompt';
import './openai/gpt51CodexPrompt';
import './openai/gpt51Prompt';
import './openai/gpt52Prompt';
import './openai/gpt5CodexPrompt';
import './openai/gpt5Prompt';
import './openai/hiddenModelBPrompt';
import './xAIPrompts';
import './zaiPrompts';

4 changes: 2 additions & 2 deletions src/extension/prompts/node/agent/openai/gpt51CodexPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { isGpt5_2_CodexFamily } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { isGpt52CodexFamily } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
Expand Down Expand Up @@ -124,7 +124,7 @@ class Gpt51CodexResolver implements IAgentPrompt {
static readonly familyPrefixes = [];

static async matchesModel(endpoint: IChatEndpoint): Promise<boolean> {
return (endpoint.family.startsWith('gpt-5.1') && endpoint.family.includes('-codex')) || isGpt5_2_CodexFamily(endpoint);
return (endpoint.family.startsWith('gpt-5.1') && endpoint.family.includes('-codex')) || isGpt52CodexFamily(endpoint);
}

resolveSystemPrompt(endpoint: IChatEndpoint): SystemPrompt | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { isHiddenModelB } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { isGpt52Family } from '../../../../../platform/endpoint/common/chatModelCapabilities';
import { IChatEndpoint } from '../../../../../platform/networking/common/networking';
import { ToolName } from '../../../../tools/common/toolNames';
import { GPT5CopilotIdentityRule } from '../../base/copilotIdentity';
Expand Down Expand Up @@ -306,10 +306,10 @@ class HiddenModelBPrompt extends PromptElement<DefaultAgentPromptProps> {
}
}

class HiddenModelBPromptResolver implements IAgentPrompt {
class Gpt52PromptResolver implements IAgentPrompt {

static async matchesModel(endpoint: IChatEndpoint): Promise<boolean> {
return isHiddenModelB(endpoint.family);
return isGpt52Family(endpoint);
}

static readonly familyPrefixes = [];
Expand Down Expand Up @@ -346,4 +346,4 @@ export class HiddenModelBReminderInstructions extends PromptElement<ReminderInst
}
}

PromptRegistry.registerPrompt(HiddenModelBPromptResolver);
PromptRegistry.registerPrompt(Gpt52PromptResolver);
24 changes: 10 additions & 14 deletions src/platform/endpoint/common/chatModelCapabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ const VSC_MODEL_HASHES_B = [
'3104045f9b69dbb7a3d76cc8a0aa89eb05e10677c4dd914655ea87f4be000f4e',
];

const HIDDEN_MODEL_B_HASHES = [
'31a2d5282683edb3a22c565f199aa96fb9ffb3107af35aad92ee1cd567cfc25d',
'dd832404e8eeb90793f0369b96ed1702e0e22487a58eb4c1f285a4af5c4f6f21',
'131e2083b68bde4fe879efc38ed9651b1623f8735eeb42157fa3b63ef943fdc6'
];

// subset to allow replace string instead of apply patch.
const VSC_MODEL_HASHES_SUBSET_C = [
Expand Down Expand Up @@ -58,10 +53,6 @@ export function isHiddenModelA(model: LanguageModelChat | IChatEndpoint) {
return HIDDEN_MODEL_A_HASHES.includes(h);
}

export function isHiddenModelB(modelFamily: string) {
const h = getCachedSha256Hash(modelFamily);
return HIDDEN_MODEL_B_HASHES.includes(h);
}

export function isHiddenModelE(model: LanguageModelChat | IChatEndpoint) {
const h = getCachedSha256Hash(model.family);
Expand Down Expand Up @@ -97,11 +88,16 @@ export function isVSCModelC(model: LanguageModelChat | IChatEndpoint) {
return VSC_MODEL_HASHES_SUBSET_C.includes(ID_hash) || VSC_MODEL_HASHES_SUBSET_C.includes(family_hash);
}

export function isGpt5_2_CodexFamily(model: LanguageModelChat | IChatEndpoint | string): boolean {
export function isGpt52CodexFamily(model: LanguageModelChat | IChatEndpoint | string): boolean {
const family = typeof model === 'string' ? model : model.family;
return family === 'gpt-5.2-codex';
}

export function isGpt52Family(model: LanguageModelChat | IChatEndpoint | string): boolean {
const family = typeof model === 'string' ? model : model.family;
return family === 'gpt-5.2';
}

/**
* Returns whether the instructions should be given in a user message instead
* of a system message when talking to the model.
Expand All @@ -126,14 +122,14 @@ export function modelSupportsApplyPatch(model: LanguageModelChat | IChatEndpoint
if (isVSCModelC(model)) {
return false;
}
return (model.family.startsWith('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || isGpt5_2_CodexFamily(model.family) || isVSCModelA(model) || isVSCModelB(model) || isHiddenModelB(model.family);
return (model.family.startsWith('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || isGpt52CodexFamily(model.family) || isVSCModelA(model) || isVSCModelB(model) || isGpt52Family(model.family);
}

/**
* Model prefers JSON notebook representation.
*/
export function modelPrefersJsonNotebookRepresentation(model: LanguageModelChat | IChatEndpoint): boolean {
return (model.family.startsWith('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || isGpt5_2_CodexFamily(model.family) || isHiddenModelB(model.family);
return (model.family.startsWith('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || isGpt52CodexFamily(model.family) || isGpt52Family(model.family);
}

/**
Expand Down Expand Up @@ -222,7 +218,7 @@ export function isGpt5PlusFamily(model: LanguageModelChat | IChatEndpoint | stri
}

const family = typeof model === 'string' ? model : model.family;
return !!family.startsWith('gpt-5') || isHiddenModelB(family);
return !!family.startsWith('gpt-5');
}

/**
Expand Down Expand Up @@ -267,7 +263,7 @@ export function isGpt51Family(model: LanguageModelChat | IChatEndpoint | string
}

const family = typeof model === 'string' ? model : model.family;
return !!family.match(/^gpt-5\.\d+/i) || isGpt5_2_CodexFamily(family);
return !!family.startsWith('gpt-5.1');
}

/**
Expand Down