← Back to PRs

#3864: fix(agents): suppress exec/bash exit code errors from user display

by HirokiKobayashi-R open 2026-01-29 08:10 View on GitHub →
agents
## Summary - Exec/bash exit code errors are now suppressed from user display - These errors are treated as internal/recoverable errors that the model should handle ## Problem When using Telegram, exec tool errors like this were being sent to users: ``` ⚠️ 🛠️ Exec: clawdbot status | grep -A5 "Runtime\|verbose\|elevated\|Think" failed: Command exited with code 1 ``` Non-zero exit codes from commands like `grep` (no matches = exit 1) are normal workflow results, not failures that users need to see. ## Solution Added `exec`/`bash` exit code errors to the `isRecoverableError` check in `buildEmbeddedRunPayloads()`. Now these errors: - Stay in the model's context for internal handling - Are not surfaced to users - Allow the model to retry or continue appropriately ## Test plan - [x] Updated existing test expectations - [x] Added new tests for exec and bash exit code suppression - [x] All 14 payloads tests pass - [x] Lint/type check pass Fixes #3765 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates `buildEmbeddedRunPayloads()` to classify `exec`/`bash` “exited with code …” tool errors as recoverable, preventing those tool failures from being included in user-visible payloads. Tests were updated and expanded to cover suppression for `exec` and `bash` exit code error cases, aligning behavior with Telegram’s UX needs where non-zero exit codes (e.g., `grep` no matches) are normal. The change fits into the existing payload-building logic that already suppresses certain internal/retryable tool errors (validation/missing params) so the model can handle retries without surfacing noisy tool failures to end users. <h3>Confidence Score: 3/5</h3> - Mostly safe to merge, but current suppression may hide genuinely actionable exec/bash failures. - The code change is small and covered by tests, but it broadens suppression to any exec/bash error containing “exited with code”, which can include real failures (e.g., bash 127) and may lead to users receiving no message when there’s no assistant output. - src/agents/pi-embedded-runner/run/payloads.ts (recoverable error classification logic) <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs