fix(codeagent-wrapper): propagate SkipPermissions to parallel tasks (#113)

Parallel task execution was not inheriting the --skip-permissions flag,
causing permission prompts to appear for parallel tasks while single
tasks worked correctly.

Changes:
- Add SkipPermissions field to TaskSpec struct
- Parse skip_permissions/skip-permissions in parallel task config
- Inherit SkipPermissions from CLI args to parallel tasks
- Pass SkipPermissions when creating task Config in executor

Generated with SWE-Agent.ai

Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
cexll
2026-01-14 11:50:36 +08:00
parent 8f05626075
commit 55a574280a
5 changed files with 83 additions and 1 deletions

View File

@@ -1587,6 +1587,26 @@ do something`
}
}
func TestParallelParseConfig_SkipPermissions(t *testing.T) {
input := `---TASK---
id: task-1
skip_permissions: true
---CONTENT---
do something`
cfg, err := parseParallelConfig([]byte(input))
if err != nil {
t.Fatalf("parseParallelConfig() unexpected error: %v", err)
}
if len(cfg.Tasks) != 1 {
t.Fatalf("expected 1 task, got %d", len(cfg.Tasks))
}
task := cfg.Tasks[0]
if !task.SkipPermissions {
t.Fatalf("SkipPermissions = %v, want true", task.SkipPermissions)
}
}
func TestParallelParseConfig_EmptySessionID(t *testing.T) {
input := `---TASK---
id: task-1
@@ -4014,6 +4034,30 @@ do two`)
}
})
t.Run("parallelSkipPermissions", func(t *testing.T) {
defer resetTestHooks()
cleanupHook = func() {}
cleanupLogsFn = func() (CleanupStats, error) { return CleanupStats{}, nil }
t.Setenv("CODEAGENT_SKIP_PERMISSIONS", "false")
runCodexTaskFn = func(task TaskSpec, timeout int) TaskResult {
if !task.SkipPermissions {
return TaskResult{TaskID: task.ID, ExitCode: 1, Error: "SkipPermissions not propagated"}
}
return TaskResult{TaskID: task.ID, ExitCode: 0, Message: "ok"}
}
stdinReader = strings.NewReader(`---TASK---
id: only
backend: claude
---CONTENT---
do one`)
os.Args = []string{"codeagent-wrapper", "--parallel", "--skip-permissions"}
if code := run(); code != 0 {
t.Fatalf("run exit = %d, want 0", code)
}
})
t.Run("parallelErrors", func(t *testing.T) {
defer resetTestHooks()
cleanupLogsFn = func() (CleanupStats, error) { return CleanupStats{}, nil }