Skip to content

Align OpenAI fallback tools with prompt family - #333938

Draft
Dileep Yavanmandha (dileepyavan) wants to merge 3 commits into
mainfrom
DileepY/openai-default-prompt-capabilities
Draft

Align OpenAI fallback tools with prompt family#333938
Dileep Yavanmandha (dileepyavan) wants to merge 3 commits into
mainfrom
DileepY/openai-default-prompt-capabilities

Conversation

@dileepyavan

@dileepyavan Dileep Yavanmandha (dileepyavan) commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • record the model family associated with a provider prompt fallback
  • use the resolved fallback family when selecting apply_patch and its GPT-5-style tool description
  • propagate that effective family into AgentPrompt system-prompt rendering without mutating the endpoint
  • bypass learned BYOK edit-tool preferences when a registered prompt fallback defines the expected tool family
  • limit the latest OpenAI fallback for versioned gpt-* families to versions newer than GPT-5.6, while preserving opaque models identified through OpenAI provider metadata
  • keep explicit model and family-prefix prompt resolvers ahead of the provider fallback

Behavior

Known GPT versions through GPT-5.6 continue using their explicit prompt resolvers. Unknown versioned families such as GPT-5.7 and GPT-6 inherit the GPT-5.6 prompt and tool capabilities, while older unknown families such as GPT-4.2 do not.

Opaque OpenAI fallback endpoints now receive a consistent GPT-5.6 experience across tool selection, tool descriptions, and rendered system instructions. The endpoint's original model and family remain unchanged.

Testing

  • VS Code diagnostics: no errors in changed TypeScript files
  • git diff --check
  • Added focused prompt-routing, system-prompt rendering, and model-capability unit coverage
  • Added a getAgentTools integration test using an extension-contributed opaque OpenAI endpoint with a conflicting declared find-replace preference; verifies only apply_patch is enabled with the GPT-5 description
  • Unit tests not executed locally because Vitest dependencies are not installed in this checkout

Track the model family selected by provider prompt fallbacks and use it when choosing agent edit tools. Limit versioned GPT fallback routing to families newer than GPT-5.6 while retaining opaque OpenAI provider models.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 2, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Opaque fallback models still receive non-GPT-5 system-prompt patch instructions, and promotion metadata can drift.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity extensions/​copilot/​src/​extension/​intents/​node/​agentIntent.ts — The resolved family is only threaded through tool selection. AgentPrompt.getSystemPrompt still…
Medium severity extensions/​copilot/​src/​extension/​intents/​node/​agentIntent.ts — The new fallback branch changes the actual getAgentTools result and bypasses all BYOK…
Low severity extensions/​copilot/​src/​extension/​prompts/​node/​agent/​openai/​latestOpenAIPrompt.ts — This introduces two additional promotion points beyond the resolver import: the 5/6 comparison…
What changed in this PR

Aligns OpenAI fallback prompts with their expected edit-tool capabilities.

Changes:

  • Records and resolves fallback model families.
  • Restricts fallback routing to newer or opaque OpenAI models.
  • Uses fallback families for edit-tool selection and adds coverage.
File Description
model-prompts.instructions.md Documents fallback routing.
agentIntent.ts Applies fallback tool capabilities.
openAIPrompts.spec.ts Tests prompt routing.
latestOpenAIPrompt.ts Filters and registers the fallback.
promptRegistry.ts Tracks fallback families.
chatModelCapabilities.ts Accepts fallback capability families.
chatModelCapabilities.spec.ts Tests fallback capabilities.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const logService = accessor.get<ILogService>(ILogService);

model ??= await endpointProvider.getChatEndpoint(request);
const fallbackModelFamily = await PromptRegistry.resolveFallbackModelFamily(model);
const allowTools: Record<string, boolean> = {};

const learned = editToolLearningService.getPreferredEndpointEditTool(model);
const learned = fallbackModelFamily ? undefined : editToolLearningService.getPreferredEndpointEditTool(model);

// Promote the entire prompt bundle by changing the resolver imported above.
PromptRegistry.registerFallbackPrompt(LatestOpenAIPromptResolver, isOpenAIModel);
PromptRegistry.registerFallbackPrompt(LatestOpenAIPromptResolver, usesLatestOpenAIPrompt, 'gpt-5.6');
Carry the fallback model family in resolved prompt customizations and use it when rendering model-specific system instructions without changing the endpoint family.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover the final getAgentTools result for an extension-contributed opaque OpenAI endpoint whose declared edit-tool preference conflicts with the GPT-5.6 prompt fallback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants