fix(core): handle ENAMETOOLONG in robustRealpath - #26401
Conversation
pasting a long string containing @ ends up in resolveToRealPath via parseAllAtCommands, and the leaf trips ENAMETOOLONG. the catch only matched ENOENT/EISDIR, so it escaped the unguarded await in AppContainer as an unhandled rejection. extend the catch list, same shape as 41f1ea4. closes google-gemini#26368
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 a stability issue where pasting long strings containing unescaped '@' tokens caused the CLI to crash due to an unhandled promise rejection. By extending the error handling in the path resolution logic to include ENAMETOOLONG, the system now gracefully handles these cases, allowing the application to continue functioning as expected. 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 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 counter productive. 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 fixes a crash (issue #26368) caused by unhandled ENAMETOOLONG errors when processing long strings containing '@' symbols. The robustRealpath function in packages/core now explicitly catches ENAMETOOLONG alongside other expected filesystem errors. Regression tests have been added to both the CLI and core packages to ensure that long pasted strings are handled correctly without triggering unhandled rejections. I have no feedback to provide.
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. This PR will be closed in 7 days if it remains without that designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
|
This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding. |
summary
catches
ENAMETOOLONGinrobustRealpathalongsideENOENT/EISDIR. prevents the unhandled rejection on long pasted@-tokens.why
parseAllAtCommandsextracts a long token from a paste and feeds it throughresolveToRealPaththenrobustRealpath. the leaf tripsENAMETOOLONG; the existing catch only matchedENOENT/EISDIR, so the error escaped the unguardedawait checkPermissions(...)inAppContainer.tsxas an unhandled rejection.mirrors
41f1ea467(EISDIR). the parent-recursion fallback returns the input unchanged for single-segment leaves, sovalidatePathAccessdrops it and the blob falls through as plain text.tests
paths.test.ts:ENAMETOOLONGcases mirroring theEISDIRpatternatCommandProcessor.test.ts: long-paste integration coveragecloses #26368