fix: include all approval results when auto-handling remaining approvals (#470)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-05 09:39:37 -08:00
committed by GitHub
parent dce4cccfc2
commit 8457e8c67e

View File

@@ -4789,11 +4789,18 @@ DO NOT respond to these messages or otherwise consider them in your response unl
setIsExecutingTool(true); setIsExecutingTool(true);
// Build ALL decisions: current + auto-allowed remaining // Snapshot current state BEFORE clearing (critical for ID matching!)
const allDecisions: Array<{ // This must include ALL previous decisions, auto-handled, and auto-denied
type: "approve"; const approvalResultsSnapshot = [...approvalResults];
approval: ApprovalRequest; const autoHandledSnapshot = [...autoHandledResults];
}> = [ const autoDeniedSnapshot = [...autoDeniedApprovals];
// Build ALL decisions: previous + current + auto-allowed remaining
const allDecisions: Array<
| { type: "approve"; approval: ApprovalRequest }
| { type: "deny"; approval: ApprovalRequest; reason: string }
> = [
...approvalResultsSnapshot, // Include decisions from previous rounds
{ type: "approve", approval: currentApproval }, { type: "approve", approval: currentApproval },
...nowAutoAllowed.map((r) => ({ ...nowAutoAllowed.map((r) => ({
type: "approve" as const, type: "approve" as const,
@@ -4824,6 +4831,25 @@ DO NOT respond to these messages or otherwise consider them in your response unl
}, },
); );
// Combine with auto-handled and auto-denied results (from initial check)
const allResults = [
...autoHandledSnapshot.map((ar) => ({
type: "tool" as const,
tool_call_id: ar.toolCallId,
tool_return: ar.result.toolReturn,
status: ar.result.status,
stdout: ar.result.stdout,
stderr: ar.result.stderr,
})),
...autoDeniedSnapshot.map((ad) => ({
type: "approval" as const,
tool_call_id: ad.approval.toolCallId,
approve: false,
reason: ad.reason,
})),
...executedResults,
];
setThinkingMessage(getRandomThinkingVerb()); setThinkingMessage(getRandomThinkingVerb());
refreshDerived(); refreshDerived();
@@ -4831,7 +4857,7 @@ DO NOT respond to these messages or otherwise consider them in your response unl
await processConversation([ await processConversation([
{ {
type: "approval", type: "approval",
approvals: executedResults as ApprovalResult[], approvals: allResults as ApprovalResult[],
}, },
]); ]);
} finally { } finally {
@@ -4848,6 +4874,8 @@ DO NOT respond to these messages or otherwise consider them in your response unl
approvalResults, approvalResults,
approvalContexts, approvalContexts,
pendingApprovals, pendingApprovals,
autoHandledResults,
autoDeniedApprovals,
handleApproveCurrent, handleApproveCurrent,
processConversation, processConversation,
refreshDerived, refreshDerived,