Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions codeagent-wrapper/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions codeagent-wrapper/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading