fix: treat exec approval timeouts as no-decision

This commit is contained in:
Peter Steinberger
2026-01-19 08:54:08 +00:00
parent adfb000587
commit 428241d941

View File

@@ -25,7 +25,7 @@ export type ExecApprovalRecord = {
type PendingEntry = {
record: ExecApprovalRecord;
resolve: (decision: ExecApprovalDecision) => void;
resolve: (decision: ExecApprovalDecision | null) => void;
reject: (err: Error) => void;
timer: ReturnType<typeof setTimeout>;
};
@@ -45,11 +45,11 @@ export class ExecApprovalManager {
return record;
}
async waitForDecision(record: ExecApprovalRecord, timeoutMs: number): Promise<ExecApprovalDecision> {
return await new Promise<ExecApprovalDecision>((resolve, reject) => {
async waitForDecision(record: ExecApprovalRecord, timeoutMs: number): Promise<ExecApprovalDecision | null> {
return await new Promise<ExecApprovalDecision | null>((resolve, reject) => {
const timer = setTimeout(() => {
this.pending.delete(record.id);
resolve("deny");
resolve(null);
}, timeoutMs);
this.pending.set(record.id, { record, resolve, reject, timer });
});