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:
parent
fd09aeaad1
commit
359e759376
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue