Default dangerouslySkipPermissions to true for autonomous agent operation

Spawned agents need to run CLI commands without permission prompts. Changed
the agentConfig.permissions schema default from undefined to "skip" so
--dangerously-skip-permissions is included by default. The orchestrator
session is hardcoded to "skip" regardless of config since it must always
run ao CLI commands autonomously.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Prateek 2026-02-27 18:55:23 +05:30
parent fd09aeaad1
commit 359e759376
3 changed files with 10 additions and 5 deletions

View File

@ -53,7 +53,7 @@ const NotifierConfigSchema = z
const AgentSpecificConfigSchema = z
.object({
permissions: z.enum(["skip", "default"]).optional(),
permissions: z.enum(["skip", "default"]).default("skip"),
model: z.string().optional(),
})
.passthrough();

View File

@ -605,11 +605,12 @@ export function createSessionManager(deps: SessionManagerDeps): SessionManager {
writeFileSync(systemPromptFile, orchestratorConfig.systemPrompt, "utf-8");
}
// Get agent launch config — uses systemPromptFile, no issue/tracker interaction
// Get agent launch config — uses systemPromptFile, no issue/tracker interaction.
// Orchestrator ALWAYS gets skip permissions — it must run ao CLI commands autonomously.
const agentLaunchConfig = {
sessionId,
projectConfig: project,
permissions: project.agentConfig?.permissions,
permissions: "skip" as const,
model: project.agentConfig?.model,
systemPromptFile,
};

View File

@ -140,7 +140,7 @@ describe("getLaunchCommand", () => {
const agent = create();
it("generates base command without shell syntax", () => {
const cmd = agent.getLaunchCommand(makeLaunchConfig());
const cmd = agent.getLaunchCommand(makeLaunchConfig({ permissions: "default" }));
expect(cmd).toBe("claude");
// Must not contain shell operators (execFile-safe)
expect(cmd).not.toContain("&&");
@ -180,9 +180,13 @@ describe("getLaunchCommand", () => {
expect(cmd).toBe("claude --dangerously-skip-permissions --model 'opus' -p 'Hello'");
});
it("omits --dangerously-skip-permissions when permissions=default", () => {
const cmd = agent.getLaunchCommand(makeLaunchConfig({ permissions: "default" }));
expect(cmd).not.toContain("--dangerously-skip-permissions");
});
it("omits optional flags when not provided", () => {
const cmd = agent.getLaunchCommand(makeLaunchConfig());
expect(cmd).not.toContain("--dangerously-skip-permissions");
expect(cmd).not.toContain("--model");
expect(cmd).not.toContain("-p");
});