From b1bd41dae6b62a0652156ea7879551da6e973c0a Mon Sep 17 00:00:00 2001 From: Overbaker <172112093+Overbaker@users.noreply.github.com> Date: Wed, 18 Nov 2026 04:00:33 +0000 Subject: [PATCH] fix(wrapper): always skip permissions for the antigravity backend Headless `agy -p` auto-denies any tool that needs approval ("a tool required the read_file permission that headless mode cannot prompt for"), so antigravity sub-tasks returned no output and exited 1. agy's own auto mode is no fallback: it is disabled when the terminal sandbox is unavailable (AppArmor restricting unprivileged user namespaces). The claude backend already passes --dangerously-skip-permissions unconditionally (#143); the antigravity builder still gated it on cfg.SkipPermissions, which no caller sets. Pass it unconditionally and cover new/resume/nil args with a unit test. via [HAPI](https://hapi.run) Co-Authored-By: HAPI Co-Authored-By: Claude Opus 5.5 --- codeagent-wrapper/backend.go | 13 ++++++++----- codeagent-wrapper/backend_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/codeagent-wrapper/backend.go b/codeagent-wrapper/backend.go index 21e7fce..741c237 100644 --- a/codeagent-wrapper/backend.go +++ b/codeagent-wrapper/backend.go @@ -125,11 +125,14 @@ func buildAntigravityArgs(cfg *Config, targetArg string) []string { return nil } - var args []string - - if cfg.SkipPermissions { - args = append(args, "--dangerously-skip-permissions") - } + // Same reasoning as buildClaudeArgs (#143): the wrapper only runs headless + // orchestration sub-tasks, and headless agy auto-denies every tool that needs + // approval ("read_file permission that headless mode cannot prompt for"), so + // it returns no output. Its own auto mode is no fallback either: it is + // disabled wherever the terminal sandbox is unavailable (e.g. AppArmor + // restricting unprivileged user namespaces). The cfg.SkipPermissions gate was + // dead here too — no caller sets it. + args := []string{"--dangerously-skip-permissions"} if cfg.Mode == "resume" && cfg.SessionID != "" { args = append(args, "--conversation", cfg.SessionID) diff --git a/codeagent-wrapper/backend_test.go b/codeagent-wrapper/backend_test.go index c0b4996..aab489e 100644 --- a/codeagent-wrapper/backend_test.go +++ b/codeagent-wrapper/backend_test.go @@ -290,6 +290,32 @@ func TestLoadMinimalEnvSettings(t *testing.T) { }) } +func TestAntigravityBuildArgs_AlwaysSkipsPermissions(t *testing.T) { + t.Run("new mode adds workdir", func(t *testing.T) { + cfg := &Config{Mode: "new", WorkDir: "/tmp/project", Backend: "antigravity"} + got := buildAntigravityArgs(cfg, "do the task") + want := []string{"--dangerously-skip-permissions", "--add-dir", "/tmp/project", "-p", "do the task"} + if !reflect.DeepEqual(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + }) + + t.Run("resume mode uses conversation", func(t *testing.T) { + cfg := &Config{Mode: "resume", SessionID: "conv-1", WorkDir: "/tmp/project", Backend: "antigravity"} + got := buildAntigravityArgs(cfg, "follow-up") + want := []string{"--dangerously-skip-permissions", "--conversation", "conv-1", "-p", "follow-up"} + if !reflect.DeepEqual(got, want) { + t.Fatalf("got %v, want %v", got, want) + } + }) + + t.Run("nil config", func(t *testing.T) { + if got := buildAntigravityArgs(nil, "x"); got != nil { + t.Fatalf("nil config should return nil, got %v", got) + } + }) +} + func TestGrokBuildArgs_NewMode(t *testing.T) { cfg := &Config{Mode: "new", WorkDir: "/tmp/project", Backend: "grok"} args := buildGrokArgs(cfg, "do the task")