Commit ac0252e
fix: use greenlet.error type instead of string check; recreate per thread
- Add GreenletError import with ImportError fallback (same pattern as PlaywrightError)
- Replace brittle 'cannot switch to' substring check with dedicated
except GreenletError block placed before the generic except Exception,
so the correct exception type is matched regardless of message wording
- Keep existing sandbox on greenlet error (failure is client-side thread
affinity, not a sandbox crash); only reset Playwright and retry
- _get_playwright already checks current_thread is not creator_thread
(any different thread triggers recreation, not just dead threads)
- Update concurrent caching test: each thread now gets its own connection
(Playwright Sync API is thread-affine, cross-thread sharing is unsafe)
- Replace test_get_playwright_live_thread_not_recreated with
test_get_playwright_different_live_thread_recreates_connection to
validate the correct per-thread isolation behavior
- Update greenlet error tests to use real greenlet.error, verify sandbox
is preserved, and check retry behavior
Type check: passed (297 source files, no issues)
Co-authored-by: OhYee <13498329+OhYee@users.noreply.github.com>1 parent 915e97a commit ac0252e
File tree
2 files changed
+80
-43
lines changed- agentrun/integration/builtin
- tests/unittests/integration
2 files changed
+80
-43
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
836 | 846 | | |
837 | 847 | | |
838 | 848 | | |
839 | | - | |
840 | | - | |
841 | | - | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
842 | 860 | | |
843 | | - | |
844 | | - | |
| 861 | + | |
| 862 | + | |
845 | 863 | | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
861 | 868 | | |
862 | 869 | | |
863 | 870 | | |
| |||
Lines changed: 54 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
| 257 | + | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | | - | |
263 | | - | |
| 262 | + | |
| 263 | + | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | 266 | | |
270 | 267 | | |
271 | 268 | | |
272 | 269 | | |
273 | 270 | | |
274 | 271 | | |
275 | | - | |
276 | 272 | | |
277 | 273 | | |
278 | 274 | | |
279 | 275 | | |
280 | 276 | | |
281 | 277 | | |
282 | 278 | | |
| 279 | + | |
283 | 280 | | |
284 | | - | |
285 | | - | |
286 | 281 | | |
287 | 282 | | |
288 | 283 | | |
| |||
392 | 387 | | |
393 | 388 | | |
394 | 389 | | |
395 | | - | |
| 390 | + | |
396 | 391 | | |
397 | 392 | | |
398 | | - | |
| 393 | + | |
399 | 394 | | |
400 | | - | |
401 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
402 | 398 | | |
403 | 399 | | |
404 | 400 | | |
405 | 401 | | |
406 | 402 | | |
407 | 403 | | |
408 | 404 | | |
409 | | - | |
| 405 | + | |
410 | 406 | | |
411 | 407 | | |
412 | 408 | | |
| |||
416 | 412 | | |
417 | 413 | | |
418 | 414 | | |
419 | | - | |
420 | | - | |
| 415 | + | |
| 416 | + | |
421 | 417 | | |
422 | 418 | | |
423 | 419 | | |
| |||
452 | 448 | | |
453 | 449 | | |
454 | 450 | | |
455 | | - | |
| 451 | + | |
456 | 452 | | |
457 | 453 | | |
458 | | - | |
| 454 | + | |
459 | 455 | | |
460 | | - | |
461 | | - | |
| 456 | + | |
| 457 | + | |
462 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
463 | 465 | | |
464 | 466 | | |
465 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
466 | 496 | | |
467 | 497 | | |
468 | 498 | | |
469 | 499 | | |
470 | 500 | | |
471 | 501 | | |
472 | 502 | | |
473 | | - | |
474 | 503 | | |
475 | | - | |
| 504 | + | |
| 505 | + | |
476 | 506 | | |
477 | 507 | | |
478 | 508 | | |
| |||
0 commit comments