You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The wasm build previously avoided timer panics by compiling out timeout enforcement, which silently accepted timeoutMs/timeout N and allowed unresolved async callbacks to suspend execution indefinitely. This is an availability/control bypass for callers who rely on timeouts.
The change closes the gap by treating unenforceable wall-clock timeouts on single-threaded JS-host wasm as unsupported, failing fast instead of awaiting a future that cannot be preempted.
Description
Add a wasm-specific unsupported_timeout_response() and use it from BashTool execution paths so streaming, direct, and execute_with_status calls return an explicit unsupported-timeout ToolResponse (exit code 125) when timeoutMs is supplied on wasm targets.
Update ScriptedTool to return unsupported_timeout_response() on wasm when a per-call timeout is requested instead of ignoring the deadline and awaiting orchestration futures.
Change the timeout builtin in the interpreter to fail closed on wasm by returning an ExecResult with an explanatory message and exit code 125 without dispatching the inner command when the builtin is given a wall-clock timeout on wasm targets.
Update tests and docs: modify the wasm smoke test to assert the unsupported-timeout behaviour; update crates/bashkit-wasm/README.md, specs/browser-package.md, and specs/limitations.md to document the fail-closed contract.
Testing
Ran cargo check -p bashkit --target wasm32-unknown-unknown --features scripted_tool,jq and cargo test -p bashkit test_tool_execute_timeout, and the unit test test_tool_execute_timeout passed.
Ran cargo clippy (native and wasm-target slices with -- -D warnings) and cargo fmt --check; linters and format checks passed after the changes.
Attempted wasm packaging smoke build; cargo build succeeded but wasm-bindgen CLI was not present in the environment so full wasm-bindgen packaging was not executed in this run (adjust local build environment to run bash crates/bashkit-wasm/scripts/build.sh end-to-end).
One fix applied on top of the original change: the wasm smoke test asserts stderr matches /timeout is unsupported/, but the interpreter builtin emitted "bashkit: timeout (5.000s) is unsupported…" — the duration sat between "timeout" and "is", so the regex would never match and the wasm-web CI job would fail (the original task couldn't run the wasm smoke test, so this went uncaught). Reworded the builtin message to lead with "timeout is unsupported on this wasm target (requested <d>s)", keeping it consistent with unsupported_timeout_response(). Also resolved the rebase against the specs/ → knowledge/ move. Full CI is green (41/41), including the wasm-web headless smoke test.
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
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
timeoutMs/timeout Nand allowed unresolved async callbacks to suspend execution indefinitely. This is an availability/control bypass for callers who rely on timeouts.Description
unsupported_timeout_response()and use it fromBashToolexecution paths so streaming, direct, andexecute_with_statuscalls return an explicit unsupported-timeoutToolResponse(exit code125) whentimeoutMsis supplied on wasm targets.ScriptedToolto returnunsupported_timeout_response()on wasm when a per-call timeout is requested instead of ignoring the deadline and awaiting orchestration futures.timeoutbuiltin in the interpreter to fail closed on wasm by returning anExecResultwith an explanatory message and exit code125without dispatching the inner command when the builtin is given a wall-clock timeout on wasm targets.crates/bashkit-wasm/README.md,specs/browser-package.md, andspecs/limitations.mdto document the fail-closed contract.Testing
cargo check -p bashkit --target wasm32-unknown-unknown --features scripted_tool,jqandcargo test -p bashkit test_tool_execute_timeout, and the unit testtest_tool_execute_timeoutpassed.cargo clippy(native and wasm-target slices with-- -D warnings) andcargo fmt --check; linters and format checks passed after the changes.cargo buildsucceeded butwasm-bindgenCLI was not present in the environment so fullwasm-bindgenpackaging was not executed in this run (adjust local build environment to runbash crates/bashkit-wasm/scripts/build.shend-to-end).Codex Task