GitHub Copilot Agent Environment Setup
This document describes the development environment configuration for GitHub Copilot Agent in the llm-proxy project.
Overview
The GitHub Copilot Agent environment has been configured to provide:
- Optimized development workflow matching our CI/CD pipelines
- Network access to GitHub documentation and APIs
- Efficient caching for faster development cycles
- Consistent tooling and dependencies
Environment Configuration
Firewall Configuration
The Copilot Agent firewall has been configured to allow access to essential GitHub services:
COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS: "https://docs.github.com,https://api.github.com,https://raw.githubusercontent.com"
This configuration allows the agent to:
- ✅ Access GitHub documentation for research and guidance
- ✅ Interact with GitHub APIs for repository operations
- ✅ Fetch raw content from GitHub repositories
Development Environment
The environment mirrors our existing GitHub Actions workflows with:
- Go Version: 1.23 (matches build.yml, test.yml, lint.yml)
- Node.js Version: 20 (for frontend tooling)
- OS: Ubuntu Latest (consistent with CI/CD)
- Caching: Enabled for Go modules, build cache, and development tools
- Workflow:
.github/workflows/copilot-setup-steps.yml
Available Tools
The environment includes all development tools specified in our Makefile:
golangci-lintfor code lintingswagfor API documentation generationgodocfor Go documentationmockgenfor test mocks
Usage
Manual Trigger
The Copilot Agent environment can be manually set up using the workflow dispatch:
- Go to the Actions tab in the repository
- Select “Copilot Setup Steps” workflow
- Click “Run workflow”
- Optionally provide a task description
Automatic Setup
The environment setup runs automatically when:
- A Copilot Agent task is assigned
- Development environment validation is needed
Validation
The environment includes comprehensive validation:
- Network Connectivity: Verifies access to whitelisted domains
- Tool Availability: Confirms all required development tools are installed
- Build Verification: Ensures the project builds successfully
- Test Execution: Runs the full test suite
- Code Quality: Performs linting and formatting checks
Cache Strategy
The environment uses multi-level caching for optimal performance:
- Go Module Cache: Caches downloaded dependencies
- Build Cache: Caches compiled artifacts
- Tool Cache: Caches development tools
- Test Results Cache: Caches test outputs and coverage reports
Cache keys are prefixed with copilot-agent for easy identification and management.
Environment Variables
Core Configuration
GO_VERSION: Go language versionNODE_VERSION: Node.js version for toolingCACHE_KEY_PREFIX: Cache identification prefix
Security Configuration
COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS: Network access whitelist
Troubleshooting
Network Access Issues
If the Copilot Agent reports network access issues:
- Verify the firewall allowlist includes required domains
- Check the environment validation logs
- Ensure the workflow has necessary permissions
Build Issues
If builds fail in the Copilot Agent environment:
- Compare with CI/CD workflow configurations
- Check cache status and clear if necessary
- Verify Go and Node.js versions match specifications
Performance Issues
If the environment is slow:
- Check cache hit rates in workflow logs
- Verify concurrent job limitations
- Review timeout configurations
Integration with Existing Workflows
The Copilot Agent environment is designed to complement, not replace, existing workflows:
- build.yml: Build validation and binary creation
- test.yml: Comprehensive testing (unit and integration)
- lint.yml: Code quality and formatting
- docker.yml: Container image building and publishing
The agent environment provides a development-focused setup that mirrors these production workflows while optimizing for interactive development tasks.
Repository Variables
For organization-wide configuration, set these GitHub Actions variables:
# Required for all repositories using Copilot Agent
COPILOT_AGENT_FIREWALL_ALLOW_LIST_ADDITIONS: "https://docs.github.com,https://api.github.com,https://raw.githubusercontent.com"
# Optional: Disable firewall completely (NOT RECOMMENDED for production)
# COPILOT_AGENT_FIREWALL_ENABLED: false
# Optional: Complete firewall override (replaces default allowlist)
# COPILOT_AGENT_FIREWALL_ALLOW_LIST: "custom.domain.com,another.domain.com"
Security Considerations
- The firewall allowlist is limited to essential GitHub services
- No external domains beyond GitHub are included by default
- Full firewall bypass is NOT enabled for security reasons
- All network access is logged and auditable through workflow runs
Future Enhancements
Potential improvements to consider:
- Dynamic environment scaling based on task complexity
- Integration with code coverage reporting
- Custom toolchain support for specific project types
- Enhanced caching strategies for monorepo structures