models.list -32603 in Kubernetes
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- docker, kubernetes, python
- Domain
- backend, devops, infrastructure
Research direction
Start at session.send_and_wait and trace the bundled CLI subprocess RPC handler used for models.list. Reproduce the failure in the provided python:3.11-slim Kubernetes setup, then compare its authentication, environment, filesystem, and IPC context with local execution. Done means model listing works in the container without breaking the documented callbacks or session flow.
Written by the indexing model from the issue text.
Description
GitHub Copilot SDK Bug Report: models.list -32603 in Kubernetes
Summary
GitHub Copilot SDK (Python, v1.0.1) fails with JSON-RPC Error -32603: Failed to list models when running in Kubernetes containers, despite:
- ✅ Valid GitHub token with copilot scope
- ✅ Network connectivity to all required endpoints
- ✅ Successful session creation
- ✅ Works perfectly in local development environment
- ✅ Direct REST API calls to
/modelsendpoint succeed
Environment
- SDK: github-copilot-sdk 1.0.1 (Python)
- Runtime: Docker container (python:3.11-slim)
- Platform: Kubernetes (AWS EKS, python:3.11-slim base image)
- Token: Valid GitHub token (gho_* format) with copilot scope verified via
curlto API
Error Details
Query execution fails with:
JSON-RPC Error -32603: Request models.list failed with message: Failed to list models
Stack trace indicates error occurs in:
- session.send_and_wait({"prompt": ...})
- SDK's bundled CLI subprocess RPC handler
- NOT in SDK Python code
Reproduction
Local (Works ✓)
# Windows local development
python -m uvicorn app.main:app --host 0.0.0.0 --port 8080
curl -X POST http://localhost:8080/prompt \
-H "Content-Type: application/json" \
-d '{"prompt":"Say hello","model":"gpt-5.3-codex"}'
# → Returns assistant response successfully
Kubernetes (Fails ✗)
# Same code in K8s pod
kubectl exec -it <pod> -- python -c "
import asyncio
from copilot import CopilotClient
async def test():
async with CopilotClient(github_token='gho_...', use_logged_in_user=False) as client:
async with await client.create_session(model='gpt-5.3-codex') as session:
response = await session.send_and_wait({'prompt': 'hello'})
asyncio.run(test())
"
# → RuntimeError: Failed to list models (JSON-RPC -32603)
Key Observations
- Session creation succeeds -
CopilotClient.create_session()completes without error - Error happens during query execution -
session.send_and_wait()fails - Error is from bundled CLI subprocess - not SDK Python code
- All other RPC calls work - session lifecycle, message sending succeed
- Direct API calls work -
curltoapi.githubcopilot.com/modelsreturns 200 OK - Token is valid - verified with
curltoapi.github.com/user
Attempted Workarounds (All Failed)
| Workaround | Result |
|---|---|
on_list_models handler callback |
❌ Still calls internal RPC during query |
Monkey-patching client.list_models |
❌ SDK calls RPC through different path |
| Error filtering in event handlers | ❌ Error propagates before handlers |
| Retry logic on JsonRpcError | ❌ Retry fails identically |
Using model="auto" |
❌ Same error |
use_logged_in_user=False |
❌ Already set, still fails |
| Custom ModelInfo stubs | ❌ Callback not invoked for internal RPC |
Root Cause Hypothesis
The SDK spawns a bundled Copilot CLI subprocess for internal JSON-RPC calls. This subprocess:
- Works locally - has proper user context and environment
- Fails in K8s - CLI subprocess cannot authenticate or reach API due to:
- Different user context (subprocess run as different UID?)
- Missing environment variables
- File system access restrictions
- Socket/IPC communication issues
- Home directory/config path issues
The on_list_models callback only helps with external calls; internal RPC calls during query execution bypass this handler.
Requested Actions
- Acknowledge - Confirm this is a known limitation in container environments
- Document - Add warning to SDK docs about K8s/container deployment issues
- Fix - Implement one of:
- Make CLI subprocess authentication environment-aware
- Allow disabling internal model validation via
COPILOT_CLI_SKIP_MODEL_VALIDATION - Pre-authenticate CLI subprocess in SDK initialization
- Make
on_list_modelshandler apply to ALL internal list_models calls
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 1.5k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 130
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/copilot-sdk
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2760 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
github/copilot-sdk#2759 ·
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
github/copilot-sdk#2758 ·
-
agentic-workflows
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/copilot-sdk#2709 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
github/copilot-sdk#2673 ·
All issues in github/copilot-sdk
Similar issues
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/flink-agents#1152 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objectionary/eo-graphs#75 ·