Skip to content

fix: support multi-agent detection and deny git#202

Merged
blak0p merged 2 commits into
mainfrom
feat/hooks-multi-agente
Jun 30, 2026
Merged

fix: support multi-agent detection and deny git#202
blak0p merged 2 commits into
mainfrom
feat/hooks-multi-agente

Conversation

@blak0p

@blak0p blak0p commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Closes #199

PR Type

  • Bug fix

Summary

  • runStdinMode now detects Codex, Claude Code, and Antigravity from stdin JSON keys
  • Codex and Claude Code emit permissionDecision: "deny" (was additionalContext suggestion)
  • Antigravity emits top-level {"allow_tool": false, "deny_reason": "..."} with exit 0
  • OpenCode policy changed from "ask" to "deny" for bash["git *"]
  • Non-git commands on all agents: exit 0 with no output

Changes

File Change
internal/delivery/cli/hook_check.go Unified hookInput struct, agentType enum, antigravityHookOutput struct, runStdinMode rewrite with nil-check dispatch
internal/delivery/cli/hook_check_test.go 4 new tests (Claude Code git/non-git, Antigravity git/non-git), 1 updated (Codex deny format)
internal/installer/mcp_config.go bash["git *"] = "ask""deny"
internal/installer/opencode_policy_test.go 3 asserts updated to "deny"
internal/installer/v26_test.go 2 asserts updated to "deny"

Test Plan

  • go test ./internal/delivery/cli/... passes
  • go test ./internal/installer/... passes
  • go build ./... passes
  • go test ./... passes

Contributor Checklist

  • Linked an approved issue
  • Added exactly one type:* label
  • Conventional commit format
  • No Co-Authored-By trailers

WHY
The hook check only recognized Codex JSON shapes, causing it to silently ignore or fail to block git commands from other AI agents like Claude Code and Antigravity. Additionally, the previous 'ask' policy for git commands required manual intervention.

WHAT
* Added agent detection logic to identify Codex, Claude Code, and Antigravity inputs based on top-level JSON keys.
* Implemented specific deny output formats for each supported agent to properly block raw git execution.
* Updated OpenCode policy configuration in mcp_config.go to set git bash permissions to 'deny'.
@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.

@blak0p blak0p added the type:bug Bug fix label Jun 30, 2026
Resolve conflicts in hook_check.go and hook_check_test.go by keeping
the multi-agent detection from feat/hooks-multi-agente (Codex, Claude
Code, Antigravity) while preserving the deny permission pattern and
AdditionalContext assertions from main.
@blak0p blak0p merged commit 69e6d1b into main Jun 30, 2026
5 checks passed
@blak0p blak0p deleted the feat/hooks-multi-agente branch June 30, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: hooks only enforce on Codex — Claude Code and Antigravity silently pass through raw git

1 participant