[PR #1117] [MERGED] fix(setup): treat empty client config files as new documents #2662

Closed
opened 2026-10-17 21:08:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1117
Author: @lalomorales22
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @morluto

Base: main ← Head: fix/setup-empty-client-config


📝 Commits (3)

  • 5cb74cc fix(setup): treat empty client config files as new documents
  • 2cebc52 Merge remote-tracking branch 'origin/main' into review/pr-1117
  • 6efbb9c test(setup): use explicit unicode escape for BOM-only empty config case

📊 Changes

2 files changed (+47 additions, -1 deletions)

View changed files

📝 src/application/ClientConfigurationDocument.ts (+17 -1)
📝 tests/boundary/filesystem/clientConfigurationBom.test.ts (+30 -0)

📄 Description

Problem

npx rea-agents setup stops with status: needs_human and no planned actions when any detected client has a zero-byte MCP config file:

remediation: "Antigravity: The existing configuration is malformed. Repair it before setup applies any other changes."

Antigravity can leave ~/.gemini/config/mcp_config.json as an empty file. jsonc-parser reports ValueExpected for empty input, so setup reported the file as malformed and refused to configure every detected agent, not only Antigravity.

Fix

  • parseDocument: a JSON/JSONC file that is empty, whitespace-only, or BOM-only parses as {}. TOML already behaved this way.
  • serializeClientConfiguration: when the original text is empty, write a fresh document. In-place JSONC edits on a BOM-only file would otherwise put the BOM after the closing brace.

Files with real syntax errors are still rejected, and the existing malformed-BOM test still passes.

Verification

  • New boundary test (clientConfigurationBom.test.ts) covers "", "\n \n", and "": preflight → configure → readback → already_current. It fails without the fix and passes with it.
  • npm run check:changed and npm run check:fast pass.
  • On the affected machine, rea setup --all-detected --dry-run now returns status: planned with actions for all 8 detected clients, including Antigravity. Before the fix it returned needs_human with no actions.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1117 **Author:** [@lalomorales22](https://github.com/lalomorales22) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/setup-empty-client-config` --- ### 📝 Commits (3) - [`5cb74cc`](https://github.com/morluto/rea/commit/5cb74ccd256fca714607f935d2f10b92f0f699da) fix(setup): treat empty client config files as new documents - [`2cebc52`](https://github.com/morluto/rea/commit/2cebc52c9f2b9503a0527661a7db9423db5f28a9) Merge remote-tracking branch 'origin/main' into review/pr-1117 - [`6efbb9c`](https://github.com/morluto/rea/commit/6efbb9ca181aa0c40f7a3337c7b40249bf9baba2) test(setup): use explicit unicode escape for BOM-only empty config case ### 📊 Changes **2 files changed** (+47 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/application/ClientConfigurationDocument.ts` (+17 -1) 📝 `tests/boundary/filesystem/clientConfigurationBom.test.ts` (+30 -0) </details> ### 📄 Description ## Problem `npx rea-agents setup` stops with `status: needs_human` and no planned actions when any detected client has a zero-byte MCP config file: ``` remediation: "Antigravity: The existing configuration is malformed. Repair it before setup applies any other changes." ``` Antigravity can leave `~/.gemini/config/mcp_config.json` as an empty file. `jsonc-parser` reports `ValueExpected` for empty input, so setup reported the file as malformed and refused to configure **every** detected agent, not only Antigravity. ## Fix - `parseDocument`: a JSON/JSONC file that is empty, whitespace-only, or BOM-only parses as `{}`. TOML already behaved this way. - `serializeClientConfiguration`: when the original text is empty, write a fresh document. In-place JSONC edits on a BOM-only file would otherwise put the BOM after the closing brace. Files with real syntax errors are still rejected, and the existing malformed-BOM test still passes. ## Verification - New boundary test (`clientConfigurationBom.test.ts`) covers `""`, `"\n \n"`, and `""`: preflight → configure → readback → `already_current`. It fails without the fix and passes with it. - `npm run check:changed` and `npm run check:fast` pass. - On the affected machine, `rea setup --all-detected --dry-run` now returns `status: planned` with actions for all 8 detected clients, including Antigravity. Before the fix it returned `needs_human` with no actions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:08:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2662
No description provided.