Commit e67d2e4
authored
Fix workflow stuck in refining/evaluation loops (#120)
* fix: prevent evaluation loop from causing stuck workflows
- Make evaluation informational-only when run_assessment=False
- Add 15s LLM call timeout via request_timeout on ChatLiteLLM
- Default evaluation parsing to ACCEPT when ambiguous
- Derive max_total_iterations from max_validation_attempts + 1
- Add per-node timing to all workflow nodes
- Switch eval model default to openai/gpt-oss-120b on groq
- Lower recursion_limit from 100 to 50
- Update default max_validation_attempts from 5 to 3
Closes #119
* fix: address review findings and ty type checking
- Move re import to module level in evaluation_agent.py
- Add missing "Entering assess node" log for consistency
- Centralize max_total_iterations derivation in state.py and workflow.py
(was duplicated 3x in main.py, now defaults to max_validation_attempts + 1)
- Update create_initial_state defaults (was stale at 5/10)
- Fix ty warnings: remove unused type: ignore comments
- Fix ty errors: add type: ignore for LangGraph/Starlette typing limitations
- Fix return type on get_default_path (-> str | None)
- Update test_state to match new default
* Add error handling for LLM timeouts and rate limits
- Add try/except with logging to evaluation, assessment, and feedback agents
- Map timeouts to HTTP 504, rate limits to HTTP 429 in API endpoints
- Add error_type field to streaming SSE error events
- Sanitize error messages to avoid leaking internal details
- Add debug log for silent ACCEPT fallback in evaluation parsing1 parent f97815b commit e67d2e4
File tree
10 files changed
+201
-103
lines changed- src
- agents
- api
- utils
- tests
10 files changed
+201
-103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
| 72 | + | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
| |||
142 | 141 | | |
143 | 142 | | |
144 | 143 | | |
145 | | - | |
146 | | - | |
| 144 | + | |
| 145 | + | |
147 | 146 | | |
148 | 147 | | |
149 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
107 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
166 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
| |||
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
189 | | - | |
190 | | - | |
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
| |||
201 | 207 | | |
202 | 208 | | |
203 | 209 | | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
210 | 214 | | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
| 225 | + | |
224 | 226 | | |
| 227 | + | |
225 | 228 | | |
226 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
227 | 232 | | |
228 | 233 | | |
229 | 234 | | |
| |||
236 | 241 | | |
237 | 242 | | |
238 | 243 | | |
| 244 | + | |
239 | 245 | | |
| 246 | + | |
240 | 247 | | |
241 | | - | |
| 248 | + | |
242 | 249 | | |
243 | 250 | | |
244 | 251 | | |
| |||
254 | 261 | | |
255 | 262 | | |
256 | 263 | | |
| 264 | + | |
257 | 265 | | |
258 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
259 | 270 | | |
260 | 271 | | |
261 | 272 | | |
| |||
281 | 292 | | |
282 | 293 | | |
283 | 294 | | |
284 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
285 | 301 | | |
286 | 302 | | |
287 | 303 | | |
| |||
293 | 309 | | |
294 | 310 | | |
295 | 311 | | |
| 312 | + | |
296 | 313 | | |
| 314 | + | |
297 | 315 | | |
298 | | - | |
| 316 | + | |
299 | 317 | | |
300 | 318 | | |
301 | 319 | | |
| |||
327 | 345 | | |
328 | 346 | | |
329 | 347 | | |
330 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
331 | 354 | | |
332 | 355 | | |
333 | 356 | | |
334 | 357 | | |
335 | 358 | | |
336 | 359 | | |
337 | 360 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | 361 | | |
342 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
343 | 374 | | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
| 375 | + | |
| 376 | + | |
353 | 377 | | |
354 | 378 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 379 | + | |
| 380 | + | |
376 | 381 | | |
377 | 382 | | |
378 | 383 | | |
| |||
383 | 388 | | |
384 | 389 | | |
385 | 390 | | |
386 | | - | |
387 | | - | |
| 391 | + | |
| 392 | + | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
| |||
395 | 400 | | |
396 | 401 | | |
397 | 402 | | |
398 | | - | |
| 403 | + | |
399 | 404 | | |
400 | 405 | | |
401 | 406 | | |
| |||
405 | 410 | | |
406 | 411 | | |
407 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
408 | 416 | | |
409 | 417 | | |
410 | 418 | | |
| |||
418 | 426 | | |
419 | 427 | | |
420 | 428 | | |
421 | | - | |
| 429 | + | |
0 commit comments