Compare commits

...
Author SHA1 Message Date
Mohamed Boudra e529c3601f fix(server): drop Claude permission skip allowance
Fixes #1582.
2026-06-20 13:45:42 +07:00
2 changed files with 5 additions and 21 deletions
@@ -947,7 +947,7 @@ test("captures Claude stderr in the turn failure diagnostic when stderr arrives
} }
}); });
test("preserves bypass capability across query restarts triggered by thinking changes", async () => { test("omits dangerous permission-skip allowance from default-mode launches", async () => {
const capturedOptions: Array<{ const capturedOptions: Array<{
permissionMode?: string; permissionMode?: string;
allowDangerouslySkipPermissions?: boolean; allowDangerouslySkipPermissions?: boolean;
@@ -964,11 +964,7 @@ test("preserves bypass capability across query restarts triggered by thinking ch
effort?: string; effort?: string;
}; };
}) => { }) => {
capturedOptions.push({ capturedOptions.push(options);
permissionMode: options.permissionMode,
allowDangerouslySkipPermissions: options.allowDangerouslySkipPermissions,
effort: options.effort,
});
return createBaseQueryMock(vi.fn(async () => ({ done: true, value: undefined }))); return createBaseQueryMock(vi.fn(async () => ({ done: true, value: undefined })));
}, },
@@ -977,21 +973,13 @@ test("preserves bypass capability across query restarts triggered by thinking ch
const session = await createSession(); const session = await createSession();
try { try {
await session.setMode("bypassPermissions"); await collectUntilTerminal(streamSession(session, "say exactly hello"));
await session.setMode("acceptEdits");
await session.setThinkingOption("high");
await session.setMode("bypassPermissions");
expect(capturedOptions).toHaveLength(2); expect(capturedOptions).toHaveLength(1);
expect(capturedOptions[0]).toMatchObject({ expect(capturedOptions[0]).toMatchObject({
permissionMode: "default", permissionMode: "default",
allowDangerouslySkipPermissions: true,
});
expect(capturedOptions[1]).toMatchObject({
permissionMode: "acceptEdits",
allowDangerouslySkipPermissions: true,
effort: "high",
}); });
expect(capturedOptions[0]).not.toHaveProperty("allowDangerouslySkipPermissions");
} finally { } finally {
await session.close(); await session.close();
} }
@@ -2684,10 +2684,6 @@ class ClaudeAgentSession implements AgentSession {
cwd: this.config.cwd, cwd: this.config.cwd,
includePartialMessages: true, includePartialMessages: true,
permissionMode: this.currentMode, permissionMode: this.currentMode,
// Dynamic mode switching can recreate the underlying Claude query. Keep the
// bypass launch capability available so later setPermissionMode("bypassPermissions")
// calls do not fail after a model/thinking/rewind-driven restart.
allowDangerouslySkipPermissions: true,
agents: this.defaults?.agents, agents: this.defaults?.agents,
canUseTool: this.handlePermissionRequest, canUseTool: this.handlePermissionRequest,
pathToClaudeCodeExecutable: claudeBinary, pathToClaudeCodeExecutable: claudeBinary,