-
Notifications
You must be signed in to change notification settings - Fork 682
Improve CLI communication error diagnostics #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
4
commits into
main
Choose a base branch
from
copilot/fix-communication-error-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+430
−15
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add early detection of CLI process crashes with exit code reporting - Capture and include stderr output in error messages for better diagnostics - Add process readiness check to detect immediate failures - Handle ConnectionLostException separately with clearer error messages - Improve timeout handling with more descriptive errors - Add better error messages for CLI startup failures Co-authored-by: patniko <[email protected]>
- Create comprehensive troubleshooting guide for connection errors - Add link to troubleshooting from getting started guide - Add error handling tests to verify improvements - Document common error scenarios and solutions Co-authored-by: patniko <[email protected]>
- Fix stderr capture race condition by using synchronized list - Remove unused StderrCapture class - Improve ConnectionLostException error message with troubleshooting link - Make process exit detection more reliable (50ms instead of 100ms) - Fix platform-specific test to work on both Windows and Unix - Remove placeholder version numbers from documentation - Simplify connection error test assertions Co-authored-by: patniko <[email protected]>
Comment on lines
+699
to
+705
| catch (Exception ex) | ||
| { | ||
| throw new InvalidOperationException( | ||
| $"Failed to start Copilot CLI process. " + | ||
| $"Please ensure the Copilot CLI is installed and accessible at '{cliPath}'. " + | ||
| $"Error: {ex.Message}", ex); | ||
| } |
Comment on lines
+40
to
+47
| if (OperatingSystem.IsWindows()) | ||
| { | ||
| exitCommand = "cmd"; | ||
| } | ||
| else | ||
| { | ||
| exitCommand = "false"; // Unix command that exits immediately with code 1 | ||
| } |
Copilot
AI
changed the title
[WIP] Fix communication error with Copilot CLI during session creation
Improve CLI communication error diagnostics
Jan 29, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Users experiencing CLI startup or connection failures receive generic "JSON-RPC connection lost" errors with no actionable information about the root cause (missing CLI, authentication, configuration).
Changes
Error Detection & Reporting
ConnectionLostExceptionnow includes troubleshooting link and contextProcess.Start()to catch and report missing executable errorsDocumentation
docs/troubleshooting-connection-errors.md): Covers CLI installation, authentication, version compatibility, port conflicts, permissionsTesting
Error Message Improvements
Before:
After:
Technical Notes
Stderr capture uses a synchronized list to ensure error output is available regardless of timing between immediate exit checks and background logging. The 50ms delay balances false positives (slow-starting but valid processes) against detection speed.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.