mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-19 23:05:21 +00:00
fix(claude): preserve interactive MCP requests in bypass
The SDK drops the interaction flag from control requests but forwards the CLI decision reason. Use that reason to preserve requests requiring an answer.
This commit is contained in:
@@ -127,16 +127,18 @@ test("bypass allows execution without publishing permission events and follows l
|
||||
await expect(result).resolves.toMatchObject({ behavior: "allow", updatedInput: input });
|
||||
expect(events.filter((event) => event.type.startsWith("permission_"))).toEqual([]);
|
||||
|
||||
for (const [mode, tool, toolInput] of [
|
||||
["bypassPermissions", "AskUserQuestion", { questions: [] }],
|
||||
["bypassPermissions", "ExitPlanMode", { plan: "Review this" }],
|
||||
["default", "Bash", input],
|
||||
["plan", "Bash", input],
|
||||
for (const [mode, tool, toolInput, decisionReason] of [
|
||||
["bypassPermissions", "AskUserQuestion", { questions: [] }, undefined],
|
||||
["bypassPermissions", "ExitPlanMode", { plan: "Review this" }, undefined],
|
||||
["bypassPermissions", "mcp__survey__answer", {}, "requiresUserInteraction"],
|
||||
["default", "Bash", input, undefined],
|
||||
["plan", "Bash", input, undefined],
|
||||
] as const) {
|
||||
await session.setMode(mode);
|
||||
const resolution = requestPermission(tool, toolInput, {
|
||||
signal: new AbortController().signal,
|
||||
toolUseID: tool,
|
||||
decisionReason,
|
||||
});
|
||||
const requestEvent = events.at(-1);
|
||||
expect(requestEvent?.type).toBe("permission_requested");
|
||||
|
||||
@@ -5312,7 +5312,8 @@ class ClaudeAgentSession implements AgentSession {
|
||||
const needsUserAnswer =
|
||||
toolName === "AskUserQuestion" ||
|
||||
toolName === "ExitPlanMode" ||
|
||||
("requiresUserInteraction" in options && options.requiresUserInteraction === true);
|
||||
// The SDK drops requires_user_interaction but forwards this CLI reason.
|
||||
options.decisionReason === "requiresUserInteraction";
|
||||
if (this.currentMode === "bypassPermissions" && !needsUserAnswer) {
|
||||
return { behavior: "allow", updatedInput: input, toolUseID: options.toolUseID };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user