Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/env-copilot
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Uncomment the endpoint that you want to use:
Comment thread
kevinbackhouse marked this conversation as resolved.
#AI_API_ENDPOINT=https://models.github.ai/inference
AI_API_ENDPOINT=https://api.githubcopilot.com
#AI_API_ENDPOINT=https://api.openai.com/v1

# Uncomment to set the model temperature
#MODEL_TEMP=1.0

# Optional data storage directories. By default, ~/.local is used.
#MEMCACHE_STATE_DIR=/app/data
#CODEQL_DBS_BASE_PATH=/app/data
#DATA_DIR=/app/data
#LOG_DIR=/app/logs
3 changes: 3 additions & 0 deletions .devcontainer/env-default
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#AI_API_ENDPOINT=https://api.githubcopilot.com
#AI_API_ENDPOINT=https://api.openai.com/v1

# Uncomment to set the model temperature
#MODEL_TEMP=1.0

# Optional data storage directories. By default, ~/.local is used.
#MEMCACHE_STATE_DIR=/app/data
#CODEQL_DBS_BASE_PATH=/app/data
Expand Down
10 changes: 9 additions & 1 deletion .devcontainer/post-attach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ fi
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "📝 Creating .env template..."
cp .devcontainer/env-default .env || { echo "Error creating .env"; exit 1; }
# Test whether a simple curl command to api.githubcopilot.com works. If so
# install the Copilot version of .env, otherwise install the default version.
ENV_VERSION="env-default"
if [ -v AI_API_TOKEN ]; then
if curl --fail --silent --show-error https://api.githubcopilot.com/models -H "Authorization: Bearer $AI_API_TOKEN" -H "Copilot-Integration-Id: vscode-chat" > /dev/null; then
ENV_VERSION="env-copilot"
Comment on lines +21 to +23
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
fi
fi
Comment thread
kevinbackhouse marked this conversation as resolved.
cp ".devcontainer/${ENV_VERSION}" .env || { echo "Error creating .env"; exit 1; }
code .env || echo "ℹ️ Unable to open .env in VS Code. Please open and review the .env file manually."
echo "⚠️ Defaults can be changed by editing the auto-generated .env file."
fi
Expand Down