Skip to content

fix(acp): convert RESOURCE_NOT_FOUND to ENOENT for fs delegation - #14190

Closed
codefromthecrypt wants to merge 2 commits into
google-gemini:mainfrom
codefromthecrypt:fix/acp-fs-delegation
Closed

fix(acp): convert RESOURCE_NOT_FOUND to ENOENT for fs delegation#14190
codefromthecrypt wants to merge 2 commits into
google-gemini:mainfrom
codefromthecrypt:fix/acp-fs-delegation

Conversation

@codefromthecrypt

@codefromthecrypt codefromthecrypt commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

Summary

Fix ACP fs delegation error handling: convert RESOURCE_NOT_FOUND errors to
Node.js ENOENT format when reading files via client delegation.

Details

When clients advertise fs.readTextFile capability, gemini-cli delegates
file reads to the client. If the file doesn't exist, the client returns
an error with code -32002 (RESOURCE_NOT_FOUND). This change converts that
error to a Node.js-style ENOENT error so downstream code handles it correctly.

Changes:

  • connection.ts: Add RESOURCE_NOT_FOUND error code constant
  • fileSystemService.ts: Make capabilities public readonly, add try/catch
    in readTextFile() to convert RESOURCE_NOT_FOUND to ENOENT
  • fileSystemService.test.ts: Add test for ENOENT conversion

How to Validate

  1. Start gemini-cli with a client that advertises fs.readTextFile: true
  2. Prompt to read a non-existent file
  3. Verify the error has code: 'ENOENT' instead of raw JSON-RPC error

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests
  • Noted breaking changes (if any)

Fixes #17588

@codefromthecrypt
codefromthecrypt force-pushed the fix/acp-fs-delegation branch 10 times, most recently from a2447d5 to 6816486 Compare December 5, 2025 08:31
@codefromthecrypt codefromthecrypt changed the title Fix/acp fs delegation Convert RESOURCE_NOT_FOUND to ENOENT for ACP fs delegation Dec 5, 2025
@codefromthecrypt
codefromthecrypt force-pushed the fix/acp-fs-delegation branch 2 times, most recently from 5ef25a1 to 8adac99 Compare December 6, 2025 02:43
@codefromthecrypt
codefromthecrypt marked this pull request as ready for review December 6, 2025 02:44
@codefromthecrypt
codefromthecrypt requested a review from a team as a code owner December 6, 2025 02:44
@codefromthecrypt
codefromthecrypt force-pushed the fix/acp-fs-delegation branch 4 times, most recently from 91eda67 to d347d1f Compare December 10, 2025 06:09
@codefromthecrypt codefromthecrypt changed the title Convert RESOURCE_NOT_FOUND to ENOENT for ACP fs delegation fix(acp): convert RESOURCE_NOT_FOUND to ENOENT for fs delegation Dec 16, 2025
@codefromthecrypt
codefromthecrypt force-pushed the fix/acp-fs-delegation branch 3 times, most recently from 81221ac to ff8eb30 Compare December 17, 2025 02:13
@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Jan 7, 2026
@bdmorgan

Copy link
Copy Markdown
Collaborator

Hi @codefromthecrypt, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

- processSingleFileContent now uses fileSystemService.readTextFile()
  to enable delegation to ACP client when fs.readTextFile capability exists
- StandardFileSystemService.readTextFile() uses readFileWithEncoding()
  to preserve BOM handling for non-ACP local file reading
- Convert RESOURCE_NOT_FOUND to ENOENT for ACP fs delegation
@codefromthecrypt

Copy link
Copy Markdown
Contributor Author

@allenhutchison I added integration tests to reproduce the call sites based on the other PR you helped merge. if this is too much or anything lemme know

@gemini-cli

gemini-cli Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Hi there! Thank you for your contribution to Gemini CLI.

To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md.

This pull request is being closed because it is not currently linked to an issue. You can easily reopen this PR once you have linked it to an issue.

How to link an issue:
Add a keyword followed by the issue number (e.g., Fixes #123) in the description of your pull request. For more details, see the GitHub Documentation.

Thank you for your understanding and for being a part of our community!

@codefromthecrypt

Copy link
Copy Markdown
Contributor Author

@allenhutchison I backfilled the issue for this and linked it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l A large sized PR status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP fs delegation: map RESOURCE_NOT_FOUND to ENOENT for readTextFile

4 participants