Repository navigation
Commit 0f09a11
fix(acli): give run_command a real timeout and kill the whole tree (#201)
* sync(acli): give run_command a real timeout and kill the whole tree
The 30s default killed ordinary test and build commands, and nothing told
the model the limit existed -- so it burned turns rediscovering it by
experiment (`sleep 25` fits, `sleep 150` does not). Raise the default to
600s, allow ACLI_COMMAND_TIMEOUT to move it, advertise the `timeout`
argument in the tool description, and name it in the timeout message.
On expiry only the direct child died. proc.kill() reaches the shell, not the
pipeline it started, so the work kept running with its stdout pipe open and
asyncio later logged "Exception ignored in BaseSubprocessTransport.__del__
... Event loop is closed". Start every child in its own process group
(start_new_session / CREATE_NEW_PROCESS_GROUP), kill the group, then reap it.
Ctrl-C takes the same path.
/info printed config.timeout as "Timeout", but that field is the LLM request
timeout (providers/profile.py), so the one place a user could look reported a
limit nothing enforced. Split it into two labelled lines.
* test(acli): pin the command timeout and the process-group kill in the vendored tree
Orphan coverage is marker-based rather than pid-based: a SIGKILLed child
nobody reaps is a zombie, and os.kill(pid, 0) still succeeds on a zombie, so
the pid alone says nothing about whether the tree died.
Each fix was falsified by reverting it and confirming exactly the intended
tests fail. Two results worth recording: reverting 600 -> 30 fails only
test_default_covers_a_real_test_run, because the other timeout assertions are
self-referential to DEFAULT_TIMEOUT; and dropping the `proc is None` guard in
_kill_tree fails nothing, since the AttributeError from None.wait() is
swallowed by the broad except. The guard stays so the intent does not depend
on an exception being swallowed, but it is not claimed as covered.
---------
Co-authored-by: zhansheng.lzs <zhansheng.lzs@alibaba-inc.com>1 parent e7ea471 commit 0f09a11
4 files changed
Lines changed: 415 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
19 | 43 | | |
20 | 44 | | |
21 | 45 | | |
| |||
519 | 543 | | |
520 | 544 | | |
521 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
522 | 635 | | |
523 | 636 | | |
524 | 637 | | |
525 | 638 | | |
526 | | - | |
| 639 | + | |
| 640 | + | |
527 | 641 | | |
528 | 642 | | |
529 | 643 | | |
| |||
555 | 669 | | |
556 | 670 | | |
557 | 671 | | |
558 | | - | |
559 | | - | |
560 | | - | |
| 672 | + | |
561 | 673 | | |
562 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
563 | 677 | | |
| 678 | + | |
564 | 679 | | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
| 680 | + | |
598 | 681 | | |
599 | 682 | | |
600 | 683 | | |
601 | 684 | | |
602 | 685 | | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
608 | 697 | | |
| 698 | + | |
609 | 699 | | |
610 | 700 | | |
611 | 701 | | |
| |||
0 commit comments