Repository navigation
[GitHub Copilot] Improve AI model error reporting, cache refresh, and test coverage - #33917
Conversation
|
Thank you for your contribution! 🎉 🔔 @timrogers @pernielsentikaer @thomaspaulmann @gdarchen @pedrocostadev @xilopaint @jakoss @bru02 you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. 📋 Quick checkout commandsBRANCH="fix-github-copilot-models"
FORK_URL="https://github.com/intellectronica/extensions.git"
EXTENSION_NAME="github-copilot"
REPO_NAME="extensions"
git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run devWe're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days. |
[Medium impact] No outstanding findings block merging. SummaryThe PR improves Copilot HTTP errors, adds cache expiry and model refresh, and guards missing request values.
Reviews (3) · Last reviewed commit: "Update CHANGELOG.md" · Reviewed by Greptile |
0xdhrv
left a comment
There was a problem hiding this comment.
Hey @intellectronica 👋
Thanks for the Copilot error handling work, surfacing real HTTP errors as APICallError so Raycast stops retrying a 403 and shows the actual failure is a really nice touch 🔥
Here's everything I found in this pass:
Blocking
-
Tests: please remove
tests/inference.test.tsand keep it in your own repo, since Store installs only need the extension itself. Greptile's note on the catalog expiry test goes away with it. -
Test config: please remove
tsconfig.test.json. -
Test script: please remove the
testscript frompackage.json. No dev dependencies were added, so the lockfile can stay as it is.As mentioned in our docs here ↗
Should fix
-
CHANGELOG.md:9: the last bullet, "Add unit tests covering model discovery, caching, error propagation, and all inference routes", describes internal work and won't apply once the tests are removed. Please drop it, since changelog entries list what users will notice.
Optional
-
If you'd like credit on the Store page, you can add your Raycast username to
contributorsinpackage.json. Totally optional.As mentioned in our docs here ↗
When the blocking items are done, request another review 😊
Feel free to reach me here or on Slack if anything is unclear.
|
Thanks for the review @0xdhrv! I've addressed all the items:
Verified |
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
Addresses the client-side bugs found while investigating #33916 and #31852 (follow-up to #31686):
APICallError: Replaces the customCopilotApiErrorthrown insidecopilotFetchwithAPICallErrorfromai(statusCode,responseHeaders,responseBody, and accurateisRetryable—falsefor400/401/403/404,truefor429/5xx). Previously, throwing a non-AI-SDK error inside the customfetchcaused Raycast to classify deterministic403/400/401errors asprovider-transient/unknown_error, retry them twice, and show a generic error message instead of the actual failure. Also handlesmodel_not_available_for_integrator,no_available_model_endpoints, HTTP403responses, andapi.github.comtop-level{ message }errors infetchApiUrl.api-urlandcatalogentries inLocalStorage, and invalidates the catalog cache on HTTP400/404inference responses so stale endpoint/limit metadata self-heals.inference-v2-*cache entries and callsAI.refreshModels()inreauthorize().src/copilot-usage.tsx) to clear cached model data and callAI.refreshModels()on demand.Array.isArray(message.content)inrequestHeaders()so string user messages do not throwTypeError.request.providerOptions?.raycast?.reasoningEffortand validates non-emptysession.selected_modelforAuto.Errorbackground OAuth rejections inauthorizeModelProvider().Accept,User-Agent, andX-GitHub-Api-Versionheaders onfetchApiUrland a defaultUser-AgentoncopilotFetch.npm test): Extracts the pure provider logic intosrc/services/inference-core.tsand addstests/inference.test.ts(usingnode:test, no new dependencies) covering model discovery, caching/TTL/invalidation, error propagation, and all four inference routes (/v1/messages,/responses,/chat/completions, andAuto), closing the test gap noted in Add GitHub Copilot models to Raycast AI #31686.Related to #33916 and #31852.
Screencast
No visual layout changes beyond adding a Refresh AI Models action to the Copilot Usage action panel.
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool