fix(headless): auto-deny interactive approvals during recovery (#1415)
This commit is contained in:
@@ -2941,28 +2941,17 @@ async function runBidirectionalMode(
|
|||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// In headless recovery mode, auto-deny approvals that would require user
|
||||||
|
// input. Calling requestPermission() here would block waiting for a
|
||||||
|
// response that will never come, causing a timeout.
|
||||||
for (const ac of needsUserInput) {
|
for (const ac of needsUserInput) {
|
||||||
const permResponse = await requestPermission(
|
decisions.push({
|
||||||
ac.approval.toolCallId,
|
type: "deny",
|
||||||
ac.approval.toolName,
|
approval: ac.approval,
|
||||||
ac.parsedArgs,
|
reason:
|
||||||
);
|
ac.denyReason ||
|
||||||
|
"Auto-denied during recovery - tool requires interactive approval",
|
||||||
if (permResponse.decision === "allow") {
|
});
|
||||||
const finalApproval = permResponse.updatedInput
|
|
||||||
? {
|
|
||||||
...ac.approval,
|
|
||||||
toolArgs: JSON.stringify(permResponse.updatedInput),
|
|
||||||
}
|
|
||||||
: ac.approval;
|
|
||||||
decisions.push({ type: "approve", approval: finalApproval });
|
|
||||||
} else {
|
|
||||||
decisions.push({
|
|
||||||
type: "deny",
|
|
||||||
approval: ac.approval,
|
|
||||||
reason: permResponse.reason || "Denied by SDK callback",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decisions.length === 0) {
|
if (decisions.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user