Skip to content

POC: Fake GitHub Copilot Chat responses using Dev Proxy #403

Description

@estruyf

Problem

When demoing GitHub Copilot Chat during a live presentation, responses are non-deterministic. The AI may give a different answer than expected, which breaks the flow of a carefully prepared demo.

Idea

Use Dev Proxy — a Microsoft open source API simulator — to intercept Copilot Chat requests and return predefined responses.

Copilot Chat communicates with api.individual.githubcopilot.com/chat/completions, which is an OpenAI-compatible endpoint. Dev Proxy can intercept and mock this using its MockResponsePlugin.

POC Goal

Validate the following flow works end-to-end:

  1. Dev Proxy starts in the background (via a Demo Time terminal action)
  2. Dev Proxy intercepts requests to the Copilot Chat completions endpoint
  3. A predefined mock response is returned instead of the real AI response
  4. The presenter types a question in Copilot Chat → the fake response appears
  5. Dev Proxy is stopped after the demo step

Suggested POC setup

devproxyrc.json

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.4.0/rc.schema.json",
  "plugins": [
    {
      "name": "MockResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockedResponses"
    }
  ],
  "urlsToWatch": [
    "https://api.individual.githubcopilot.com/chat/completions",
    "https://api.githubcopilot.com/chat/completions"
  ],
  "mockedResponses": {
    "mocks": [
      {
        "request": { "method": "POST" },
        "response": {
          "statusCode": 200,
          "body": {
            "choices": [{
              "message": {
                "role": "assistant",
                "content": "Here is a predefined demo response!"
              },
              "finish_reason": "stop"
            }]
          }
        }
      }
    ]
  }
}

Demo Time wires this up via a terminal action:

demo.json (excerpt)

{
  "action": "executeTerminalCommand",
  "command": "devproxy --config-file .demo/copilot-mocks.json &"
}

References

Open questions

  • Does Copilot Business block the Dev Proxy certificate? (Individual accounts should be fine)
  • Should Demo Time bundle a devproxy install check / install step?
  • Should the mock config live inside .demo/ per project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions