Skip to content

Automatically choose the copilot endpoint in the codespace if it's available#48

Merged
kevinbackhouse merged 2 commits intoGitHubSecurityLab:mainfrom
kevinbackhouse:env-copilot2
Feb 12, 2026
Merged

Automatically choose the copilot endpoint in the codespace if it's available#48
kevinbackhouse merged 2 commits intoGitHubSecurityLab:mainfrom
kevinbackhouse:env-copilot2

Conversation

@kevinbackhouse
Copy link
Contributor

During codespace initialization, use a curl command to test whether https://api.githubcopilot.com/ is working. If so, default to using that.

Copilot AI review requested due to automatic review settings February 11, 2026 17:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates devcontainer initialization to better bootstrap a Codespaces environment and to prefer the GitHub Copilot API endpoint when it’s reachable/authenticated.

Changes:

  • Add a postCreateCommand script that creates a Python venv, installs tooling, builds, and installs the package editable.
  • Update post-attach.sh to generate a .env file dynamically and (in Codespaces) probe https://api.githubcopilot.com/models to decide whether to default AI_API_ENDPOINT to https://api.githubcopilot.com.
  • Remove the .devcontainer/env-default template file (replaced by inline .env generation).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
.devcontainer/post-create.sh Adds devcontainer creation-time Python environment setup (venv + deps + build + editable install).
.devcontainer/post-attach.sh Generates .env and attempts to auto-select Copilot endpoint in Codespaces using a curl probe.
.devcontainer/env-default Removes the old .env template now that .env is generated by script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 14 to 15
if curl --fail --silent --show-error https://api.githubcopilot.com/models -H "Authorization: Bearer $GITHUB_TOKEN" > /dev/null; then
USE_GITHUB_TOKEN="true"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The curl probe has no timeout, so a transient DNS/network stall could hang postAttachCommand for a long time. Consider adding --connect-timeout/--max-time (and optionally a small retry) so Codespaces attach remains responsive when the Copilot endpoint is slow/unreachable.

Copilot uses AI. Check for mistakes.
@kevinbackhouse kevinbackhouse marked this pull request as ready for review February 11, 2026 21:08
Copilot AI review requested due to automatic review settings February 11, 2026 21:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kevinbackhouse kevinbackhouse merged commit 3f1e741 into GitHubSecurityLab:main Feb 12, 2026
6 checks passed
@kevinbackhouse kevinbackhouse deleted the env-copilot2 branch February 12, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants