fix(handlers): include execution session metadata and skip idempotency key when absent

- Refactored `requestExecutionMetadata` to handle empty `Idempotency-Key` gracefully.
- Added test to validate metadata inclusion of execution session without idempotency key.
This commit is contained in:
Luis Pater
2026-04-16 21:44:32 +08:00
parent 1267fddf61
commit 7b03f04670
2 changed files with 24 additions and 4 deletions
+4 -4
View File
@@ -194,11 +194,11 @@ func requestExecutionMetadata(ctx context.Context) map[string]any {
key = strings.TrimSpace(ginCtx.GetHeader("Idempotency-Key"))
}
}
if key == "" {
return make(map[string]any)
}
meta := map[string]any{idempotencyKeyMetadataKey: key}
meta := make(map[string]any)
if key != "" {
meta[idempotencyKeyMetadataKey] = key
}
if pinnedAuthID := pinnedAuthIDFromContext(ctx); pinnedAuthID != "" {
meta[coreexecutor.PinnedAuthMetadataKey] = pinnedAuthID
}