fix: preserve source event IDs across all feedback

This commit is contained in:
2026-10-10 15:02:30 +08:00
parent b41dc76ac4
commit c2ee8a5a4b
26 changed files with 553 additions and 54 deletions
@@ -333,11 +333,15 @@ func TestDispatcherCommandStartsWithIsolatedMQHTTPAndAgent(t *testing.T) {
cancel()
t.Fatal(err)
}
sourceID := "numberID-command-0000123/Case"
commandBody = []byte(strings.ReplaceAll(string(commandBody), `"call-example"`, fmt.Sprintf("%q", sourceID)))
if err := admin.PublishWithContext(process, taskRoute.Exchange, taskRoute.BindingKey, true, false, amqp.Publishing{ContentType: "application/json", DeliveryMode: amqp.Persistent, Body: commandBody}); err != nil {
cancel()
t.Fatal(err)
}
resultDeadline := time.After(12 * time.Second)
sawExecuteReceipt := false
sawFinalResult := false
for {
message, ok, err := admin.Get(result.Queue, false)
if err != nil {
@@ -346,6 +350,7 @@ func TestDispatcherCommandStartsWithIsolatedMQHTTPAndAgent(t *testing.T) {
}
if ok {
var event struct {
EventID string `json:"event_id"`
EventType string `json:"event_type"`
Payload struct {
Outcome string `json:"outcome"`
@@ -362,6 +367,13 @@ func TestDispatcherCommandStartsWithIsolatedMQHTTPAndAgent(t *testing.T) {
cancel()
t.Fatalf("isolated result is invalid JSON: %v", err)
}
if event.EventID != sourceID || message.MessageId != sourceID {
cancel()
t.Fatalf("isolated Agent/Dispatcher feedback changed source event identity: type=%q id=%q message_id=%q", event.EventType, event.EventID, message.MessageId)
}
if event.EventType == "call.execute" {
sawExecuteReceipt = true
}
if err := message.Ack(false); err != nil {
cancel()
t.Fatalf("isolated result cannot be ACKed: %v", err)
@@ -375,6 +387,9 @@ func TestDispatcherCommandStartsWithIsolatedMQHTTPAndAgent(t *testing.T) {
cancel()
t.Fatalf("isolated result WAV metadata does not match the single Mock PUT: size=%d format=%q", event.Payload.Recording.SizeBytes, event.Payload.Recording.Format)
}
sawFinalResult = true
}
if sawExecuteReceipt && sawFinalResult {
break
}
}