← Back to PRs

#3872: improve bash-tools.exec.ts code quality

by Bestom927 open 2026-01-29 08:31 View on GitHub →
agents
- Better error messages and type safety - Extract magic numbers to constants - Stricter input validation <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR refines the `exec` tool implementation in `src/agents/bash-tools.exec.ts` by extracting a few “magic numbers” into named constants (PTY default cols/rows and the timeout finalize window), tightening the `command` input validation to reject blank/whitespace-only commands, and slightly improving PTY-related error messaging. These changes are localized to the exec tool/process execution path and don’t affect other agents/tools. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - The diff is small and localized, and the changes are straightforward refactors (constants) plus stricter validation (`command?.trim()`) and an error-message tweak; no behavior changes beyond rejecting whitespace-only commands and using named constants for existing values. - src/agents/bash-tools.exec.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs