openclaw - ✅(Solved) Fix [Feature]: Add GitHub Copilot as memory search embedding provider [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61717Fetched 2026-04-08 02:55:26
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1

Add GitHub Copilot as a memory search embedding provider so users with Copilot subscriptions can use embeddings without a separate OpenAI/Gemini API key.

Root Cause

Add GitHub Copilot as a memory search embedding provider so users with Copilot subscriptions can use embeddings without a separate OpenAI/Gemini API key.

Fix Action

Fixed

PR fix notes

PR #61718: feat(github-copilot): add embedding provider for memory search

Description (problem / solution / changelog)

Summary

  • Problem: Users with GitHub Copilot subscriptions must configure a separate API key (OpenAI, Gemini, etc.) to use memory search embeddings.
  • Why it matters: Many developers already have Copilot through their GitHub plan but lack separate embedding API keys, leaving memory search unavailable.
  • What changed: Added a MemoryEmbeddingProviderAdapter to the github-copilot plugin that discovers embedding models via the Copilot API and registers at auto-selection priority 15.
  • What did NOT change (scope boundary): No changes to core embedding infrastructure, token management, or other providers. The existing createRemoteEmbeddingProvider pattern is not reused because it is not exported through the plugin SDK; the adapter builds its own HTTP client following the Ollama extension pattern.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #61717
  • This PR fixes a bug or regression

Root Cause (if applicable)

N/A — new feature.

Regression Test Plan (if applicable)

N/A — new feature, but comprehensive test coverage added.

  • Coverage level:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: extensions/github-copilot/embeddings.test.ts (22 tests)
  • Scenario the test should lock in: Model discovery, provider creation, embedQuery/embedBatch, error handling, auto-selection behavior, ID-based model matching
  • Existing test that already covers this: extensions/github-copilot/index.test.ts updated with registration test

User-visible / Behavior Changes

  • New embedding provider github-copilot available for agents.defaults.memorySearch.provider
  • When provider: "auto", GitHub Copilot is tried at priority 15 (after local, before OpenAI) if a GitHub token is available
  • Embedding models are auto-discovered from the Copilot /models endpoint (prefers text-embedding-3-small)
  • No new config keys required — reuses existing Copilot auth (env vars or openclaw models auth login-github-copilot)

Diagram (if applicable)

User config (provider: "github-copilot" or "auto")
  → resolveFirstGithubToken (env vars / auth profile)
  → resolveCopilotApiToken (GitHub token → Copilot API token)
  → GET {baseUrl}/models (discover embedding models)
  → pickBestModel (text-embedding-3-small preferred)
  → POST {baseUrl}/embeddings (OpenAI-compatible)

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No — reuses existing Copilot token infrastructure
  • New/changed network calls? Yes — embedding requests to Copilot /embeddings and /models endpoints
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • Risk + mitigation: New network calls use fetchWithSsrFGuard with SSRF policy scoped to the resolved Copilot API hostname. Tokens are sent only via Authorization header and never logged.

Repro + Verification

Environment

  • OS: Linux (Docker)
  • Runtime/container: Docker with openclaw-e2e-copilot-embed image
  • Model/provider: GitHub Copilot (Enterprise plan)
  • Relevant config: agents.defaults.memorySearch.provider: "github-copilot"

Steps

  1. Configure GitHub Copilot auth (openclaw models auth login-github-copilot or set GH_TOKEN)
  2. Set agents.defaults.memorySearch.provider: "github-copilot" in openclaw.json
  3. Write memory notes and run openclaw memory index --force
  4. Run openclaw memory search "query"

Expected

  • Memory status shows Provider: github-copilot, Model: text-embedding-3-small, Vector: ready
  • Memory search returns ranked results using Copilot embeddings

Actual

  • Confirmed working: provider detected, model auto-discovered, 2 files indexed, vector search returns matches (score 0.323 for "capital of France", 0.362 for "Copilot embedding")

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets

Unit tests: 22 passing in embeddings.test.ts, 46 total across extensions/github-copilot/

Docker E2E output:

Provider: github-copilot (requested: github-copilot)
Model: text-embedding-3-small
Indexed: 2/2 files · 2 chunks
Vector: ready
Vector dims: 1536
Embeddings: ready
Embedding cache: enabled (3 entries)

Search "capital of France":
0.323 memory/test-copilot-embedding.md:1-5

Search "Copilot embedding":
0.362 memory/project-notes.md:1-6

Human Verification (required)

  • Verified scenarios: Docker E2E with real GitHub Copilot Enterprise subscription — token exchange, model discovery, indexing, and vector search all working
  • Edge cases checked: empty supported_endpoints (Copilot API quirk — models matched by ID pattern), missing GitHub token (graceful fallthrough), model discovery HTTP error, malformed response
  • What you did not verify: openclaw message send in Docker (pre-existing Node 24 ESM bug on v2026.4.5 tag, unrelated to this PR)

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No — new optional provider value, existing configs unaffected
  • Migration needed? No
  • New plugin SDK exports: None

Risks and Mitigations

  • Risk: Copilot token is captured at creation time and may expire during long sessions (~30 min TTL)
    • Mitigation: Matches existing pattern across all other embedding providers. Documented in code comment. Token refresh can be added as a follow-up if needed.
  • Risk: Copilot API model availability varies by plan
    • Mitigation: Dynamic discovery with graceful fallthrough; auto-selection skips to next provider when no embedding models are available.

Changed files

  • CHANGELOG.md (modified, +4/-0)
  • docs/concepts/memory-search.md (modified, +13/-11)
  • docs/providers/github-copilot.md (modified, +40/-0)
  • docs/reference/memory-config.md (modified, +16/-14)
  • extensions/github-copilot/auth.ts (added, +40/-0)
  • extensions/github-copilot/embeddings.test.ts (added, +506/-0)
  • extensions/github-copilot/embeddings.ts (added, +264/-0)
  • extensions/github-copilot/index.test.ts (modified, +22/-0)
  • extensions/github-copilot/index.ts (modified, +5/-38)
  • extensions/github-copilot/openclaw.plugin.json (modified, +3/-0)
RAW_BUFFERClick to expand / collapse

Summary

Add GitHub Copilot as a memory search embedding provider so users with Copilot subscriptions can use embeddings without a separate OpenAI/Gemini API key.

Problem to solve

Users who have GitHub Copilot subscriptions (Individual, Business, or Enterprise) currently must configure a separate OpenAI, Gemini, or other API key to use memory search embeddings. Many developers already have Copilot access through their GitHub plan but lack separate embedding provider API keys, leaving memory search unavailable or requiring extra setup.

Proposed solution

Add a MemoryEmbeddingProviderAdapter to the existing github-copilot bundled plugin that:

  • Reuses the existing Copilot token infrastructure (GitHub OAuth → Copilot API token exchange)
  • Discovers available embedding models dynamically via the Copilot /models endpoint
  • Picks the best model automatically (prefers text-embedding-3-small)
  • Sends embedding requests to the OpenAI-compatible Copilot /embeddings endpoint
  • Registers at auto-selection priority 15 (between local and OpenAI) so Copilot is tried before paid API keys
  • Falls through gracefully when no GitHub token is available

Config: agents.defaults.memorySearch.provider: "github-copilot" or auto-detected when provider: "auto".

Alternatives considered

  • Requiring users to configure a separate OpenAI API key — adds friction for users who already have Copilot.
  • Using a hardcoded default model instead of dynamic discovery — less flexible as Copilot model availability varies by plan.
  • Creating a separate plugin instead of extending the existing github-copilot plugin — over-engineered, the embedding capability naturally belongs with the existing Copilot provider.

Impact

  • Affected: All users with GitHub Copilot subscriptions who want memory search
  • Severity: Medium (feature gap, not a bug)
  • Frequency: Every new user setup without a separate API key
  • Consequence: Memory search unavailable or requires extra API key setup that could be avoided

extent analysis

TL;DR

Implement a MemoryEmbeddingProviderAdapter in the github-copilot plugin to enable users with Copilot subscriptions to use memory search embeddings without a separate API key.

Guidance

  • To integrate GitHub Copilot as a memory search embedding provider, reuse the existing Copilot token infrastructure for authentication and dynamically discover available embedding models via the Copilot /models endpoint.
  • Configure the MemoryEmbeddingProviderAdapter to register at auto-selection priority 15, allowing Copilot to be tried before paid API keys, and set agents.defaults.memorySearch.provider to "github-copilot" or "auto" for auto-detection.
  • Ensure the adapter falls through gracefully when no GitHub token is available to maintain existing functionality.
  • Test the implementation with different Copilot plans to verify that the best model (e.g., text-embedding-3-small) is automatically selected and embedding requests are successfully sent to the OpenAI-compatible Copilot /embeddings endpoint.

Example

// Example configuration
const config = {
  agents: {
    defaults: {
      memorySearch: {
        provider: "github-copilot"
      }
    }
  }
};

Notes

This solution assumes that the existing github-copilot plugin can be extended to support memory search embeddings. If the plugin architecture does not allow for such extensions, a separate plugin might be necessary.

Recommendation

Apply the workaround by implementing the MemoryEmbeddingProviderAdapter in the github-copilot plugin, as it provides a seamless experience for users with Copilot subscriptions and avoids requiring separate API keys.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Feature]: Add GitHub Copilot as memory search embedding provider [1 pull requests, 1 participants]