feat(#1151): default bash_run wait_seconds to 3s

This commit is contained in:
damocles 2026-06-03 16:09:09 +02:00 committed by mara
commit 6be114eb05

View file

@ -503,18 +503,20 @@ pub struct BashRunArgs {
/// `timed_out` when the limit is exceeded.
#[serde(default)]
pub timeout_secs: Option<u64>,
/// Optional inline wait: if set, `bash_run` polls for up to
/// `wait_seconds` (capped at 30) before returning. When the task
/// finishes within the window the full status is returned immediately
/// — no separate `bash_status` call needed. When the timeout expires
/// before the command finishes, the task keeps running in the
/// background and the usual `task started: id=<id>` response is
/// returned. Useful for fast commands (< 5 s) that would otherwise
/// force an unnecessary round-trip.
#[serde(default)]
/// Optional inline wait: `bash_run` polls for up to `wait_seconds`
/// (capped at 30) before returning. When the task finishes within the
/// window the full status is returned immediately and no wake is fired;
/// when the timeout expires the task keeps running and the normal
/// `task started: id=<id>` response is returned. Defaults to 3s. Pass
/// `0` to disable and always get the immediate response.
#[serde(default = "default_bash_run_wait")]
pub wait_seconds: Option<u64>,
}
fn default_bash_run_wait() -> Option<u64> {
Some(3)
}
/// MCP tool args for `bash_status`.
#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]
pub struct BashStatusArgs {
@ -961,11 +963,12 @@ impl AgentServer {
do NOT wait inline. When the command finishes, the harness fires a wake with \
`from: \"bash-task-<id>\"` and the exit code + last stdout lines in the body; \
handle it on a future turn. Use `bash_status` to poll the task status within \
the same turn if needed. `timeout_secs` defaults to 180. \
Pass `wait_seconds` (capped at 30) to wait inline for fast commands: when the \
task finishes within the window the full status is returned immediately and no \
wake is fired; when the timeout expires the task keeps running and the normal \
`task started: id=<id>` response is returned."
the same turn if needed. `timeout_secs` defaults to 180. Pass `wait_seconds` \
(capped at 30) to wait inline for fast commands: when the task finishes within \
the window the full status is returned immediately and no wake is fired; when \
the timeout expires the task keeps running and the normal `task started: id=<id>` \
response is returned. `wait_seconds` defaults to 3; pass `wait_seconds: 0` to \
disable inline waiting and always get the immediate response."
)]
async fn bash_run(&self, Parameters(args): Parameters<BashRunArgs>) -> String {
let log = format!("{args:?}");