Repository navigation
feat(hooks): add the Antigravity hook adapter - #263
Conversation
Translate Antigravity's camelCase payloads and tool names to the shared guards, answer with its decision objects (deny, force_ask, continue), and let the shared adapter read one JSON object from stdout for providers that need it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review summaryNo P0 or P1 findings, so I posted no inline comments. I read the diff and traced each guard path through the new
One optional note (P3): I did not run the tests. The PR reports pytest, bats, ruff, and ty as passing. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…er Profile Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Review summaryI found no P0 or P1 issues. There is one P2, posted inline. What I checked
P2 (inline): Notes, not findings
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebcdac7fc2
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Review summaryI found no P0, P1 or P2 issues, and left one P3 inline comment. What I checked
Findings
Not verified
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 440cc46e04
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Review summaryThe change is a read-only review. I found no P0 or P1 problems. The Antigravity translation layer looks sound:
Findings, posted inline:
Not verifiable here: the behavior against a real 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cf0484320
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address review on #263: a guard refuses with the deny object and exit status 0, and a guard that finds nothing answers {"decision":"allow"} because {} is read as a deny. Other events keep exit status 2 and answer {}. Unexpected guard errors now deny, an allow notice is dropped, SessionStart takes cwd from workspacePaths, and malformed ReplacementChunks are rejected. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Review summaryNo P0/P1/P2 findings. I read the diff and the surrounding code: What I checked
P3 (not blocking): PR description and code disagree on the pass-through answer.
Already disclosed in the PR: behaviour on a real |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🤖 I have created a release *beep* *boop* --- ## [0.4.0](v0.3.1...v0.4.0) (2026-11-21) ### Features * **hooks:** add the Antigravity hook adapter ([#263](#263)) ([22b5980](22b5980)) * **hooks:** guard t3 thread so lanes start only on Claude or Codex ([#265](#265)) ([aa0de7a](aa0de7a)) * **hooks:** sweep merged T3 Code lane worktrees like Herdr ones ([#266](#266)) ([8c730aa](8c730aa)) * **skills:** add a tool-neutral delegation skill with T3 Code operations ([#268](#268)) ([dc2c3cc](dc2c3cc)) --- 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>
…policy (#286) ## 概要 agent-harness が描画と配置だけを担うようになり(furedea/agent-harness#262),これまで harness が合成していた保護とエージェント用 GitHub トークンの配線が消えた.その代わりをこのリポジトリのソース設定とフックで持つ. - 保護は「書き込みの許可リスト+ハーネスのルートごとの拒否」にした.ルートは `agents/hooks/rules/harness_roots.json` に 1 か所で宣言し,Claude と Antigravity のネイティブの拒否,および全 provider 共通の `guard_file.py harness` がそれに従う.テストが各設定と宣言の一致を確かめる. - フックは生成ファイル `protected_paths.json` を読まなくなった.`harness_roots.json` を読み,対象が(`.` と `..` を畳んだうえで)いずれかのルートの中なら拒否する. - GitHub:`gh` を Claude の sandbox の中で動かし,`github.com` と `api.github.com` への通信を許す.Codex は guarded プロファイルで動く.`GH_CONFIG_DIR` の値はホストごとの絶対パスで,Claude の `env` も Codex の `shell_environment_policy.set` も `~` を展開しないため,ソースには書かずホスト(dotfiles,サーバーでは `bootstrap_server.sh`)が渡す(ユーザーの決定). - App の鍵は,`~/.ssh` 全体の読み取り拒否として各 provider のネイティブ設定に明示した.ソースには鍵のファイル名を書かない. - ADR-0031 を追加し,ADR-0013 を partly-superseded にした. Closes #285 ## 移行項目の対応表 ### furedea/agent-harness#265(保護) - [x] フックの `protected_paths.json` 依存を外す → `agents/hooks/guard_file.py`,`agents/hooks/rules/harness_roots.json`(Codex,Devin,Hermes,Pi,dsh,Antigravity のアダプターも同じフックを通る) - [x] Claude `permissions.deny` にルートごとの `Edit(...)` → `agents/claude/settings.json`(`~/.claude/**`,`~/.codex/**`,`~/.devin/**`,`~/.config/devin/config.json`,`~/.hermes/**`,`~/.pi/**`,`~/.dsh/**`,`~/.gemini/config/**`,`~/.gemini/antigravity-cli/settings.json`) - [x] Claude `sandbox.filesystem.denyWrite` → 追加不要.`allowWrite` はどのルートも含まない(テストで固定) - [x] Codex:ルートを書けない guarded プロファイル → `agents/codex/config.toml`(`":root" = "read"`,書き込みは作業ディレクトリ,一時領域,Claude の `allowWrite` と同じキャッシュだけ.テストで Claude と一致を固定) - [x] Antigravity `agentMode = ""`,`enableTerminalSandbox = true` → `agents/antigravity/settings.json`(新規) - [x] Antigravity `read_file(/nix)`,`read_file(/run)` の許可,`/run` の秘密のマウント 8 つの `read_file(...)` の拒否 → 同上 - [x] Antigravity の各ルートの `write_file(...)` 拒否 → 同上 - [x] Devin,Hermes,Pi,dsh → ネイティブの規則の面がないので,フック(`harness_roots.json`)で拒否 - [x] dotfiles の `--dsh-profile` → このリポジトリは使っていない(対応なし) ### furedea/agent-harness#264(GitHub トークン) - [x] Claude `sandbox.enableWeakerNetworkIsolation = true` → 既にソースにある - [x] Claude `sandbox.network.allowedDomains` に `github.com`,`api.github.com` → `agents/claude/settings.json` - [x] Claude `sandbox.excludedCommands` から `gh *` を外す → 同上 - [x] Claude の鍵の拒否(`permissions.deny` と `sandbox.filesystem.denyRead` の両方)→ `Read(~/.ssh/**)` と `~/.ssh`(鍵のパスを含む `~/.ssh` 全体.`secret_path_policy.json` の `~/.ssh/**`,`**/*.pem` でも生成される) - [x] `<configDir>` を隠す規則を置かない → テスト `test_agents_can_read_the_agent_gh_config_the_host_mints` - [x] Codex `default_permissions = "guarded"`,`":root"`,`":tmpdir"`,`":slash_tmp"`,`":workspace_roots"."."`,キャッシュの `"write"`,`[permissions.guarded.network] enabled = true` → `agents/codex/config.toml` - [x] Codex の鍵の拒否 → `"~/.ssh" = "deny"`(加えて harness が `"~/.ssh/**" = "none"` を生成) - [x] Codex `"~/.config/gh/hosts.yml" = "deny"` → `secret_path_policy.json` から harness が `"none"` を生成(従来どおり) - [x] Antigravity `read_file(~/.config/gh/hosts.yml)` → `secret_path_policy.json` から生成(従来どおり) - [x] Antigravity の鍵の拒否 → `read_file(~/.ssh)`(ソースに明示,生成とも重複は畳まれる) - [ ] Claude `env.GH_CONFIG_DIR`,Codex `shell_environment_policy.set.GH_CONFIG_DIR` → **dotfiles が渡す**(下記).ソースには書かない - [ ] トークンの発行と更新 → dotfiles(furedea/dotfiles のトークン lane).サーバーは下記のフォローアップ ### furedea/agent-harness#263(Pi の srt 拡張) - [x] `manifest.json` の `runtime_commands` に `srt` はない,Pi のためだけの sandbox エントリもない → 対応なし ## 旧版との意図した違い - ルート単位の拒否になったため,ファイルツールは `~/.claude/plans`(plan mode の計画ファイル)や `~/.claude/keybindings.json` など,ルート配下のすべてを書けない.旧版はインストールしたファイルだけを拒否していた.現在 `~/.claude/plans` は空で,plan mode は使われていない. - スキル(`~/.claude/skills` など)も保護される.旧版は保護していなかった. - Codex は main checkout で `.git/worktrees` 全体を書けない(Codex がグロブのエントリに `deny` しか受け付けず,`config.worktree` は git が読むため).Claude は `config.worktree` だけを拒否する.Codex の lane は worktree で動き,共通の `.git` は元々作業領域の外なので影響しない. - Codex の guarded プロファイルで,フックだけが書く状態と作業領域の `.git/hooks`,`.git/config` を書けなくなった(旧版は書けた). - 鍵の拒否は鍵のファイル単体ではなく `~/.ssh` 全体(従来から秘密パスのポリシーで拒否していた範囲と同じ). - App の鍵がないホストでも,GitHub への通信が sandbox で開き,`gh` は sandbox の中で未認証で動く.旧版は `gh` を sandbox の外でユーザー自身のログインで動かしていた. ## dotfiles が用意するもの - `GH_CONFIG_DIR = <home>/.config/agent-harness/gh`(旧既定値と同じ絶対パス)を,Home Manager の `programs.agent-harness.claude.settings.env` と `programs.agent-harness.codex.settings.shell_environment_policy.set` に足す(`NVIM_LOG_FILE` と同じ形). - トークンを `<home>/.config/agent-harness/gh/hosts.yml`(0600,一時ファイルからの rename)に書くスクリプトと,その定期実行. - 鍵は `~/.ssh/` の下に置いたままにする(ここに置く限り,上の拒否が効く). ## マージ後にユーザーが確かめること - dotfiles を新しい agent-harness に上げて切り替えたあと,Codex のセッションで作業領域への書き込みができ,`.git/hooks` と `~/.claude` への書き込みが拒否されること.このレーンの sandbox の中では `codex sandbox` が入れ子の seatbelt を作れず,設定の読み込みまでしか確かめられなかった. - Claude のセッションで `gh auth status` がエージェントの身元を示すこと(トークンは表示しない). ## 必要な agent-harness のリビジョン - この PR のソースは,ロック中の 0.9.15(c5b1303)と,#263〜#265 を含む main の 2008c43 の両方で `install` と `verify` が成功し,描画結果に保護,GitHub の配線,鍵の拒否が入ることを確かめた. - dotfiles は 2008c43 以降へ上げてよい(この PR のマージ後). ## フォローアップ - agent-config:`scripts/bootstrap_server.sh` は `agent-harness github-app-token refresh` でトークンを発行している.固定中のリリースでは動くが,#264 を含むリリースへ上げるとこのサブコマンドがなくなるので,その前に dotfiles と同じ形の発行スクリプトへ置き換える. - agent-config:`docs/DESIGN.md` の「`denyWrite` はまだ効いていない(agent-harness#213)」は,両方のリビジョンの描画で `denyWrite` がソースのまま出ていたので,記述の見直しが要る. ## レビュー対応 - 相対パスとシンボリックリンクでルートの判定をすり抜ける(claude-review P2):payload の `cwd` から解決し,字句上のパスと解決後のパスの両方で判定するよう修正した(dabd8070). - GitHub への通信路(claude-review P3):旧版と同じ構成なのでコードは変えず,ADR-0031 に追記した(caf37603). - Codex の guarded プロファイルが Claude の `denyWrite`(フックだけが書く状態,`.git/hooks`,`.git/config`,`config.worktree`)を写していない(claude-review P1):`"read"` で写し,テストで Claude と一致を固定した(45257d64).旧版が合成していたプロファイルにも同じ欠落があった. - codex-review は「レビューを完了できなかった」で失敗した(使用量制限など). ## 検証 - Red:`tests/hooks/test_guard_file.py` の新しい契約(28 件)と `tests/test_harness_protection.py`(宣言ファイルがない,鍵の拒否がない)が実装前に失敗することを確認した - `uv run pytest`:6662 passed,2 skipped - `bats tests/bootstrap_server.bats`:81 件成功 - `ruff check`,`ruff format --check`,変更ファイルの `dprint check`,`nix run .#adr-check -- docs/adr`:成功 - 新旧 2 つの agent-harness で一時ディレクトリへ `install` と `verify`,配置した `guard_file.py harness` がルート配下を拒否し,作業ディレクトリのファイルを許すことを確認した 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
概要
Google Antigravity (
agy) 用の hook adapter を追加します.furedea/agent-harness#256と並行して進める作業です.変更
agents/antigravity/hooks/hook_adapter.py: camelCase の payload と tool 名を共有 guard の形に変換し,deny/force_ask/continueの decision object で応答する.provider_adapter.py:reader/denial/escalationを Profile に追加.stdout から JSON object を 1 つ読む provider では,拒否を stdout の deny でも返し,何も出力しない成功は{}にする.既存 provider の挙動は変えない.session_store/audit_log/guard_file:antigravityを provider として認識.askは cache されるaskではなくforce_askにする.allowは Antigravity 自身の権限確認を飛ばすため,通過時は{}を返す.agents/hooks.jsonについて (未反映)lock 済みの
agent-harness(generate-hooks) は未知の provider keyantigravityをunknown provider keyで拒否します.そのためagents/hooks.jsonには追加していません.agent-harness#256のマージとflake.lockの更新後に,別 PR で配線します.検証
uv run --frozen pytest: 6385 passed, 2 skippedbats --recursive tests: 通過未確認
agy実機での動作は未確認 (hooks.md の契約に基づく).{}しか受け付けないため,lint の指摘は agent に届かない.🤖 Generated with Claude Code