Automatically choose the copilot endpoint in the codespace if it's available#44
Automatically choose the copilot endpoint in the codespace if it's available#44kevinbackhouse wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the devcontainer initialization to auto-select the GitHub Copilot API endpoint when it’s reachable during Codespaces (or devcontainer) attachment, improving the out-of-box .env defaults for users who have Copilot access.
Changes:
- Add a
curl-based probe in.devcontainer/post-attach.shto decide betweenenv-defaultand a newenv-copilottemplate when generating.env. - Add
MODEL_TEMPguidance to the default env template. - Introduce
.devcontainer/env-copilotthat defaultsAI_API_ENDPOINTtohttps://api.githubcopilot.com.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .devcontainer/post-attach.sh | Adds endpoint reachability check to choose which env template is copied to .env. |
| .devcontainer/env-default | Adds commented guidance for setting MODEL_TEMP. |
| .devcontainer/env-copilot | New env template that defaults AI_API_ENDPOINT to the Copilot endpoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [ -v AI_API_TOKEN ]; then | ||
| if curl --fail https://api.githubcopilot.com/models -H "Authorization: Bearer $AI_API_TOKEN" -H "Copilot-Integration-Id: vscode-chat"; then | ||
| ENV_VERSION="env-copilot" |
There was a problem hiding this comment.
The curl probe can hang or significantly delay post-attach when DNS/TLS or the endpoint is slow/unreachable. Add explicit timeouts (e.g., connect + overall) so Codespaces initialization doesn’t block on a network call, and consider handling transient failures (timeout) as a non-fatal fallback to env-default.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
During codespace initialization, use a
curlcommand to test whether https://api.githubcopilot.com is working. If so, default to using that.