Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Let agent turns run past the generic request deadline

Fei241145632a194a57
diff --git a/ds-bot/src/host/local-agents/acp.js b/ds-bot/src/host/local-agents/acp.js
index 10957d50..f33ba805 100644
--- a/ds-bot/src/host/local-agents/acp.js
+++ b/ds-bot/src/host/local-agents/acp.js
@@ -151,7 +151,7 @@ export class AcpEngine {
async prompt(session, blocks, { signal }) {
const peer = await this.ensure()
- const reply = peer.request('session/prompt', { sessionId: session.acpSessionId, prompt: blocks }, { signal, timeout: undefined })
+ const reply = peer.request('session/prompt', { sessionId: session.acpSessionId, prompt: blocks }, { signal, timeout: 0 })
reply.then(
result => session.push({ type: 'done', reason: result?.stopReason ?? 'end_turn' }),
error => session.push({ type: 'error', error }),
diff --git a/ds-bot/src/host/local-agents/codex.js b/ds-bot/src/host/local-agents/codex.js
index bd0b4a6e..4141f735 100644
--- a/ds-bot/src/host/local-agents/codex.js
+++ b/ds-bot/src/host/local-agents/codex.js
@@ -135,7 +135,7 @@ export class CodexEngine {
const reply = await peer.request('turn/start', {
threadId: thread.threadId,
input: blocks.map(block => block.type === 'image' ? { type: 'image', url: block.url ?? block.data } : { type: 'text', text: block.text ?? '' }),
- }, { signal, timeout: 60_000 })
+ }, { signal, timeout: 0 })
thread.turnId = reply?.turn?.id ?? reply?.id
return thread.turnId
}
diff --git a/ds-bot/src/host/local-agents/jsonrpc.js b/ds-bot/src/host/local-agents/jsonrpc.js
index d50d0a47..d0bff625 100644
--- a/ds-bot/src/host/local-agents/jsonrpc.js
+++ b/ds-bot/src/host/local-agents/jsonrpc.js
@@ -58,7 +58,7 @@ export class JsonRpcPeer {
}
const onAbort = () => call.reject(signal.reason ?? new Error('aborted'))
this.pending.set(id, call)
- if (timeout !== undefined) timer = setTimeout(() => { if (this.pending.delete(id)) call.reject(new Error(`${method} timed out`)) }, timeout)
+ if (timeout > 0) timer = setTimeout(() => { if (this.pending.delete(id)) call.reject(new Error(`${method} timed out`)) }, timeout)
if (signal !== undefined) signal.addEventListener('abort', onAbort, { once: true })
try {
this.write({ jsonrpc: '2.0', id, method, ...(params === undefined ? {} : { params }) })
diff --git a/ds-bot/test/local-agents-loop.test.js b/ds-bot/test/local-agents-loop.test.js
index 71e669d4..ee892252 100644
--- a/ds-bot/test/local-agents-loop.test.js
+++ b/ds-bot/test/local-agents-loop.test.js
@@ -79,12 +79,12 @@ test('a bridged team tool round-trips through real DSH dispatch', async (t) => {
description: 'Message another Bot',
parameters: { type: 'object', properties: { bot: { type: 'string' }, text: { type: 'string' } } },
output,
- async execute(args) { calls.push(args); return `delivered to ${args.bot}` },
+ async execute(args) { calls.push(args); return `delivered to ${args.to ?? args.bot}` },
})
send(agent, 'call-tool please')
await waitForIdle(ctx, agent)
assert.equal(calls.length, 1)
- assert.match(texts(agent), /tool said: delivered to Kai/)
+ assert.match(texts(agent), /tool said: delivered to Chief/)
const types = eventTypes(agent)
assert.ok(types.includes('tool/call') && types.includes('tool/result'))
})
diff --git a/ds-bot/test/local-agents.test.js b/ds-bot/test/local-agents.test.js
index 0bb2d69c..7376382a 100644
--- a/ds-bot/test/local-agents.test.js
+++ b/ds-bot/test/local-agents.test.js
@@ -6,6 +6,7 @@ import { test } from 'node:test'
import { LocalAgentAdapter } from '../src/host/local-agents/adapter.js'
import { AcpEngine } from '../src/host/local-agents/acp.js'
import { CodexEngine } from '../src/host/local-agents/codex.js'
+import { JsonRpcPeer } from '../src/host/local-agents/jsonrpc.js'
import { ClaudeEngine } from '../src/host/local-agents/claude.js'
import { LoopbackMcp, flattenSchema } from '../src/host/local-agents/mcp.js'
import { cleanEnv } from '../src/host/local-agents/discover.js'
@@ -355,3 +356,14 @@ test('a fresh part carries the deterministic handoff', async () => {
const text = [...followed, ...delivered].map(message => message?.content?.map?.(block => block.text).join('') ?? message?.text ?? String(message)).join('\n')
assert.match(text, /fresh conversation was started|previous part|read_own_chat/i)
})
+
+test('an open-ended request outlives the default deadline', async () => {
+ const peer = new JsonRpcPeer(() => {})
+ const open = peer.request('session/prompt', {}, { timeout: 0 })
+ const deadline = peer.request('session/load', {}, { timeout: 40 })
+ const settled = deadline.then(() => 'ok', () => 'timeout')
+ await new Promise(resolve => setTimeout(resolve, 90))
+ assert.equal(await settled, 'timeout', 'a positive timeout still fires')
+ peer.handleLine(JSON.stringify({ jsonrpc: '2.0', id: 1, result: { stopReason: 'end_turn' } }))
+ assert.deepEqual(await open, { stopReason: 'end_turn' }, 'a 0 timeout never expires')
+})