Commit 034590c
feat: Add run_to_completion feature for synchronous script execution (#472)
* feat: Add run_to_completion feature for synchronous script execution
- Introduced a new configuration option `run_to_completion` in YAML tools, allowing scripts to wait indefinitely for completion and return final results.
- Updated the `YamlToolBase` class to handle synchronous execution when `run_to_completion` is enabled, including error handling and post-processing.
- Added a new example tool demonstrating the `run_to_completion` feature with various platform-specific scripts.
- Implemented integration tests to validate the functionality of the `run_to_completion` feature across different scenarios, including success, failure, and output limits.
This enhancement significantly improves the flexibility of script execution, allowing for more controlled and predictable outcomes in tool operations.
* fix: Fix run_to_completion integration tests to properly capture script output
The tests were failing because shell command redirection wasn't capturing
output from compound commands using &&. Fixed by:
1. Using shell command grouping {{ }} (becomes { } after Python formatting)
to ensure all commands in the group have their output redirected
2. Escaping braces in bash loops to prevent Python format string conflicts
3. Using appropriate command separators for each platform:
- Linux/Darwin: && for conditional execution within groups
- Windows: ; for command separation within groups
All 5 integration tests now pass, including the 3 that were originally failing.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: Replace bash brace expansion with seq command for better CI compatibility
The test_run_to_completion_with_output_limits was failing in CI because
bash brace expansion {1..20} was not working in the CI environment.
Replaced with more portable seq command:
- Linux/Darwin: seq 1 20 | while read i; do echo "Line $i of output"; done
- Windows: for /l %i in (1,1,20) do echo Line %i of output
This ensures the test generates multiple lines of output for testing
the output truncation functionality across different environments.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent bc02317 commit 034590c
File tree
4 files changed
+893
-12
lines changed- mcp_tools
- tests
4 files changed
+893
-12
lines changed
0 commit comments