fix: restore pending approvals when using /resume command (#546)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -4413,6 +4413,33 @@ export default function App({
|
||||
setStaticItems([separator, successItem]);
|
||||
setLines(toLines(buffersRef.current));
|
||||
}
|
||||
|
||||
// Restore pending approvals if any (fixes #540 for /resume command)
|
||||
if (resumeData.pendingApprovals.length > 0) {
|
||||
setPendingApprovals(resumeData.pendingApprovals);
|
||||
|
||||
// Analyze approval contexts (same logic as startup)
|
||||
try {
|
||||
const contexts = await Promise.all(
|
||||
resumeData.pendingApprovals.map(async (approval) => {
|
||||
const parsedArgs = safeJsonParseOr<
|
||||
Record<string, unknown>
|
||||
>(approval.toolArgs, {});
|
||||
return await analyzeToolApproval(
|
||||
approval.toolName,
|
||||
parsedArgs,
|
||||
);
|
||||
}),
|
||||
);
|
||||
setApprovalContexts(contexts);
|
||||
} catch (approvalError) {
|
||||
// If analysis fails, leave context as null (will show basic options)
|
||||
console.error(
|
||||
"Failed to analyze resume approvals:",
|
||||
approvalError,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
const errorCmdId = uid("cmd");
|
||||
@@ -7516,6 +7543,35 @@ Plan file path: ${planFilePath}`;
|
||||
setStaticItems([separator, successItem]);
|
||||
setLines(toLines(buffersRef.current));
|
||||
}
|
||||
|
||||
// Restore pending approvals if any (fixes #540 for ConversationSelector)
|
||||
if (resumeData.pendingApprovals.length > 0) {
|
||||
setPendingApprovals(resumeData.pendingApprovals);
|
||||
|
||||
// Analyze approval contexts (same logic as startup)
|
||||
try {
|
||||
const contexts = await Promise.all(
|
||||
resumeData.pendingApprovals.map(
|
||||
async (approval) => {
|
||||
const parsedArgs = safeJsonParseOr<
|
||||
Record<string, unknown>
|
||||
>(approval.toolArgs, {});
|
||||
return await analyzeToolApproval(
|
||||
approval.toolName,
|
||||
parsedArgs,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
setApprovalContexts(contexts);
|
||||
} catch (approvalError) {
|
||||
// If analysis fails, leave context as null (will show basic options)
|
||||
console.error(
|
||||
"Failed to analyze resume approvals:",
|
||||
approvalError,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
const errorCmdId = uid("cmd");
|
||||
|
||||
Reference in New Issue
Block a user