ISSUE DESCRIPTION GLOBTIMEOUT does not bound wall-clock time — tool blocks until the…
- User
ISSUE DESCRIPTION
GLOB_TIMEOUTdoes not bound wall-clock time — tool blocks until the runaway glob finishesSubmission checklist
- This is a bug, not a usage question.
- I added a clear and descriptive title.
- I searched existing issues and didn't find this.
- I can reproduce this with the latest released version.
- I included a minimal reproducible example and steps to reproduce.
Area (Required)
- deepagents (SDK)
- cli
- code
- talon
- acp
- evals
- harbor
- daytona
- modal
- quickjs
- runloop
- langsmith-sandbox
- Other / not sure / general
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
python - Assistant
I’ll inspect the middleware implementation and its tests, then reproduce the blocking behavior with a temporary script. I’ll fix the synchronous executor lifecycle so timeout returns without waiting, while considering thread cleanup, repeated calls, and compatibility with existing behavior. I’ll then run focused and broader relevant tests, review the diff, and submit only after verification.
- Assistant
The repository layout differs from the path in the issue description, so the initial file read failed before inspecting code. I’ll locate the package and test files first, then continue with the same reproduction-and-fix plan.
- Assistant
The SDK is under
libs/deepagents. The implementation and focused synchronous test are present; I’ll inspect the exact executor code and test conventions before choosing the least invasive lifecycle fix. - Assistant
The bug is exactly the
with ThreadPoolExecutorscope: timeout raises/returns, but context-manager exit performs a blockingshutdown(wait=True). I’ll replace per-call construction with a shared executor and callfuture.resultdirectly. A shared executor avoids joining on each call and also addresses the reported dispatch overhead; timed-out work remains un-cancellable in the background, which is the unavoidable limitation of threads. I’ll inspect project style for module-level executors and then patch. - Assistant
There are no existing executor abstractions. I’ll add a module-level, lazily-started-by-Python
ThreadPoolExecutorwith multiple workers so one runaway glob does not serialize all later glob calls. The timeout path will return immediately without executor shutdown; completed futures are still collected normally, and timed-out worker exceptions are not surfaced because the caller has already received the timeout response. - Assistant
The patch removes the blocking context manager and uses the shared executor. I’ll now run a direct timing reproduction, then the focused synchronous and asynchronous middleware tests. The direct script will also verify that a second glob can be dispatched while the first timed-out worker is still sleeping.
- Assistant
The source change is in place, but the repository’s local dependency environment is not available at the assumed path and the system interpreter lacks
langchain, so the first verification command could not import the package. I’ll locate the configured environment/package manager and use the repository’s actual test command; if dependencies are absent, I’ll still run static checks and a dependency-independent executor timing check. - Assistant
The project venv is only a skeleton and offline dependency resolution cannot install the missing packages, so the full pytest suite is unavailable in this environment. I’ll make one small robustness improvement: call
future.cancel()on timeout, which cancels queued work when possible while leaving already-running filesystem work alone. Then I’ll run syntax compilation, a standalone timing check of the exact executor pattern, and inspect the final diff/status. - Assistant
The prior command’s shell remained in
libs/deepagentsafter the earliercd, so the attempted edit used an incorrect doubled path and did not apply; the standalone timing check did pass at 0.30s. I’ll now apply the cancellation comment using the current directory, rerun compilation and checks from the correct root, and ensure no unintended files changed. - Assistant
The final source now compiles, has no whitespace errors, and only the intended middleware file is modified. The implementation preserves the existing timeout message and result handling, cancels queued futures where possible, and returns promptly for running futures because it no longer invokes
shutdown(wait=True)on the timeout path. Full pytest execution remains blocked solely by unavailable offline dependencies (langchain/pytest); the standalone timing check confirmed prompt return. I’ll perform the final diff/status review and submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.