To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Description:**
When GitHub's /copilot_internal/v2/token endpoint returns a 5xx error (the "Unicorn" HTML error page), oauth-renew-token in copilot.clj does not check the HTTP status code before attempting to extract :token from the response body. Since clj-http with :as :json falls back to returning the raw string when the response isn't valid JSON, (:token body) evaluates to nil, and the function throws an ex-info containing the entire HTML page as the error message.
This causes two user-visible issues:
- The log is flooded with a massive HTML dump instead of a concise error message.
- There is no retry logic for transient GitHub failures — if the token renewal happens to hit a temporary 5xx during startup (
renew-expiring-auth-tokens!) or at prompt time (maybe-renew-auth-token), the chat prompt fails immediately with Auth token renew failed.
Steps to reproduce:
- Have a valid Copilot
access-token stored in the auth cache.
- Start ECA while GitHub's Copilot token endpoint is returning 5xx (or simulate by e.g. blocking the endpoint temporarily).
- Observe the WARN log containing the full Unicorn HTML and the subsequent ERROR
Auth token renew failed.
Expected behavior:
oauth-renew-token should check the HTTP status before parsing the body.
- On 5xx or non-JSON responses, it should throw a concise error like
"GitHub Copilot token endpoint returned HTTP <status>".
renew-expiring-auth-tokens! (and ideally maybe-renew-auth-token) should retry at least once with a short backoff for transient (5xx) errors before giving up.
Relevant code:
src/eca/llm_providers/copilot.clj — oauth-renew-token (line ~66)
src/eca/features/login.clj — renew-auth! / renew-expiring-auth-tokens!
Logs:
WARN [LOGIN] Could not renew 'github-copilot' auth token before sync: Error on copilot login: <!DOCTYPE html>... [full Unicorn HTML page]
WARN [MODELS] Provider 'github-copilot': /models endpoint returned status 401: IDE token expired
ERROR Auth token renew failed
To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.
Description:**
When GitHub's
/copilot_internal/v2/tokenendpoint returns a 5xx error (the "Unicorn" HTML error page),oauth-renew-tokenincopilot.cljdoes not check the HTTP status code before attempting to extract:tokenfrom the response body. Sinceclj-httpwith:as :jsonfalls back to returning the raw string when the response isn't valid JSON,(:token body)evaluates tonil, and the function throws anex-infocontaining the entire HTML page as the error message.This causes two user-visible issues:
renew-expiring-auth-tokens!) or at prompt time (maybe-renew-auth-token), the chat prompt fails immediately withAuth token renew failed.Steps to reproduce:
access-tokenstored in the auth cache.Auth token renew failed.Expected behavior:
oauth-renew-tokenshould check the HTTP status before parsing the body."GitHub Copilot token endpoint returned HTTP <status>".renew-expiring-auth-tokens!(and ideallymaybe-renew-auth-token) should retry at least once with a short backoff for transient (5xx) errors before giving up.Relevant code:
src/eca/llm_providers/copilot.clj—oauth-renew-token(line ~66)src/eca/features/login.clj—renew-auth!/renew-expiring-auth-tokens!Logs: