fix(exec-approval): guard register() against duplicate IDs

This commit is contained in:
rshirali
2026-02-03 18:34:39 +01:00
parent 03e5fddb81
commit 4e1f0eec06

View File

@@ -56,6 +56,10 @@ export class ExecApprovalManager {
* confirm registration before the decision is made.
*/
register(record: ExecApprovalRecord, timeoutMs: number): Promise<ExecApprovalDecision | null> {
const existing = this.pending.get(record.id);
if (existing) {
return existing.promise;
}
let resolvePromise: (decision: ExecApprovalDecision | null) => void;
let rejectPromise: (err: Error) => void;
const promise = new Promise<ExecApprovalDecision | null>((resolve, reject) => {