fix: avoid bash commands that may not be installed - #196
Open
ruanzhengxin-zhuxing wants to merge 1 commit into
Open
fix: avoid bash commands that may not be installed#196ruanzhengxin-zhuxing wants to merge 1 commit into
ruanzhengxin-zhuxing wants to merge 1 commit into
Conversation
Agent runs picked `file` to inspect template readability and hit exit 127 `/bin/sh: 1: file: not found`. The bash tool guidance only covered using dedicated tools over cat/sed/grep, with no rule about missing commands. Tell the model to inspect file existence/readability with ReadFile or basic commands (`ls -l`, `stat`, `head`), and to switch away from a command that exits 127 instead of retrying it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Session
85d5c325f9fd442cbad185dc63e16578中 bash 工具调用使用了运行环境未安装的file命令检查模板文件,返回 exit 127/bin/sh: 1: file: not found,属工具选择错误。根因
_build_tools_section的 bash 使用指引只说明「用专用工具替代 cat/sed/grep」,没有约定「命令可能未安装」这类失败,模型排查文件可读性时选了不保证存在的file。改动
src/iac_code/agent/system_prompt.py:ls -l、stat、head等基础命令,不依赖可能未安装的file。not found时改用基础命令或专用工具,不重试同一条命令。tests/agent/test_system_prompt.py:新增TestBuildToolsSection覆盖上述两条约定。验证
tests/agent、tests/tools/test_bash.py、tests/tools/bash、tests/pipeline/engine/test_step_executor.py:796 passed。ruff check src/iac_code/agent/system_prompt.py tests/agent/test_system_prompt.py:通过。tests/test_i18n.py的 12 个失败在改动前后完全一致,属仓库既有问题,与本次改动无关。Harness work item:
641cc8f2-df97-4427-819a-ea58414271f3