Commit 3700190
authored
🤖 feat: add polling detection to bash_output tool (#1098)
When agents call `bash_output` 3+ times on a running process without
using `filter_exclude`, return a note instructing them to use
`filter_exclude` with a longer timeout instead of polling repeatedly.
## Changes
- Track `getOutputCallCount` per background process
- Return a `note` field with guidance when polling detected (3+ calls,
no filter_exclude, process still running)
- Simplified tool description (runtime now handles the guidance
dynamically)
## Example note returned
```
STOP POLLING. You've called bash_output 3+ times on this process. This wastes tokens and clutters the conversation. Instead, make ONE call with: filter='⏳|progress|waiting|\.\.\.', filter_exclude=true, timeout_secs=120. This blocks until meaningful output arrives.
```
## Tests
Added 3 tests covering:
1. Note appears after 3+ calls without filter_exclude on running process
2. Note does NOT appear when filter_exclude is used
3. Note does NOT appear when process has exited
_Generated with `mux`_1 parent 457297c commit 3700190
File tree
3 files changed
+97
-3
lines changed- src
- common/utils/tools
- node/services
3 files changed
+97
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
| 247 | + | |
249 | 248 | | |
250 | 249 | | |
251 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
873 | 949 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
327 | 330 | | |
328 | 331 | | |
329 | 332 | | |
| 333 | + | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
| |||
458 | 462 | | |
459 | 463 | | |
460 | 464 | | |
| 465 | + | |
461 | 466 | | |
462 | 467 | | |
463 | 468 | | |
| |||
481 | 486 | | |
482 | 487 | | |
483 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
484 | 493 | | |
485 | | - | |
| 494 | + | |
486 | 495 | | |
487 | 496 | | |
488 | 497 | | |
| |||
564 | 573 | | |
565 | 574 | | |
566 | 575 | | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
567 | 580 | | |
568 | 581 | | |
569 | 582 | | |
| |||
573 | 586 | | |
574 | 587 | | |
575 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
576 | 595 | | |
577 | 596 | | |
578 | 597 | | |
| |||
0 commit comments