fix: add OS-aware guidance to execute_bash tool for correct cross-platform commands #3591
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.
Summary
This PR fixes an issue where the LLM generates Linux/bash commands when running on Windows instances. The root cause was that while the OS information was being sent to the LLM, the
execute_bashtool description didn't instruct the LLM to check or use this information.Changes
1. Enhanced
execute_bashTool Description (tool_index.json)operating_systemfield before generating commands/mnt/c/2. Enhanced OS Information in
build_env_state()(message.rs)os_version()function fromsystem_infomodule"windows","linux","macos""Windows 11 (or newer) - build 22631","Linux 5.15.0 - Ubuntu 22.04 LTS","macOS 14.5.0 (23F79)""(WSL - Windows Subsystem for Linux)"suffixTesting
cargo build -p chat_cli- Successcargo test -p chat_cli message- All 7 tests passImpact
The LLM will now: