René's URL Explorer Experiment


Title: Non-interactive mode: late-connecting MCP server injects empty user message; model echoes system-prompt tool lists instead of answering · Issue #4038 · github/copilot-cli · GitHub

Open Graph Title: Non-interactive mode: late-connecting MCP server injects empty user message; model echoes system-prompt tool lists instead of answering · Issue #4038 · github/copilot-cli

X Title: Non-interactive mode: late-connecting MCP server injects empty user message; model echoes system-prompt tool lists instead of answering · Issue #4038 · github/copilot-cli

Description: Describe the bug Run copilot -p "..." with an MCP server that exposes 7 or more tools. The CLI appends an empty user message right after the real prompt. The model then answers the empty turn instead of the prompt. In several of my sessi...

Open Graph Description: Describe the bug Run copilot -p "..." with an MCP server that exposes 7 or more tools. The CLI appends an empty user message right after the real prompt. The model then answers the empty turn inste...

X Description: Describe the bug Run copilot -p "..." with an MCP server that exposes 7 or more tools. The CLI appends an empty user message right after the real prompt. The model then answers the empty ...

Opengraph URL: https://github.com/github/copilot-cli/issues/4038

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Non-interactive mode: late-connecting MCP server injects empty user message; model echoes system-prompt tool lists instead of answering","articleBody":"### Describe the bug\n\nRun `copilot -p \"...\"` with an MCP server that exposes **7 or more tools**. The CLI appends an empty user message right after the real prompt. The model then answers the empty turn instead of the prompt. In several of my sessions it echoed fragments of its own system prompt (the deferred-tools listings), starting mid-word.\n\nI bisected the trigger with a minimal stdio MCP server (script below): identical runs with the tool count as the only variable.\n\n| tools exposed | user.message events | result |\n|---|---|---|\n| 2 | 1 | correct answer |\n| 5 | 1 | correct answer |\n| 6 | 1 | correct answer |\n| 7 | 2 (second empty) | bug |\n| 8, 10, 17, 25 | 2 (second empty) | bug |\n\nThe 6→7 boundary suggests the tool-deferral mechanism (large tool sets moved to on-demand loading) injects the empty turn. Slow server startup is not required; a server that responds instantly triggers it too.\n\nEvidence from `~/.copilot/session-state/\u003cid\u003e/events.jsonl`, two `user.message` events 130 ms apart, the second one empty:\n\n```\n16:41:22.133 user.message      len=24   :: 'Reply with exactly: PONG'\n16:41:22.263 user.message      len=0    :: ''\n16:41:34.591 assistant.message len=1624 :: '-quality-feedback MCP server. Tools prefixed with `model-quality-`:\\n- report_model_quality_issue...'\n```\n\nThe assistant reply starts mid-word (`-quality-feedback MCP server...`): it echoes the deferred-tools listing from the system prompt rather than answering. The garbage echo does not happen on every run; with a small 25-tool dummy the model sometimes still answered `PONG` despite the empty turn. The empty extra turn appears on 100% of runs at ≥7 tools. Any script or subagent built on `copilot -p` risks corrupted output.\n\n### Affected version\n\n1.0.68 (macOS, Darwin arm64)\n\n### Steps to reproduce the behavior\n\n1. Save this minimal MCP server as `/tmp/slowmcp.py`:\n\n```python\n#!/usr/bin/env python3\nimport json, sys\n\nTOOLS = [{\"name\": f\"dummy_tool_{i}\", \"description\": f\"dummy tool number {i}\",\n          \"inputSchema\": {\"type\": \"object\", \"properties\": {\"text\": {\"type\": \"string\"}}}}\n         for i in range(7)]  # 7 = minimum that triggers; 6 does not\n\nfor line in sys.stdin:\n    try:\n        req = json.loads(line)\n    except json.JSONDecodeError:\n        continue\n    rid, method = req.get(\"id\"), req.get(\"method\", \"\")\n    if method == \"initialize\":\n        resp = {\"jsonrpc\": \"2.0\", \"id\": rid, \"result\": {\n            \"protocolVersion\": \"2025-11-25\",\n            \"capabilities\": {\"tools\": {}},\n            \"serverInfo\": {\"name\": \"slowdummy-mcp\", \"version\": \"2.0.0\"}}}\n    elif method == \"tools/list\":\n        resp = {\"jsonrpc\": \"2.0\", \"id\": rid, \"result\": {\"tools\": TOOLS}}\n    elif rid is not None:\n        resp = {\"jsonrpc\": \"2.0\", \"id\": rid, \"result\": {}}\n    else:\n        continue\n    sys.stdout.write(json.dumps(resp) + \"\\n\")\n    sys.stdout.flush()\n```\n\n2. Point `~/.copilot/mcp-config.json` at it:\n\n```json\n{\"mcpServers\": {\"slowdummy\": {\"type\": \"stdio\", \"command\": \"python3\", \"args\": [\"/tmp/slowmcp.py\"], \"tools\": [\"*\"]}}}\n```\n\n3. Run `copilot -p 'Reply with exactly: PONG'`\n4. Inspect `~/.copilot/session-state/\u003csession\u003e/events.jsonl`: two `user.message` events, the second with empty content. Change `range(7)` to `range(6)` and rerun: one `user.message`, correct answer.\n\n### Expected behavior\n\nThe model answers the prompt (`PONG`). The session log contains exactly one `user.message` event, regardless of how many tools the configured MCP servers expose.\n\n### Actual behavior\n\nWith ≥7 tools on one MCP server, the CLI appends a second, empty `user.message` 100-200 ms after the prompt. The model responds to the empty turn; on some runs it echoes system-prompt tool listings starting mid-word instead of answering.\n\n### Additional context\n\n- Ruled out via the same bisection setup: slow startup (3 s delayed handshake: no bug), `notifications/tools/list_changed` after the prompt (no bug), `instructions` in the initialize result (no bug), full capability set including prompts/resources/completions/logging (no bug). Tool count is the single deciding variable.\n- First seen with `notebooklm-mcp` (about 20 tools); reproduced with the dummy above to remove third-party code from the equation.\n- Workaround: keep every MCP server at 6 or fewer exposed tools via the `tools` allowlist in `mcp-config.json`.\n- I can share full redacted `events.jsonl` excerpts from the bisection runs if useful.\n","author":{"url":"https://github.com/marcelsafin","@type":"Person","name":"marcelsafin"},"datePublished":"2026-07-06T16:42:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/4038/copilot-cli/issues/4038"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:cfe8ca61-7e31-b017-a2a5-83de92b65d6c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC78C:147A05:C968DE:1107D2D:6A4EFC00
html-safe-nonce0178b7135900b3594b90fb14ef0e5384dcadd7175185844eb484c303d89dfcec
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzhDOjE0N0EwNTpDOTY4REU6MTEwN0QyRDo2QTRFRkMwMCIsInZpc2l0b3JfaWQiOiI3MzYyMjU1MjU3Nzg5NzI1Njk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacc66f1b30f1ec07d20335302e0b1f14d7b60dfc1bd5da7c7cd68e9a58167bff36
hovercard-subject-tagissue:4821210016
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/copilot-cli/4038/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5864d6b5f6dec297ebb39a9a78303a73689c05a818c4ab45e94f3c1b0e4c1d4d/github/copilot-cli/issues/4038
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5864d6b5f6dec297ebb39a9a78303a73689c05a818c4ab45e94f3c1b0e4c1d4d/github/copilot-cli/issues/4038
og:image:altDescribe the bug Run copilot -p "..." with an MCP server that exposes 7 or more tools. The CLI appends an empty user message right after the real prompt. The model then answers the empty turn inste...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemarcelsafin
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
go-importgithub.com/github/copilot-cli git https://github.com/github/copilot-cli.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id585860664
octolytics-dimension-repository_nwogithub/copilot-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id585860664
octolytics-dimension-repository_network_root_nwogithub/copilot-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b8f23afb982271f1b22258a94aede67a6b77760
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/github/copilot-cli/issues/4038#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcopilot-cli%2Fissues%2F4038
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcopilot-cli%2Fissues%2F4038
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github%2Fcopilot-cli
Reloadhttps://github.com/github/copilot-cli/issues/4038
Reloadhttps://github.com/github/copilot-cli/issues/4038
Reloadhttps://github.com/github/copilot-cli/issues/4038
Please reload this pagehttps://github.com/github/copilot-cli/issues/4038
github https://github.com/github
copilot-clihttps://github.com/github/copilot-cli
Notifications https://github.com/login?return_to=%2Fgithub%2Fcopilot-cli
Fork 1.7k https://github.com/login?return_to=%2Fgithub%2Fcopilot-cli
Star 10.9k https://github.com/login?return_to=%2Fgithub%2Fcopilot-cli
Code https://github.com/github/copilot-cli
Issues 1.8k https://github.com/github/copilot-cli/issues
Pull requests 27 https://github.com/github/copilot-cli/pulls
Discussions https://github.com/github/copilot-cli/discussions
Actions https://github.com/github/copilot-cli/actions
Projects https://github.com/github/copilot-cli/projects
Models https://github.com/github/copilot-cli/models
Security and quality 2 https://github.com/github/copilot-cli/security
Insights https://github.com/github/copilot-cli/pulse
Code https://github.com/github/copilot-cli
Issues https://github.com/github/copilot-cli/issues
Pull requests https://github.com/github/copilot-cli/pulls
Discussions https://github.com/github/copilot-cli/discussions
Actions https://github.com/github/copilot-cli/actions
Projects https://github.com/github/copilot-cli/projects
Models https://github.com/github/copilot-cli/models
Security and quality https://github.com/github/copilot-cli/security
Insights https://github.com/github/copilot-cli/pulse
Bughttps://github.com/github/copilot-cli/issues?q=type:"Bug"
Non-interactive mode: late-connecting MCP server injects empty user message; model echoes system-prompt tool lists instead of answeringhttps://github.com/github/copilot-cli/issues/4038#top
area:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registryhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Amcp%22
area:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automationhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Anon-interactive%22
area:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behaviorhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Atools%22
https://github.com/marcelsafin
marcelsafinhttps://github.com/marcelsafin
on Jul 6, 2026https://github.com/github/copilot-cli/issues/4038#issue-4821210016
area:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registryhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Amcp%22
area:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automationhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Anon-interactive%22
area:toolsBuilt-in tools: file editing, shell, search, LSP, git, and tool call behaviorhttps://github.com/github/copilot-cli/issues?q=state%3Aopen%20label%3A%22area%3Atools%22
Bughttps://github.com/github/copilot-cli/issues?q=type:"Bug"
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.