fix: wrap compaction start notice onBlockReply in try/catch to prevent unhandled rejection
onAgentEvent is fired fire-and-forget (void ctx.params.onAgentEvent?.(...) in pi-embedded-subscribe.handlers.compaction.ts), so any rejection from the awaited onBlockReply call would escape unobserved. Wrap the delivery in a try/catch that swallows the error and logs a warning via params.logger, consistent with other non-critical notice delivery paths.
This commit is contained in:
parent
643eb31ea4
commit
e7fd0a7b21
@ -430,7 +430,15 @@ export async function runAgentTurnWithFallback(params: {
|
||||
replyToCurrent: true,
|
||||
isCompactionNotice: true,
|
||||
});
|
||||
await params.opts.onBlockReply(noticePayload);
|
||||
try {
|
||||
await params.opts.onBlockReply(noticePayload);
|
||||
} catch (err) {
|
||||
// Non-critical notice delivery failure should not
|
||||
// bubble out of the fire-and-forget event handler.
|
||||
logVerbose(
|
||||
`compaction start notice delivery failed (non-fatal): ${String(err)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
const completed = evt.data?.completed === true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user