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)
import time from unittest.mock import patch from deepagents.backends import StateBackend from deepagents.middleware import filesystem as fs_mw from deepagents.middleware.filesystem import FilesystemMiddleware class FakeRuntime: tool_call_id = "demo" state = {"files": {}} store = None context = None stream_writer = None config = {} backend = StateBackend() real_glob = backend.glob middleware = FilesystemMiddleware(backend=backend) glob_tool = next(t for t in middleware.tools if t.name == "glob") def slow_glob(*args, **kwargs): time.sleep(3) # a glob that takes 3s (stand-in for a huge tree / slow mount) return real_glob("*.none") with ( patch.object(fs_mw, "GLOB_TIMEOUT", 0.5), # 20s in production; shortened for the repro patch.object(backend, "glob", side_effect=slow_glob), ): start = time.monotonic() msg = glob_tool.invoke({"pattern": "**/*", "runtime": FakeRuntime()}) print(f"returned after {time.monotonic() - start:.2f}s: {msg.content!r}") # Expected: returns after ~0.5s (the timeout) # Actual: returns after ~3.0s -- the full duration of the "timed out" glob Assistant
Now let's look at where GLOB_TIMEOUT is defined to add the shared executor near there.
Assistant
Now update
sync_globto use_GLOB_EXECUTORwithout the blockingwithblock.Assistant
Looks identical. Let me try using
editwith the line range instead.Assistant
Good, edit applied correctly. Now let's verify the syntax with python compile.
Assistant
Now let's write the reproduction script from the issue and run it.
Assistant
The fix works — the tool now returns after ~0.5s instead of 3s. Let's run the existing test suite for filesystem middleware to ensure nothing broke.
Assistant
These failures are unrelated (require Anthropic API key). Let's check unit tests instead, which don't need API access.
Assistant
All glob-related unit tests pass. Let's run the full unit test suite for filesystem middleware to be thorough.
Assistant
All 914 unit tests pass. Let's also double check the
contextvarsimport is still used correctly and view final diff.Assistant
These pass, confirming normal (fast) glob calls still work correctly with the shared executor. Let's also run the timeout-specific tests explicitly.
Assistant
Both timeout tests pass. Let's check that test file for context.
Assistant
This confirms the bug existed before (test took 2.00s) and is now fixed (0.50s). Let's run the complete unit test suite once more to be safe, then clean up temp files.
Assistant
All 1748 unit tests pass. Let's clean up the temp scripts.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.