gemini-cli
gemini-cli copied to clipboard
fix(acp): convert RESOURCE_NOT_FOUND to ENOENT for fs delegation
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: Makecapabilitiespublic readonly, add try/catch inreadTextFile()to convert RESOURCE_NOT_FOUND to ENOENT -
fileSystemService.test.ts: Add test for ENOENT conversion
How to Validate
- Start gemini-cli with a client that advertises
fs.readTextFile: true - Prompt to read a non-existent file
- Verify the error has
code: 'ENOENT'instead of raw JSON-RPC error
Pre-Merge Checklist
- [ ] Updated relevant documentation and README (if needed)
- [x] Added/updated tests
- [ ] Noted breaking changes (if any)