fix: return AgentBus attachment rejections
This commit is contained in:
@@ -1019,6 +1019,30 @@ export class AgentBusListener {
|
||||
attached: result.attached,
|
||||
created: result.created
|
||||
}, 'AgentBus message ingested into task service');
|
||||
const rejectedAttachment = result.input_attachment?.status === 'rejected'
|
||||
? result.input_attachment
|
||||
: null;
|
||||
if (rejectedAttachment) {
|
||||
this.logger.warn({
|
||||
agentbus_event: 'attachment_rejection_reply_requested',
|
||||
inbound_frame_id: taskId,
|
||||
task_id: result.task.task_id,
|
||||
task_status: result.task.status,
|
||||
error_code: rejectedAttachment.error_code || 'roster_workbook_processing_failed'
|
||||
}, 'AgentBus roster attachment rejection reply requested');
|
||||
if (this.durableDeliveryEnabled() && this.channel && this.tasks.enqueueAgentBusResult) {
|
||||
await this.tasks.enqueueAgentBusResult.call(this.tasks, this.channel.id, taskId, {
|
||||
event: 'task.result',
|
||||
status: 'failed',
|
||||
task_id: result.task.task_id,
|
||||
text: rejectedAttachment.message.slice(0, 20_000)
|
||||
});
|
||||
await this.flushDurableDeliveries();
|
||||
} else {
|
||||
this.queueFinalReply(frame, 'failed', rejectedAttachment.message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.logger.info({
|
||||
agentbus_event: 'parse_queue_requested',
|
||||
inbound_frame_id: taskId,
|
||||
|
||||
Reference in New Issue
Block a user