Skip to content

Commit 2fe88d0

Browse files
authored
Merge pull request #2335 from microsoft/DileepY/release_openAI_updates
OpenAI prompt updates
2 parents 9bc5ef6 + 807916e commit 2fe88d0

File tree

5 files changed

+116
-13
lines changed

5 files changed

+116
-13
lines changed

src/extension/prompts/node/agent/agentPrompt.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class AgentPrompt extends PromptElement<AgentPromptProps> {
9292
const baseAgentInstructions = <>
9393
<SystemMessage>
9494
You are an expert AI programming assistant, working with a user in the VS Code editor.<br />
95-
{this.props.endpoint.family.startsWith('gpt-5') || await isHiddenModelB(this.props.endpoint) || await isHiddenModelC(this.props.endpoint) || await isHiddenModelD(this.props.endpoint) ? (
95+
{this.props.endpoint.family.startsWith('gpt-5') || this.props.endpoint.family.startsWith('arctic-fox') || await isHiddenModelB(this.props.endpoint) || await isHiddenModelC(this.props.endpoint) || await isHiddenModelD(this.props.endpoint) ? (
9696
<>
9797
<GPT5CopilotIdentityRule />
9898
<Gpt5SafetyRule />
@@ -410,7 +410,7 @@ class ToolReferencesHint extends PromptElement<ToolReferencesHintProps> {
410410
<Tag name='toolReferences'>
411411
The user attached the following tools to this message. The userRequest may refer to them using the tool name with "#". These tools are likely relevant to the user's query:<br />
412412
{this.props.toolReferences.map(tool => `- ${tool.name}`).join('\n')} <br />
413-
{(this.props.modelFamily?.startsWith('gpt-5') || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily)) && <>
413+
{(this.props.modelFamily?.startsWith('gpt-5') || this.props.modelFamily?.startsWith('arctic-fox') || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily)) && <>
414414
Start by using the most relevant tool attached to this message—the user expects you to act with it first.<br />
415415
</>}
416416
</Tag>

src/extension/prompts/node/agent/defaultAgentInstructions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { BasePromptElementProps, PromptElement, PromptSizing } from '@vscode/prompt-tsx';
77
import type { LanguageModelToolInformation } from 'vscode';
88
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
9+
import { isHiddenModelB, isHiddenModelC, isHiddenModelD } from '../../../../platform/endpoint/common/chatModelCapabilities';
910
import { IExperimentationService } from '../../../../platform/telemetry/common/nullExperimentationService';
1011
import { LanguageModelToolMCPSource } from '../../../../vscodeTypes';
1112
import { ToolName } from '../../../tools/common/toolNames';
@@ -16,7 +17,6 @@ import { Tag } from '../base/tag';
1617
import { CodeBlockFormattingRules, EXISTING_CODE_MARKER } from '../panel/codeBlockFormattingRules';
1718
import { MathIntegrationRules } from '../panel/editorIntegrationRules';
1819
import { KeepGoingReminder } from './agentPrompt';
19-
import { isHiddenModelB, isHiddenModelC, isHiddenModelD } from '../../../../platform/endpoint/common/chatModelCapabilities';
2020

2121
// Types and interfaces for reusable components
2222
interface ToolCapabilities extends Partial<Record<ToolName, boolean>> {
@@ -402,11 +402,11 @@ export class ApplyPatchInstructions extends PromptElement<DefaultAgentPromptProp
402402

403403
async render(state: void, sizing: PromptSizing) {
404404
const isGpt5 = this.props.modelFamily?.startsWith('gpt-5') === true;
405-
const useSimpleInstructions = (isGpt5 || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily)) && this.configurationService.getExperimentBasedConfig(ConfigKey.Internal.Gpt5AlternativePatch, this._experimentationService);
405+
const useSimpleInstructions = (isGpt5 || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily) || this.props.modelFamily?.startsWith('arctic-fox')) && this.configurationService.getExperimentBasedConfig(ConfigKey.Internal.Gpt5AlternativePatch, this._experimentationService);
406406

407407
return <Tag name='applyPatchInstructions'>
408408
To edit files in the workspace, use the {ToolName.ApplyPatch} tool. If you have issues with it, you should first try to fix your patch and continue using {ToolName.ApplyPatch}. {this.props.tools[ToolName.EditFile] && <>If you are stuck, you can fall back on the {ToolName.EditFile} tool, but {ToolName.ApplyPatch} is much faster and is the preferred tool.</>}<br />
409-
{(isGpt5 || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily)) && <>Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br /></>}
409+
{(isGpt5 || await isHiddenModelB(this.props.modelFamily) || await isHiddenModelC(this.props.modelFamily) || await isHiddenModelD(this.props.modelFamily) || this.props.modelFamily?.startsWith('arctic-fox')) && <>Prefer the smallest set of changes needed to satisfy the task. Avoid reformatting unrelated code; preserve existing style and public APIs unless the task requires changes. When practical, complete all edits for a file within a single message.<br /></>}
410410
{!useSimpleInstructions && <>
411411
The input for this tool is a string representing the patch to apply, following a special format. For each snippet of code that needs to be changed, repeat the following:<br />
412412
<ApplyPatchFormatInstructions /><br />

src/extension/prompts/node/agent/openAIPrompts.tsx

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,12 +641,115 @@ class CodexStyleGPT5CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
641641
}
642642
}
643643

644+
class CodexStyleGPT51CodexPrompt extends PromptElement<DefaultAgentPromptProps> {
645+
async render(state: void, sizing: PromptSizing) {
646+
const tools = detectToolCapabilities(this.props.availableTools);
647+
return <InstructionMessage>
648+
<Tag name="editing_constraints">
649+
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.<br />
650+
- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like "Assigns the value to the variable", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare.<br />
651+
- Try to use {ToolName.ApplyPatch} for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use {ToolName.ApplyPatch} for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase).<br />
652+
- You may be in a dirty git worktree.<br />
653+
{'\t'}* NEVER revert existing changes you did not make unless explicitly requested, since these changes were made by the user.<br />
654+
{'\t'}* If asked to make a commit or code edits and there are unrelated changes to your work or changes that you didn't make in those files, don't revert those changes.<br />
655+
{'\t'}* If the changes are in files you've touched recently, you should read carefully and understand how you can work with the changes rather than reverting them.<br />
656+
{'\t'}* If the changes are in unrelated files, just ignore them and don't revert them.<br />
657+
- Do not amend a commit unless explicitly requested to do so.<br />
658+
- While you are working, you might notice unexpected changes that you didn't make. If this happens, STOP IMMEDIATELY and ask the user how they would like to proceed.<br />
659+
- **NEVER** use destructive commands like `git reset --hard` or `git checkout --` unless specifically requested or approved by the user.<br />
660+
</Tag>
661+
<Tag name='exploration_and_reading_files'>
662+
- **Think first.** Before any tool call, decide ALL files/resources you will need.<br />
663+
- **Batch everything.** If you need multiple files (even from different places), read them together.<br />
664+
- **multi_tool_use.parallel** Use `multi_tool_use.parallel` to parallelize tool calls and only this.<br />
665+
- **Only make sequential calls if you truly cannot know the next file without seeing a result first.**<br />
666+
- **Workflow:** (a) plan all needed reads → (b) issue one parallel batch → (c) analyze results → (d) repeat if new, unpredictable reads arise.<br />
667+
</Tag>
668+
<Tag name='additional_notes'>
669+
- Always maximize parallelism. Never read files one-by-one unless logically unavoidable.<br />
670+
- This concerns every read/list/search operations including, but not only, `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`, ...<br />
671+
- Do not try to parallelize using scripting or anything else than `multi_tool_use.parallel`.<br />
672+
</Tag>
673+
<Tag name='tool_use'>
674+
- You have access to many tools. If a tool exists to perform a specific task, you MUST use that tool instead of running a terminal command to perform that task.<br />
675+
{tools[ToolName.CoreRunTest] && <>- Use the {ToolName.CoreRunTest} tool to run tests instead of running terminal commands.<br /></>}
676+
{tools[ToolName.CoreManageTodoList] && <>
677+
<br />
678+
## {ToolName.CoreManageTodoList} tool<br />
679+
<br />
680+
When using the {ToolName.CoreManageTodoList} tool:<br />
681+
- Skip using {ToolName.CoreManageTodoList} for straightforward tasks (roughly the easiest 25%).<br />
682+
- Do not make single-step todo lists.<br />
683+
- When you made a todo, update it after having performed one of the sub-tasks that you shared on the todo list.
684+
</>}
685+
</Tag>
686+
<Tag name='handling_errors_and_unexpected_outputs'>
687+
- If a tool call returns an error, analyze the error message carefully to understand the root cause before deciding on the next steps.<br />
688+
- Common issues include incorrect parameters, insufficient permissions, or unexpected states in the environment.<br />
689+
- Adjust your approach based on the error analysis, which may involve modifying parameters, using alternative tools, or seeking additional information from the user.<br />
690+
</Tag>
691+
<Tag name='special_user_requests'>
692+
- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as `date`), you should do so.<br />
693+
- If the user asks for a "review", default to a code review mindset: prioritise identifying bugs, risks, behavioural regressions, and missing tests. Findings must be the primary focus of the response - keep summaries or overviews brief and only after enumerating the issues. Present findings first (ordered by severity with file/line references), follow with open questions or assumptions, and offer a change-summary only as a secondary detail. If no findings are discovered, state that explicitly and mention any residual risks or testing gaps.
694+
</Tag>
695+
<Tag name='frontend_tasks'>
696+
When doing frontend design tasks, avoid collapsing into "AI slop" or safe, average-looking layouts.<br />
697+
Aim for interfaces that feel intentional, bold, and a bit surprising.<br />
698+
- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, Roboto, Arial, system).<br />
699+
- Color & Look: Choose a clear visual direction; define CSS variables; avoid purple-on-white defaults. No purple bias or dark mode bias.<br />
700+
- Motion: Use a few meaningful animations (page-load, staggered reveals) instead of generic micro-motions.<br />
701+
- Background: Don't rely on flat, single-color backgrounds; use gradients, shapes, or subtle patterns to build atmosphere.<br />
702+
- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary themes, type families, and visual languages across outputs.<br />
703+
- Ensure the page loads properly on both desktop and mobile.<br />
704+
</Tag>
705+
<Tag name='presenting_your_work_and_final_message'>
706+
You are producing text that will be rendered as markdown by the VS Code UI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.<br />
707+
<br />
708+
- Default: be very concise; friendly coding teammate tone.<br />
709+
- Ask only when needed; suggest ideas; mirror the user's style.<br />
710+
- For substantial work, summarize clearly; follow final-answer formatting.<br />
711+
- Skip heavy formatting for simple confirmations.<br />
712+
- Don't dump large files you've written; reference paths only.<br />
713+
- No "save/copy this file" - User is on the same machine.<br />
714+
- Offer logical next steps (tests, commits, build) briefly; add verify steps if you couldn't do something.<br />
715+
- For code changes:<br />
716+
{'\t'}* Lead with a quick explanation of the change, and then give more details on the context covering where and why a change was made. Do not start this explanation with "summary", just jump right in.<br />
717+
{'\t'}* If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps.<br />
718+
{'\t'}* When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number.<br />
719+
- The user does not command execution outputs. When asked to show the output of a command (e.g. `git show`), relay the important details in your answer or summarize the key lines so the user understands the result.
720+
</Tag>
721+
<Tag name='final_answer_structure_and_style_guidelines'>
722+
- Markdown text. Use structure only when it helps scanability.<br />
723+
- Headers: optional; short Title Case (1-3 words) wrapped in **…**; no blank line before the first bullet; add only if they truly help.<br />
724+
- Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent.<br />
725+
- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **.<br />
726+
- Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible.<br />
727+
- Structure: group related bullets; order sections general → specific → supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task.<br />
728+
- Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording.<br />
729+
- Don'ts: no nested bullets/hierarchies; no ANSI codes; don't cram unrelated keywords; keep keyword lists short—wrap/reformat if long; avoid naming formatting styles in answers.<br />
730+
- Adaptation: code explanations → precise, structured with code refs; simple tasks → lead with outcome; big changes → logical walkthrough + rationale + next actions; casual one-offs → plain sentences, no headers/bullets.
731+
</Tag>
732+
<Tag name='special_formatting'>
733+
When referring to a filename or symbol in the user's workspace, wrap it in backticks.<br />
734+
<Tag name='example'>
735+
The class `Person` is in `src/models/person.ts`.
736+
</Tag>
737+
<MathIntegrationRules />
738+
</Tag>
739+
</InstructionMessage>;
740+
}
741+
}
742+
644743
class OpenAIPromptResolver implements IAgentPrompt {
645744

646-
static readonly familyPrefixes = ['gpt', 'o4-mini', 'o3-mini', 'OpenAI'];
745+
static readonly familyPrefixes = ['gpt', 'o4-mini', 'o3-mini', 'OpenAI', 'arctic-fox'];
647746

648747
resolvePrompt(endpoint: IChatEndpoint): PromptConstructor | undefined {
649748

749+
if (endpoint.model.startsWith('gpt-5.1-codex')) {
750+
return CodexStyleGPT51CodexPrompt;
751+
}
752+
650753
if (endpoint.model.startsWith('gpt-5-codex')) {
651754
return CodexStyleGPT5CodexPrompt;
652755
}
@@ -683,7 +786,7 @@ PromptRegistry.registerPrompt(class implements IAgentPrompt {
683786
static readonly familyPrefixes = [];
684787

685788
resolvePrompt(endpoint: IChatEndpoint): PromptConstructor | undefined {
686-
return CodexStyleGPT5CodexPrompt;
789+
return CodexStyleGPT51CodexPrompt;
687790
}
688791
});
689792

src/platform/endpoint/common/chatModelCapabilities.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ const HIDDEN_MODEL_B_HASHES = [
3737

3838
const HIDDEN_MODEL_C_HASHES = [
3939
'57bc0aad677492da7a00731e3e411055b9828c6439f502fa5abd8fddb7a8a260',
40-
'c5f9e7e93624823213aa93017d0d970ce3203d99dfcd616a0446f7bae2d8caf4'
40+
'c5f9e7e93624823213aa93017d0d970ce3203d99dfcd616a0446f7bae2d8caf4',
41+
4142
];
4243

4344
const HIDDEN_MODEL_D_HASHES = [
@@ -129,14 +130,14 @@ export function modelPrefersInstructionsAfterHistory(modelFamily: string) {
129130
* Model supports apply_patch as an edit tool.
130131
*/
131132
export async function modelSupportsApplyPatch(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
132-
return (model.family.includes('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || await isHiddenModelA(model) || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model);
133+
return (model.family.includes('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || await isHiddenModelA(model) || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model) || model.family.includes('arctic-fox');
133134
}
134135

135136
/**
136137
* Model prefers JSON notebook representation.
137138
*/
138139
export function modelPrefersJsonNotebookRepresentation(model: LanguageModelChat | IChatEndpoint): boolean {
139-
return (model.family.includes('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini';
140+
return (model.family.includes('gpt') && !model.family.includes('gpt-4o')) || model.family === 'o4-mini' || model.family.includes('arctic-fox');
140141
}
141142

142143
/**
@@ -188,7 +189,7 @@ export function modelCanUseImageURL(model: LanguageModelChat | IChatEndpoint): b
188189
* without needing insert_edit_into_file.
189190
*/
190191
export async function modelCanUseApplyPatchExclusively(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
191-
return model.family.startsWith('gpt-5') || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model);
192+
return model.family.startsWith('gpt-5') || model.family.startsWith('arctic-fox') || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model);
192193
}
193194

194195
/**
@@ -204,7 +205,7 @@ export function modelNeedsStrongReplaceStringHint(model: LanguageModelChat | ICh
204205
* Model can take the simple, modern apply_patch instructions.
205206
*/
206207
export async function modelSupportsSimplifiedApplyPatchInstructions(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
207-
return model.family.startsWith('gpt-5') || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model);
208+
return model.family.startsWith('gpt-5') || model.family.startsWith('arctic-fox') || await isHiddenModelB(model) || await isHiddenModelC(model) || await isHiddenModelD(model) || await isVSCModelA(model) || await isVSCModelB(model);
208209
}
209210

210211
/**

src/platform/endpoint/node/responsesApi.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export function createResponsesRequestBody(accessor: ServicesAccessor, options:
4343
})),
4444
// Only a subset of completion post options are supported, and some
4545
// are renamed. Handle them manually:
46-
top_p: options.postOptions.top_p,
4746
max_output_tokens: options.postOptions.max_tokens,
4847
tool_choice: typeof options.postOptions.tool_choice === 'object'
4948
? { type: 'function', name: options.postOptions.tool_choice.function.name }

0 commit comments

Comments
 (0)