opencode
opencode copied to clipboard
feat(grep): add timeout support with 60s default to prevent hangs when with very big directories
Grep tool hangs indefinitely when searching large directories like node_modules because there's no timeout.
I've been using a custom made tool called 'SafeGrep' in my personal plugin (oh-my-opencode) that has hard-limit timeout thing, but figured this would be more useful in core.
Followed Bash tool's implementation and style:
- Add 60s default timeout (max 10min)
- Add abort signal handling
I assumed there would be related issues, but couldn't find any. This was quite annoying in my environment so I thought it was worth fixing—but if this is just my setup or if this PR is heading in the wrong direction, I'd appreciate any feedback!