@@ -58,18 +58,19 @@ Placeholder Conversation Created Immediately With Always Persist
5858 # Get baseline conversation count for THIS client_id only
5959 ${convs_before } = Get Conversations By Client ID ${client_id }
6060 ${count_before } = Get Length ${convs_before }
61+ ${expected_count } = Evaluate ${count_before } + 1
6162
6263 # Start stream with always_persist=true
6364 ${stream_id } = Open Audio Stream With Always Persist device_name=${device_name }
6465
65- # Conversation created by audio persistence job (takes 3-5s to start)
66- Sleep 5s # Wait for audio persistence job to create placeholder
67- ${ convs_after } = Get Conversations By Client ID ${client_id }
66+ # Poll for conversation to be created by audio persistence job (may take 10-15s to start)
67+ ${ convs_after } = Wait Until Keyword Succeeds 30s 2s
68+ ... Wait For Conversation By Client ID ${client_id } ${ expected_count }
6869 ${count_after } = Get Length ${convs_after }
6970
7071 # Verify new conversation created for this client
71- Should Be True ${count_after } == ${count_before } + 1
72- ... Expected 1 new conversation for client ${client_id } , found ${count_after } - ${ count_before }
72+ Should Be True ${count_after } >= ${expected_count }
73+ ... Expected at least ${ expected_count } conversation(s) for client ${client_id } , found ${count_after }
7374
7475 # Find the new conversation (most recent)
7576 ${new_conv } = Set Variable ${convs_after } [0 ]
@@ -141,21 +142,22 @@ Redis Key Set Immediately With Always Persist
141142 # Get baseline conversation count for THIS client_id only
142143 ${convs_before } = Get Conversations By Client ID ${client_id }
143144 ${count_before } = Get Length ${convs_before }
145+ ${expected_count } = Evaluate ${count_before } + 1
144146
145147 # Start stream with always_persist=true
146148 ${stream_id } = Open Audio Stream With Always Persist device_name=${device_name }
147149
148150 # session_id == client_id for streaming mode (not stream_id!)
149151 ${session_id } = Set Variable ${client_id }
150152
151- # Get conversation ( created by audio persistence job)
152- Sleep 5s # Wait for audio persistence job to create placeholder
153- ${ convs_after } = Get Conversations By Client ID ${client_id }
153+ # Poll for conversation to be created by audio persistence job
154+ ${ convs_after } = Wait Until Keyword Succeeds 30s 2s
155+ ... Wait For Conversation By Client ID ${client_id } ${ expected_count }
154156 ${count_after } = Get Length ${convs_after }
155157
156158 # Verify new conversation created for this client
157- Should Be True ${count_after } == ${count_before } + 1
158- ... Expected 1 new conversation for client ${client_id } , found ${count_after } - ${ count_before }
159+ Should Be True ${count_after } >= ${expected_count }
160+ ... Expected at least ${ expected_count } conversation(s) for client ${client_id } , found ${count_after }
159161
160162 # Get the new conversation (most recent)
161163 ${conversation } = Set Variable ${convs_after } [0 ]
@@ -192,33 +194,36 @@ Multiple Sessions Create Separate Conversations
192194 ${count_before_1 } = Get Length ${convs_before_1 }
193195 ${count_before_2 } = Get Length ${convs_before_2 }
194196 ${count_before_3 } = Get Length ${convs_before_3 }
197+ ${expected_count_1 } = Evaluate ${count_before_1 } + 1
198+ ${expected_count_2 } = Evaluate ${count_before_2 } + 1
199+ ${expected_count_3 } = Evaluate ${count_before_3 } + 1
195200
196201 # Start 3 separate sessions
197202 ${stream_1 } = Open Audio Stream With Always Persist device_name=${device_name } -1
198203 Sleep 1s
199204 ${stream_2 } = Open Audio Stream With Always Persist device_name=${device_name } -2
200205 Sleep 1s
201206 ${stream_3 } = Open Audio Stream With Always Persist device_name=${device_name } -3
202- Sleep 5s # Wait for all audio persistence jobs to create placeholders
203207
204- # Verify each client has exactly 1 new conversation
205- ${convs_after_1 } = Get Conversations By Client ID ${client_id_1 }
206- ${convs_after_2 } = Get Conversations By Client ID ${client_id_2 }
207- ${convs_after_3 } = Get Conversations By Client ID ${client_id_3 }
208+ # Poll for each conversation to be created (audio persistence jobs may take 10-15s)
209+ ${convs_after_1 } = Wait Until Keyword Succeeds 30s 2s
210+ ... Wait For Conversation By Client ID ${client_id_1 } ${expected_count_1 }
211+ ${convs_after_2 } = Wait Until Keyword Succeeds 30s 2s
212+ ... Wait For Conversation By Client ID ${client_id_2 } ${expected_count_2 }
213+ ${convs_after_3 } = Wait Until Keyword Succeeds 30s 2s
214+ ... Wait For Conversation By Client ID ${client_id_3 } ${expected_count_3 }
215+
208216 ${count_after_1 } = Get Length ${convs_after_1 }
209217 ${count_after_2 } = Get Length ${convs_after_2 }
210218 ${count_after_3 } = Get Length ${convs_after_3 }
211219
212- ${new_count_1 } = Evaluate ${count_after_1 } - ${count_before_1 }
213- ${new_count_2 } = Evaluate ${count_after_2 } - ${count_before_2 }
214- ${new_count_3 } = Evaluate ${count_after_3 } - ${count_before_3 }
215-
216- Should Be Equal As Integers ${new_count_1 } 1
217- ... Expected 1 new conversation for client ${client_id_1 } , found ${new_count_1 }
218- Should Be Equal As Integers ${new_count_2 } 1
219- ... Expected 1 new conversation for client ${client_id_2 } , found ${new_count_2 }
220- Should Be Equal As Integers ${new_count_3 } 1
221- ... Expected 1 new conversation for client ${client_id_3 } , found ${new_count_3 }
220+ # Verify each client has at least 1 new conversation
221+ Should Be True ${count_after_1 } >= ${expected_count_1 }
222+ ... Expected at least ${expected_count_1 } conversation(s) for client ${client_id_1 } , found ${count_after_1 }
223+ Should Be True ${count_after_2 } >= ${expected_count_2 }
224+ ... Expected at least ${expected_count_2 } conversation(s) for client ${client_id_2 } , found ${count_after_2 }
225+ Should Be True ${count_after_3 } >= ${expected_count_3 }
226+ ... Expected at least ${expected_count_3 } conversation(s) for client ${client_id_3 } , found ${count_after_3 }
222227
223228 # Verify each conversation has unique conversation_id
224229 ${conv_id_1 } = Set Variable ${convs_after_1 } [0 ][conversation_id]
@@ -255,8 +260,9 @@ Audio Chunks Persisted Despite Transcription Failure
255260 # Start stream with always_persist=true
256261 ${stream_id } = Open Audio Stream With Always Persist device_name=${device_name }
257262
258- # Wait for audio persistence job to start consuming from Redis Stream
259- Sleep 2s
263+ # Poll for conversation to be created by audio persistence job
264+ ${conversations } = Wait Until Keyword Succeeds 30s 2s
265+ ... Wait For Conversation By Client ID ${client_id } 1
260266
261267 # Send audio chunks (transcription will fail due to invalid API key in config)
262268 # Use realtime pacing to ensure chunks arrive while persistence job is running
@@ -266,8 +272,7 @@ Audio Chunks Persisted Despite Transcription Failure
266272 ${total_chunks } = Close Audio Stream ${stream_id }
267273 Log Sent ${total_chunks } total chunks
268274
269- # Get the conversation for this client - already created by audio persistence job
270- ${conversations } = Get Conversations By Client ID ${client_id }
275+ # Get the conversation for this client
271276 ${conversation } = Set Variable ${conversations } [0 ]
272277 ${conversation_id } = Set Variable ${conversation } [conversation_id]
273278
@@ -307,13 +312,14 @@ Conversation Updates To Completed When Transcription Succeeds
307312 # Get baseline conversation count for THIS client_id only
308313 ${convs_before } = Get Conversations By Client ID ${client_id }
309314 ${count_before } = Get Length ${convs_before }
315+ ${expected_count } = Evaluate ${count_before } + 1
310316
311317 # Start stream with always_persist=true
312318 ${stream_id } = Open Audio Stream With Always Persist device_name=${device_name }
313319
314- # Verify placeholder conversation exists ( created by audio persistence job)
315- Sleep 5s
316- ${ convs_after } = Get Conversations By Client ID ${client_id }
320+ # Poll for placeholder conversation to be created by audio persistence job
321+ ${ convs_after } = Wait Until Keyword Succeeds 30s 2s
322+ ... Wait For Conversation By Client ID ${client_id } ${ expected_count }
317323 ${conversation } = Set Variable ${convs_after } [0 ]
318324 ${conversation_id } = Set Variable ${conversation } [conversation_id]
319325
0 commit comments