docs(agents): note that git commands require --no-pager to avoid terminal hang

git may invoke less as a pager which blocks the terminal waiting for
user interaction.  Always use 'git --no-pager <command>' or pipe
through Out-String/Format-List in PowerShell sessions.
This commit is contained in:
Brandon Zhang
2026-03-27 14:00:12 +08:00
parent 298ad54b5c
commit fa9d5c61c9

View File

@@ -1,3 +1,4 @@
## Notes on calling tools
* About `run_in_terminal` or some other similar tools that can make calls to external programs, be very careful about what programs/commands you call - some are blocking indefinitely by nature, like running servers, long-running monitors, etc. If you would like to execute such commands, make sure to run them in a non-blocking way, for example run/spawn them in another temp terminal session. Otherwise, your agent will be hung on the waiting indefinitely.
* About `AskUser`, `get_user_request` or other similar tools that can retrieve latest user input, if available, make sure to call them **AGGRESSIVELY** once you finished all tasks at hand, so as to AVOID ending the current task/work/session prematurely. NEVER end the current task/work/session on your own, the user will keep adding new instructions into this kind of tools in the background. You can be missing out CRITICAL instructions from user when you failed to call them aggressively. Also, sometimes these tools can fail to return any results due to technical issues. Just try to call again when that happens.
* About `AskUser`, `get_user_request` or other similar tools that can retrieve latest user input, if available, make sure to call them **AGGRESSIVELY** once you finished all tasks at hand, so as to AVOID ending the current task/work/session prematurely. NEVER end the current task/work/session on your own, the user will keep adding new instructions into this kind of tools in the background. You can be missing out CRITICAL instructions from user when you failed to call them aggressively. Also, sometimes these tools can fail to return any results due to technical issues. Just try to call again when that happens.
* About `git` commands: **always use `git --no-pager`** (or pipe output through `| Out-String`) when running git commands in the terminal. Without this, git may invoke `less` as a pager, causing the terminal to hang waiting for user interaction. Example: `git --no-pager log --oneline -10`, `git --no-pager diff`, `git --no-pager status`. Similarly for any other command that may invoke a pager (e.g. `man`, `less`).