fix: treat exec approval timeouts as no-decision
This commit is contained in:
@@ -25,7 +25,7 @@ export type ExecApprovalRecord = {
|
|||||||
|
|
||||||
type PendingEntry = {
|
type PendingEntry = {
|
||||||
record: ExecApprovalRecord;
|
record: ExecApprovalRecord;
|
||||||
resolve: (decision: ExecApprovalDecision) => void;
|
resolve: (decision: ExecApprovalDecision | null) => void;
|
||||||
reject: (err: Error) => void;
|
reject: (err: Error) => void;
|
||||||
timer: ReturnType<typeof setTimeout>;
|
timer: ReturnType<typeof setTimeout>;
|
||||||
};
|
};
|
||||||
@@ -45,11 +45,11 @@ export class ExecApprovalManager {
|
|||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForDecision(record: ExecApprovalRecord, timeoutMs: number): Promise<ExecApprovalDecision> {
|
async waitForDecision(record: ExecApprovalRecord, timeoutMs: number): Promise<ExecApprovalDecision | null> {
|
||||||
return await new Promise<ExecApprovalDecision>((resolve, reject) => {
|
return await new Promise<ExecApprovalDecision | null>((resolve, reject) => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
this.pending.delete(record.id);
|
this.pending.delete(record.id);
|
||||||
resolve("deny");
|
resolve(null);
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
this.pending.set(record.id, { record, resolve, reject, timer });
|
this.pending.set(record.id, { record, resolve, reject, timer });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user