Repository navigation
feat: propagate audio metadata and idempotency - #13
murilloimparavel wants to merge 1 commit into
Conversation
Reviewer's GuideThe PR threads CRM message IDs through debounce persistence, restart recovery, and A2A JSON-RPC calls, deriving deterministic fallback keys for legacy state and limiting retries to explicit active-claim conflicts. It also persists and deduplicates audio response notices so they survive debounce/recovery and are appended to the final dispatch without altering AI input, with Redis storage cleanup and targeted validation/tests. Sequence diagram for idempotent debounced A2A processingsequenceDiagram
participant CRM as CRM
participant Pipeline as PipelineService
participant Redis as RedisPipelineRepository
participant Debounce as DebounceEngine
participant Adapter as aiAdapter
participant Processor as AIProcessor
CRM->>Pipeline: Process(MessageEvent)
Pipeline->>Debounce: Start or Reset(content, messageID)
Debounce->>Redis: AppendMessageID(messageID)
Pipeline->>Redis: GetMessageIDs()
Redis-->>Pipeline: Sorted message IDs
Pipeline->>Pipeline: stableMessageID(messageIDs)
Pipeline->>Adapter: Call(A2ARequest.MessageID)
Adapter->>Processor: JSON-RPC messageId
Processor-->>Adapter: 200 response
Adapter-->>Pipeline: NormalResponse
Sequence diagram for selective in-progress retrysequenceDiagram
participant Adapter as aiAdapter
participant Processor as AIProcessor
Adapter->>Processor: A2A JSON-RPC request with messageId
Processor-->>Adapter: 409 Request already in progress
Adapter->>Adapter: doOnce()
Adapter->>Processor: Retry same idempotent request
Processor-->>Adapter: 200 response
Adapter->>Processor: A2A JSON-RPC request
Processor-->>Adapter: 409 payload conflict or expired claim
Adapter-->>Adapter: Return non-retryable error
Flow diagram for debounce recovery and response noticesflowchart TD
Event[MessageEvent with messageID and responseNotice] --> Start[Start or Reset debounce]
Start --> Persist[Persist message ID and response notice]
Persist --> Recover{Restart recovery?}
Recover -->|yes| Load[Load state and message IDs]
Recover -->|no| Aggregate[Aggregate debounce buffers]
Load --> Aggregate
Aggregate --> Stable[Derive stable message ID]
Stable --> AI[Call AI processor]
AI --> Notice[appendResponseNotice to AI response]
Notice --> Dispatch[Dispatch final response]
Dispatch --> Clear[Clear state and message ID buffer]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. The change alters retry decisions for the AI Processor and carries stable IDs through persisted Redis debounce state. If the conflict classification or generated idempotency key is wrong, reverting will not undo a duplicate processor request or any external side effects it already caused; the stored debounce data itself is bounded and clearable.
|
Closing: this change is intended for the author's personal fork, not the evolution-foundation upstream. No merge performed. |
Summary\n- Carry stable CRM message IDs through debounce/recovery into A2A calls.\n- Retry only the processor's explicit in-progress conflict; do not repeat payload conflicts or expired claims.\n- Carry deterministic audio response notices through the pipeline and preserve pre-existing debounce recovery.\n\n## Validation\n- Targeted Go tests for AI adapter, debounce, and pipeline passed.\n\nDepends on evolution-foundation/evo-ai-processor-community#78. Merge after that PR so runtime retries can safely rely on processor idempotency.
Summary by Sourcery
Propagate deterministic message identity and audio notices through the pipeline while making idempotency retries safe and preserving recovery behavior.
New Features:
Bug Fixes:
Enhancements:
Tests: