Add experimental copilot-sdk engine with port-based LLM gateway support#15642
Add experimental copilot-sdk engine with port-based LLM gateway support#15642
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot remove stdin support copilot client and into support the env var. update copilot-client.yml |
…IG env var Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Removed stdin support from copilot-client - now only reads from Changes in commit 743ba2e:
|
| @@ -0,0 +1,40 @@ | |||
| --- | |||
There was a problem hiding this comment.
@copilot delete file and move content to dev.md instead
There was a problem hiding this comment.
Done. Deleted example-copilot-sdk.md and example-copilot-sdk.lock.yml, moved content to dev.md with usage examples for the copilot-sdk engine.
Changes in commit 39c3f44:
- Deleted
.github/workflows/example-copilot-sdk.mdand its lock file - Added copilot-sdk documentation section to
.github/workflows/dev.mdwith basic and advanced configuration examples
|
@copilot mark copilot-sdk engine as experimental |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot update dev.md to use copilot-sdk and implement a daily report status workflow. Remove the rest. Recompile |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Removed invalid Changes in commit 0fe1b5f:
The api-proxy container is automatically added as a sidecar when Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
❌ Changeset Generator failed. Please review the logs for details. |
|
🧪 Smoke Project is now testing project operations... |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
❌ Smoke Copilot SDK failed. Please review the logs for details. |
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
🧪 Smoke Temporary ID is now testing temporary ID functionality... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
Agent Container Tool Check
Result: 12/12 tools available ✅ All required development tools are accessible in the agent container environment.
|
|
✅ Smoke Temporary ID completed successfully. Temporary ID validation passed. |
|
✅ Smoke Project completed successfully. All project operations validated. |
|
Smoke Test: Copilot - Run 22021153414 ✅ GitHub MCP | ✅ Safe Inputs GH CLI | ❌ Serena MCP | ❌ Playwright Status: @pelikhan
|
There was a problem hiding this comment.
Smoke test review complete. Port-based LLM gateway implementation looks solid with clean interface design.
📰 BREAKING: Report filed by Smoke Copilot for issue #15642
| func (e *BaseEngine) SupportsLLMGateway() int { | ||
| // Engines that support LLM gateway must override this method | ||
| // to return their specific port number (e.g., 10000, 10001, 10002) | ||
| return -1 |
There was a problem hiding this comment.
Good simplification - returning -1 as the default "not supported" value makes the interface cleaner.
| // SupportsLLMGateway returns the LLM gateway port for Copilot SDK engine | ||
| func (e *CopilotSDKEngine) SupportsLLMGateway() int { | ||
| return 10002 // Copilot SDK uses port 10002 for LLM gateway | ||
| } |
There was a problem hiding this comment.
Port 10002 assignment for copilot-sdk looks correct and matches the gateway configuration.
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal! This PR demonstrates excellent documentation structure and security considerations.
💥 [THE END] — Illustrated by Smoke Claude for issue #15642
Adds
copilot-sdkengine that communicates with Copilot CLI via SDK instead of direct execution. The engine starts Copilot in headless mode on port 10002 (matching the LLM gateway port) and usescopilot-client.jsas an SDK wrapper layer.This PR also refactors the LLM gateway support across all engines from boolean to port-based configuration, enabling more flexible API proxy routing.
Changes
New copilot-sdk Engine
Engine implementation (
copilot_sdk_engine.go)http://host.docker.internal:10002for Docker networking (updated to match LLM gateway port)GH_AW_COPILOT_CONFIGenvironment variablecopilot-client modifications (
copilot-client/src/index.ts)GH_AW_COPILOT_CONFIGenv varEngine registration
CopilotSDKEngineconstant topkg/constants/constants.goNewEngineRegistry()LLM Gateway Refactoring
Changed SupportsLLMGateway from boolean to port-based (
agentic_engine.go)SupportsLLMGateway() bool→SupportsLLMGateway() intPort assignments:
AWF configuration updated (
claude_engine.go,codex_engine.go)--enable-api-proxyflag to trigger api-proxy sidecar container> 0to enable)Example Workflows
Usage
The engine executes as:
copilot --headless --port 10002 &→ starts CLI server on LLM gateway portGH_AW_COPILOT_CONFIGenv varnode /opt/gh-aw/copilot/copilot-client.js→ SDK client connects to serverMCP URLs automatically translated from
localhosttohost.docker.internalfor container networking.LLM Gateway Implementation
Engines with LLM gateway support use the
--enable-api-proxyflag which triggers an api-proxy sidecar container. The sidecar automatically routes traffic to the correct ports (10000 for Claude, 10001 for Codex, 10002 for Copilot-sdk) based on the engine'sSupportsLLMGateway()return value.Testing
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.