Conversation
… guards and robust error handling
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses intermittent native C++ crashes occurring during terminal window resizing. By implementing a defensive check against the OS process state and hardening the global error handling logic, the changes prevent race conditions that previously triggered fatal terminations when a process exited during a resize event. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves robustness when handling terminal resize events. In packages/cli/index.ts, it safely handles potentially undefined error messages and checks for EBADF error codes. In packages/core/src/services/shellExecutionService.ts, it introduces a defensive check using process.kill(pid, 0) to verify if the process is still alive before attempting a resize. However, calling process.kill(pid, 0) on Windows is unsupported and will always throw an error, leading to high CPU usage and performance degradation during rapid resize events. It is recommended to skip this check on Windows.
|
Size Change: +235 B (0%) Total Size: 33.9 MB
ℹ️ View Unchanged
|
|
We have confirmation from multiple users that this resolves the issue. |
|
/patch |
|
🚀 [Step 1/4] Patch workflow(s) waiting for approval! 📋 Details:
⏳ Status: The patch creation workflow has been triggered and is waiting for deployment approval. Please visit the specific workflow links below and approve the runs. 🔗 Track Progress: |
|
🚀 [Step 2/4] Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 [Step 2/4] Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |
|
🚀 [Step 3/4] Patch Release Waiting for Approval! 📋 Release Details:
⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes. 🔗 Track Progress: |
|
🚀 [Step 3/4] Patch Release Waiting for Approval! 📋 Release Details:
⏳ Status: The patch release has been triggered and is waiting for deployment approval. Please visit the specific workflow run link below and approve the deployment. You'll receive another update when it completes. 🔗 Track Progress: |
|
❌ [Step 4/4] Patch Release Failed! 📋 Details:
🔍 Next Steps:
🔗 Troubleshooting: |
|
✅ [Step 4/4] Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
|
✅ [Step 4/4] Patch Release Complete! 📦 Release Details:
🎉 Status: Your patch has been successfully released and published to npm! 📝 What's Available:
🔗 Links: |
Summary
Harden PTY resize logic to prevent native C++ crashes (
libc++abi: terminating) caused by race conditions when a process exits during a UI-triggered resize.Details
This PR implements a "Defense in Depth" strategy to resolve intermittent crashes where
node-ptytriggers alibc++abitermination due to an uncaughtNapi::Error(Bad File Descriptor) at the C++ level.process.kill(pid, 0)) immediately before native resize calls inShellExecutionService.ts. This asks the OS directly if the process is alive, closing the race condition window that our internal JS state maps cannot catch.uncaughtExceptionlistener inpackages/cli/index.tsto safely handle native errors that lack message strings, preventing secondary crashes.resizePtyto use a single map lookup and ensured it only bails if the Kernel explicitly confirms the process is gone (ESRCH), maintaining test compatibility.Related Issues
Closes #26433
Closes #27443
How to Validate
npm test -w @google/gemini-cli-core -- src/services/shellExecutionService.test.tssleep 1) and rapidly resize the terminal window. The CLI should remain stable.Pre-Merge Checklist