Skip to content

fix: treat an empty installed JSON file as blank - #270

Merged
furedea merged 2 commits into
mainfrom
fix/empty-installed-json
Dec 1, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/empty-installed-json

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closes #269

原因

#268 の MCP ファイル同期が installed の JSON を Json::parse でそのまま読むため,Antigravity が初回起動時に作る 0 バイトの mcp_config.json で EOF while parsing となり,activation 全体が中断していた.YAML には installed の空文書を blank とする既存の扱いがあったが,JSON にはなかった.

修正

  • Json::parse が Role::Installed かつ空白のみのテキストを空オブジェクトとして読む(YAML と同じ方針.codec レベルなので全 installed JSON に適用)
  • generated の空 JSON,非空の不正 JSON,[],null は従来どおりエラー(既存の pi_rejects_invalid_documents… が維持を確認)
  • 空の installed は通常の描画で書き戻される(同期テストで mcpServers が書かれることを確認)
  • TOML は空文字列を空ドキュメントとしてもともと受け付ける.テストを追加して固定した

備考

リリースと dotfiles の lock 更新後は,回避策の printf '{}\n' > は不要になる.ADR は YAML との整合のみで新たな決定がないため追加していない.

🤖 Generated with Claude Code

@furedea

furedea commented Dec 1, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-01T11:23:34.874531Z
We couldn’t complete this review. Comment @codex review to try again.
780bb5d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review summary: no findings.

  • Json::parse now reads whitespace-only text as Self::blank() only when the role is Role::Installed. That matches how YAML already treats an empty installed document. Generated JSON that is empty or invalid, plus [] and null, still errors.
  • The only production caller with Role::Installed is Installed::parse (src/config_sync/installed.rs:108), so the change only affects files the user has installed, as intended.
  • Tests are added at the codec level (installed vs generated, whitespace variants, TOML empty document) and as an end-to-end Antigravity MCP sync from a 0-byte or newline-only target.

Blocking findings (P0/P1): 0.

@furedea

furedea commented Dec 1, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review summary

No blocking findings, and nothing else worth an inline comment.

  • Json::parse now treats a whitespace-only document as an empty object only for Role::Installed, the same way YAML already handles an empty installed file. Generated JSON still rejects empty input, as do invalid JSON, [] and null.
  • The only caller that passes Role::Installed is Installed::parse, so the change stays limited to the user's installed configs.
  • The new tests cover both sides at the codec level (blank installed vs. generated) and the end-to-end Antigravity MCP sync, where the blank file gets filled from the source. There is also a new TOML test that pins how it handles an empty file.

P0: 0 · P1: 0 · P2: 0 · P3: 0

@furedea
furedea merged commit b16c370 into main Dec 1, 2026
21 of 23 checks passed
@furedea
furedea deleted the fix/empty-installed-json branch December 1, 2026 11:32
furedea pushed a commit that referenced this pull request Dec 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.10.1](agent-harness-v0.10.0...agent-harness-v0.10.1)
(2026-12-01)


### Bug Fixes

* treat an empty installed JSON file as blank
([#270](#270))
([b16c370](b16c370))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
furedea added a commit to furedea/dotfiles that referenced this pull request Dec 2, 2026
## 変更

`agent-harness` の flake input を v0.10.1(58b900f)に更新する.

v0.10.0(furedea/agent-harness#268)は Antigravity の MCP 設定ファイル
`~/.gemini/config/mcp_config.json` を同期するようになったが,Antigravity が作る 0
バイトのファイルを JSON として読めず,home-manager の activation が
`agentHarnessAntigravityMcpServers` で止まっていた(以降の activation,Claude の
`settings.json`
の同期などが走らない).v0.10.1(furedea/agent-harness#270)は,既存ファイルが空または空白だけのとき空の設定として扱う.

## 確認

- `nix flake check` が通る.
- lock の commit が `agent-harness-v0.10.1` タグと一致する.

## マージ後の確認

1. `sudo darwin-rebuild switch` が最後まで通る(`{}` を書き込む回避策は不要).
2. Claude のセッションを起動し直し,ツールを使っても `Usage: audit_log.py denied …` の hook
エラーが出ない.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 空の installed JSON ファイルを blank として扱う

1 participant