Skip to content

[FEATURE]: Forward promptCacheKey to GitHub Copilot GPT (Responses) requests #61936

Open

Description

@marcusrbrown
  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

On v2.2.5, Copilot-hosted GPT models never receive a prompt_cache_key. That leaves them without the session affinity anchor that OpenAI-native models already get.

  • OpenAI-native already gets it. session/model-request.ts sets request.promptCacheKey from session affinity, and packages/ai/src/protocols/openai-decisions.ts forwards it.
  • Copilot GPT doesn't. Those models (gpt-* and other non-Claude models on github-copilot) skip packages/ai. github-copilot/models.ts routes them to Provider.aisdk("@ai-sdk/github-copilot"), and packages/core/src/aisdk.ts never reads request.promptCacheKey.
  • The Responses converter would honour it. github-copilot/responses/openai-responses-language-model.ts already reads providerOptions.copilot.promptCacheKey; nothing on the AI-SDK path fills it in.
  • The compatibility flag can't help. Setting compatibility.supportsPromptCacheKey for github-copilot has no effect, because only packages/ai protocol code reads it.

The change I'm asking for is to merge request.promptCacheKey into providerOptions.copilot for @ai-sdk/github-copilot Responses calls, gated on supportsPromptCacheKey. This mirrors the OpenAI path. It could live in aisdk.ts or in the github-copilot plugin's language hook.

Benefit: long agent sessions on Copilot GPT keep landing on the same cache shard, the same way OpenAI-native sessions do. #59868 shows Copilot GPT already gets implicit cache reads; this keeps them stable across turns.

I have not verified that Copilot's /responses endpoint accepts prompt_cache_key. Related: #59868, #55244, #51931.

Activity

  1. opencodejr commented on Nov 5, 2026

    @opencodejr
    Contributor

    Thanks for the detailed write-up, @marcusrbrown!

    To restate the request: when Copilot-hosted GPT models make Responses calls through @ai-sdk/github-copilot, OpenCode should forward the session's promptCacheKey into providerOptions.copilot, gated on supportsPromptCacheKey. That would give them the same cache affinity that OpenAI-native models already get.

    I checked this against the current code and it matches what you describe. aisdk.ts only passes request.providerOptions through, and it never reads request.promptCacheKey. The Copilot Responses model already maps promptCacheKey to prompt_cache_key, but nothing fills it in, and supportsPromptCacheKey is only read by packages/ai protocols. As you say, someone still needs to confirm that Copilot's /responses endpoint accepts the field.

    The maintainers will consider this. Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions