Skip to content

AI Gateway Phase 1.b: Copilot token minting with auto-refresh plugin #719

Closed

Description

Original author: Cedric Vidal (@cedricvidal)

Context

With the AI Gateway validated via Phase 1.a (HAR collection plugin, PR #702), the next step is to solve the Copilot token expiration issue (#669) by implementing a token minting and auto-refresh plugin.

Problem

Copilot tokens expire mid-session causing worker failures (see #669). The current workaround (PR #700, reducing reuse threshold) buys time but doesn't solve the root cause.

Requirements

  • Implement a gateway plugin that mints Copilot tokens on behalf of workers
  • Auto-refresh tokens before expiration (proactive renewal)
  • Transparently inject fresh tokens into outbound requests (workers never see expired credentials)
  • Plugin should be configurable per-worker or globally

Risk

Medium: modifies auth headers on live traffic

Dependencies

Acceptance Criteria

  • Gateway plugin intercepts outbound requests to Copilot endpoints
  • Plugin mints and caches tokens with proactive refresh before expiry
  • Workers no longer encounter token expiration errors
  • Integration tests covering token refresh flow
  • VS Code Electron worker uses the new plugin in staging
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

    language: rustWork involving Rust code, tooling, or dependencies.type: enhancementNew functionality or improvements to existing behavior.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions