fix(exec-approvals): harden forwarding target and resolve delivery paths

Co-authored-by: bubmiller <bubmiller@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-22 20:32:22 +01:00
parent 6f895eb831
commit 51b0772e14
5 changed files with 183 additions and 44 deletions

View File

@@ -186,6 +186,7 @@ export function createExecApprovalHandlers(
respond(false, undefined, errorShape(ErrorCodes.INVALID_REQUEST, "invalid decision"));
return;
}
const snapshot = manager.getSnapshot(p.id);
const resolvedBy = client?.connect?.client?.displayName ?? client?.connect?.client?.id;
const ok = manager.resolve(p.id, decision, resolvedBy ?? null);
if (!ok) {
@@ -194,11 +195,17 @@ export function createExecApprovalHandlers(
}
context.broadcast(
"exec.approval.resolved",
{ id: p.id, decision, resolvedBy, ts: Date.now() },
{ id: p.id, decision, resolvedBy, ts: Date.now(), request: snapshot?.request },
{ dropIfSlow: true },
);
void opts?.forwarder
?.handleResolved({ id: p.id, decision, resolvedBy, ts: Date.now() })
?.handleResolved({
id: p.id,
decision,
resolvedBy,
ts: Date.now(),
request: snapshot?.request,
})
.catch((err) => {
context.logGateway?.error?.(`exec approvals: forward resolve failed: ${String(err)}`);
});