Repository navigation
fix(tool): honor timeouts in ScriptedTool - #1944
Merged
chaliy merged 1 commit intoJun 5, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a contract gap in ScriptedTool: it now honors ToolRequest::timeout_ms by enforcing a per-call timeout that aborts the entire orchestration (including tool callbacks and streaming). It also centralizes timeout response formatting so ScriptedTool and BashTool return consistent timeout results (exit code 124, error = "timeout"), and adds regression tests to prevent regressions.
Changes:
- Enforce
timeout_msinScriptedTool::run_request_with_streamviatokio::time::timeout. - Make the shared
timeout_responsehelper available crate-wide for consistent timeout responses. - Add async regression tests proving
execute/execute_with_statusrespecttimeout_ms.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/bashkit/src/tool.rs | Exposes timeout_response as pub(crate) so other crate modules can reuse the standardized timeout ToolResponse. |
| crates/bashkit/src/scripted_tool/execute.rs | Wraps ScriptedTool execution in a per-call timeout and adds tests verifying timeouts abort slow async callbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | de06e7d | Commit Preview URL | Jun 05 2026, 08:01 PM |
chaliy
deleted the
2026-06-05-propose-fix-for-scriptedtool-timeout_ms-issue
branch
June 5, 2026 20:30
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.
Motivation
ToolRequest::timeout_msis part of the public tool contract and must abort per-call orchestrations;ScriptedToolpreviously ignored it, allowing long-running callbacks/commands to bypass orchestrator limits.Description
timeout_msinScriptedTool::run_request_with_streamby wrapping the execution future intokio::time::timeoutso the whole orchestration (including streaming and callbacks) is aborted on expiry.timeout_responseavailable crate-wide so timeouts return exit code124anderror = "timeout"consistently withBashTool.crates/bashkit/src/scripted_tool/execute.rsthat verifyexecuteandexecute_with_statushonortimeout_msusing a slow async callback.Testing
cargo fmt --checkwhich succeeded.scripted_toolfeature:cargo test -p bashkit --features scripted_tool test_scripted_tool_execute -- --nocapture, and the added timeout tests passed (2 passed, 0 failed).git diff --check(no whitespace/errors reported).Codex Task