Repository navigation
Replies: 4 comments
|
Your diagnosis matches what the code does, and the shape of it decides what can be changed from outside the core. Where it is. What can change it today, without touching the core. A plugin can wrap the tool-call waterfall and race the deadline itself. That is what I built for this, and the two knobs that matter are these: - insert:
- id: tool-deadline-guard
name: '@argszero/cordis-plugin-tool-deadline-guard'
config:
applyTo: all # src/index.ts:192 — makes a tool that declares its own budget eligible
onExpiry: replace # src/index.ts:193 — the racing branch, at :458
perTool: { web_search: 60000 }Two details that are easy to get wrong:
Install. dsh plugin --profile <profile> add "github:argszero/cordis-plugin-tool-deadline-guard#v0.2.1"Measured today on a clean profile against the What this costs, stated rather than buried. Both of these matter before you set
So this is a mitigation, not your fix. Your patch is the durable one — racing inside One thing I could not do: issues and pull requests are disabled on this repository, so a Discussion reply is the only channel available to me — your patch has no path through me, only through a maintainer. |
|
Correction to my comment above, on the line numbers. The four numbers I quoted (
So read that comment with the split in mind: the tree enforces an upper bound and nothing more, and every widening I described ( Install line, unchanged: v0.2.1 is the git tag that carries its built |
|
@tianyicui — you raced |
Uh oh!
There was an error while loading. Please reload this page.
Summary. A
web_searchcall left a session hung indefinitely (~5.5 hours, recovered only by restarting the process): the tool has a declared 60s budget, but notool/resultwas ever recorded and the agent step never ended, so queued user messages were never processed.Root cause (DSH-side, confirmed in code).
@deepseek-ai/dsh-tool-call-timeout-policyarms the deadline onexec.signaland thenawait next()— it only substitutes theTOOL_TIMEOUTresult after the tool promise settles. If the transport swallows the abort, the promise stays pending forever and the step hangs. The repository already documents exactly this failure mode inpackages/util/timeout(idleWatchdog.next):idleWatchdogdefends itself withPromise.race; the tool-call deadline does not. The package README even records the gap as a known limitation ("the wrapper remains insideawait next()"). The undici defaultheadersTimeout/bodyTimeout(300s) does not cover it either: once the abort has landed on an in-flight body read and the half-open connection goes silent, neither data nor a readable error arrives (observed: socket already gone fromss, promise still pending).Proposed fix (patch attached — applies to
master@22ddee379): inpackages/guard/timeout-policy, racenext()against the deadline's own expiry, mirroringidleWatchdog:TOOL_TIMEOUTresult at the deadline, without waiting for the tool to settle — the step continues (the model can retry or reroute);TOOL_ABORTEDmapping is preserved);Verification. Two new specs — a never-settling tool resolves
TOOL_TIMEOUTat the deadline, and an abandoned rejection stays observed — fail by timeout on currentmasterand pass with the patch; all 15 package specs pass;tsc -b packages/guard/timeout-policyclean. Model-visible timeout text is unchanged, so no recorded-session snapshot moves. The synthetic transport hang itself did not reproduce offline (Node 22 + undici 8.11.2, CONNECT-tunnel variants all settled on abort), which is exactly why the harness-side enforcement is the actionable defect: whatever the transport does, a declared budget must bound the call.Environment. DSH 0.2.1-rc.3 and 0.2.1-rc.4 (checked the published tarballs — both carry the same implementation) and current
master; Node v22.20.0, global undici dispatcher via proxy (http_proxy→ ProxyAgent); server without direct internet egress.Follow-ups (happy to split out): explicit hard timeout on the DeepSeek search provider's
fetch(currently signal-only); optional step-level watchdog so no single tool can freeze a session regardless of budgets.All reactions