From 564997cfaef503cfaaec9f0545903f58bc5ccd48 Mon Sep 17 00:00:00 2001 From: viettranx Date: Sat, 18 Apr 2026 14:52:18 +0700 Subject: [PATCH] fix(consolidation): pass parsed agentUUID to ExistsBySourceID (#809, #824) Line 52 parses agent_id into agentUUID but line 59 passed the raw event.AgentID string to ExistsBySourceID. PR #826 fixed the emission side (loop_finalize.go) so event.AgentID is now always a valid UUID, but the consumption side kept the inconsistent parse-then-discard pattern. Use agentUUID.String() to keep the parse-once-use-parsed invariant, matching the tenantUUID pattern two lines above. Fixes the "invalid input syntax for type uuid" error reported in #809 and the downstream "..." Telegram symptom in #824 where episodic failure cascaded into empty agent replies. --- internal/consolidation/episodic_worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/consolidation/episodic_worker.go b/internal/consolidation/episodic_worker.go index a2f5c184..8a5f8cf5 100644 --- a/internal/consolidation/episodic_worker.go +++ b/internal/consolidation/episodic_worker.go @@ -56,7 +56,7 @@ func (w *episodicWorker) Handle(ctx context.Context, event eventbus.DomainEvent) // Build source_id for idempotency sourceID := fmt.Sprintf("%s:%d", payload.SessionKey, payload.CompactionCount) - exists, err := w.store.ExistsBySourceID(ctx, event.AgentID, event.UserID, sourceID) + exists, err := w.store.ExistsBySourceID(ctx, agentUUID.String(), event.UserID, sourceID) if err != nil { return fmt.Errorf("episodic: check source_id: %w", err) }