openclaw - 💡(How to fix) Fix [Bug]: github-copilot model-resolution takes ~5s on every agent run (token exchange not cached) [2 comments, 2 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#76381Fetched 2026-05-04 05:07:46
View on GitHub
Comments
2
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
commented ×2closed ×1

Every agent run with the github-copilot provider incurs ~5 seconds of model-resolution latency. Based on the docs, this is the GitHub token → Copilot API token exchange step. It appears to happen on every run with no caching between turns.

Root Cause

Every agent run with the github-copilot provider incurs ~5 seconds of model-resolution latency. Based on the docs, this is the GitHub token → Copilot API token exchange step. It appears to happen on every run with no caching between turns.

Fix Action

Fix / Workaround

auth stage drops to ~4-6ms after DNS fix, confirming the DNS workaround works for auth but model-resolution remains slow regardless.

Additional context

The copilot-proxy plugin config schema exposes zero configurable options, so there's no user-side workaround available. A token cache with TTL-aware refresh (similar to how most OAuth clients handle short-lived tokens) would fix this entirely.

RAW_BUFFERClick to expand / collapse

Bug type

Performance regression / missing token cache

Summary

Every agent run with the github-copilot provider incurs ~5 seconds of model-resolution latency. Based on the docs, this is the GitHub token → Copilot API token exchange step. It appears to happen on every run with no caching between turns.

Steps to reproduce

  1. Configure OpenClaw with github-copilot/claude-sonnet-4.6 or any github-copilot/* model
  2. Send any message
  3. Observe [trace:embedded-run] startup stages in gateway.log

Expected behavior

Token exchange should be cached for the duration of the token's TTL (or at minimum for the gateway process lifetime), making model-resolution sub-second on warm runs.

Actual behavior

model-resolution consistently takes ~5,200–5,380ms on every single run, even back-to-back turns in the same session.

Startup trace evidence (after adding NODE_OPTIONS=--dns-result-order=ipv4first)

Before fix (DNS issue compounding it — 11s model-resolution): model-resolution:11508ms model-resolution:11507ms model-resolution:11635ms

After DNS fix — model-resolution improved but still consistently ~5.2s: model-resolution:5380ms model-resolution:5230ms model-resolution:5212ms

auth stage drops to ~4-6ms after DNS fix, confirming the DNS workaround works for auth but model-resolution remains slow regardless.

Environment

  • OpenClaw: 2026.5.2
  • OS: Windows 11 (x64)
  • Node: v24.14.1
  • Install: npm
  • Provider: github-copilot (built-in, device-login flow)
  • Model: github-copilot/claude-sonnet-4.6

Additional context

The copilot-proxy plugin config schema exposes zero configurable options, so there's no user-side workaround available. A token cache with TTL-aware refresh (similar to how most OAuth clients handle short-lived tokens) would fix this entirely.

extent analysis

TL;DR

Implementing a token cache with TTL-aware refresh for the GitHub token to Copilot API token exchange step is likely to fix the performance regression issue.

Guidance

  • Investigate the copilot-proxy plugin to determine if there are any internal caching mechanisms that can be leveraged or modified to reduce the model-resolution latency.
  • Consider implementing a custom caching solution that stores the exchanged token with its TTL, allowing for sub-second model-resolution times on subsequent runs.
  • Review the OpenClaw configuration and Node.js environment to ensure that there are no other bottlenecks or issues contributing to the latency.
  • Look into potential updates or patches for the github-copilot provider or copilot-proxy plugin that may address the caching issue.

Example

No code snippet is provided as the issue does not contain sufficient information about the internal implementation of the copilot-proxy plugin or the OpenClaw configuration.

Notes

The issue appears to be specific to the github-copilot provider and the copilot-proxy plugin, and may require modifications to the plugin or the OpenClaw configuration to resolve. The lack of configurable options in the copilot-proxy plugin config schema limits the available workarounds.

Recommendation

Apply a custom workaround by implementing a token cache with TTL-aware refresh, as this is likely to address the performance regression issue. This approach would require modifications to the OpenClaw configuration or the copilot-proxy plugin, but would provide a more robust solution than relying on potential updates or patches.

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…

FAQ

Expected behavior

Token exchange should be cached for the duration of the token's TTL (or at minimum for the gateway process lifetime), making model-resolution sub-second on warm runs.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING