dsh-fs-search-timeout
English | 简体中文
DeepSeek Harness plugin that puts a user-set time budget on glob and grep. A search that runs
over the budget is cancelled on the spot, and the model receives an error that says how to narrow the
next call — instead of waiting out the built-in 30-second limit and getting a bare
tool call timed out after 30000ms.
It exists for one familiar failure: the agent starts a recursive search from a multi-repository root,
walks node_modules / dist / vendor, and burns a full tool budget every single time.
What the model sees
At the deadline the tool result is replaced with:
Error: grep exceeded its 8000ms budget and was cancelled before it finished.
This call — path: ~/code/monorepo; pattern: foo; include: *.ts
Retrying it unchanged will time out again. Narrow the call first:
- set `path` to ONE project or one subdirectory — not a workspace root that holds several repositories
- add `include` (for example "*.go" or "*.{ts,vue}") and tighten `pattern`
- resolve symbols and call chains from a code index instead of scanning text
error.info is { name: 'SearchTimeoutError', code: 'SEARCH_TIMEOUT' }, so another plugin can branch
on the code.
Configuration
Every field may be omitted; the schema fills the defaults below.
- id: fs-search-timeout
name: 'dsh-fs-search-timeout'
config:
enabled: true # time searches at all
timeoutMs: 8000 # shared budget in ms
perToolTimeoutMs: {} # per-tool budget map, e.g. { glob: 3000 }; 0 or absent follows timeoutMs
tools: [glob, grep] # which tools are watched
notice: '' # reminder for the model; empty uses the built-in one
Keep the budget below @deepseek-ai/dsh-tool-fs-search's own timeoutMs (default 30000),
otherwise the built-in timeout-policy fires first and its generic message wins.
From the UI
The bundle ships a configuration page. Open Plugins, select dsh-fs-search-timeout, then
Configure on its fs-search-timeout row: glob and grep are checkboxes, another tool is added
by name and shown as a removable tag. The budget section lists one switch per watched tool — switch a
tool on to give it its own budget, leave it off to inherit the shared one. Saving writes through the
Host settings service and applies to the next tool call — no reload, no restart.
Values typed into cordis.patch.yml are the base layer; a value saved from the page is stored as the
profile override of that row and takes precedence.
How it works
One tools/execute wrapper swaps exec.signal for a derived signal carrying a deadline, then
restores the caller's signal in a finally, so tools/post-execute listeners never see this
plugin's signal.
- Deadline reached → the derived signal aborts;
glob/grephand that signal to the subprocess seam, the ripgrep process tree is killed, the call settles, and the result above replaces the tool's own cancellation. - The caller cancels (turn stopped, parent call) → the derived signal aborts too, but the result is left alone rather than being reported as a search budget timeout.
Install
In DSH, open Plugins → Add plugin and enter one of:
| What you have | What to enter |
|---|---|
| the npm package | dsh-fs-search-timeout |
| the GitHub repository | https://github.com/Steven-Qiang/dsh-fs-search-timeout |
| a local checkout | the absolute path of that directory |
An agent holding the plugin manager tool performs the same install:
plugin_manager action: install_bundle target: dsh-fs-search-timeout
Requires DSH's glob / grep tools (@deepseek-ai/dsh-tool-fs-search) and the tools/execute
event; without either one the plugin has nothing to wrap.
Reload after editing code or configuration, no restart needed:
plugin_manager action: set_plugin target: include:fs-search-timeout enabled: false
plugin_manager action: set_plugin target: include:fs-search-timeout enabled: true
Uninstall: plugin_manager action: remove_bundle target: dsh-fs-search-timeout.
Known gaps
- Cooperative cancellation: it notifies through
exec.signal, so the tool must honour it.glob/grepdo; any other tool added totoolsneeds that checked first. - Watched tools only:
globandgrepby default. A hand-rolledrginside shell is out of scope — that is what a shell guard such asdsh-pwsh-guardis for. - The built-in 30-second limit still exists: it belongs to
tool-fs-search's owntimeoutMs; this plugin only fires earlier. - No generic configuration form: current DSH ships the settings-form machinery but no shipped
client renders
autoGeneratepages, so this bundle registers its own page inplugins.row.config. A deployment without the settings service (@deepseek-ai/dsh-settings) shows the page unavailable.
Development
npm test
Builds with tsdown, then runs 10 assertions: cancellation at the deadline, pass-through inside the
budget, unlisted tools untouched, caller cancellation not misreported, a tool's own throw preserved, a
disabled row passing calls through, config normalization (defaults, per-tool budgets, volatile refs,
invalid values), a custom notice, and the result shape.
Contributing
Commits follow Conventional Commits, and the release workflow
derives the package version from them, so version in package.json is not bumped by hand. Issues
and pull requests are welcome.
License
MIT
还没有评论,来写第一条。