Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(scheduler): allow todo_write in unattended tool allowlist

hairyf96c8db0f2d06
diff --git a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.test.ts b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.test.ts
index a566d5f0..52a6549b 100644
--- a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.test.ts
+++ b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
-import { loadSchedulerRuntimeModules } from './executor.js'
+import { loadSchedulerRuntimeModules, unattendedToolGuardReason } from './executor.js'
describe('loadSchedulerRuntimeModules', () => {
it('resolves DSH-owned modules through the platform loader', async () => {
@@ -45,3 +45,24 @@ describe('loadSchedulerRuntimeModules', () => {
expect(loader.unwrapExports).not.toHaveBeenCalled()
})
})
+
+describe('unattendedToolGuardReason', () => {
+ it('allows todo_write so task lists work in unattended runs', () => {
+ expect(unattendedToolGuardReason('todo_write', {
+ todos: [{ content: 'step', status: 'pending' }],
+ })).toBeUndefined()
+ })
+
+ it('still rejects tools outside the allowlist', () => {
+ expect(unattendedToolGuardReason('ask_user_question', {}))
+ .toBe('工具 \'ask_user_question\' 不在无人值守自动化允许列表中。')
+ })
+
+ it('rejects background processes for bash/pwsh but allows foreground calls', () => {
+ expect(unattendedToolGuardReason('bash', { command: 'ls', run_in_background: true }))
+ .toBe('无人值守运行不允许启动后台进程。')
+ expect(unattendedToolGuardReason('pwsh', { command: 'ls', run_in_background: true }))
+ .toBe('无人值守运行不允许启动后台进程。')
+ expect(unattendedToolGuardReason('bash', { command: 'ls' })).toBeUndefined()
+ })
+})
diff --git a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
index f6a0bbc4..04034839 100644
--- a/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
+++ b/packages/dsh-tauri-panel-scheduler/src/host/service/executor.ts
@@ -84,6 +84,10 @@ const UNATTENDED_TOOL_ALLOWLIST = new Set([
'session_event_read',
'session_event_search',
'session_event_trace',
+ // todo_write 只写会话内任务清单(session log 投影,要求 owning agent session),
+ // 无文件系统/进程等宿主副作用;任务指令常要求用任务清单推进多步工作,不放行
+ // 会让无人值守运行直接失败,因此偏离 MichengAI 对齐的白名单单独放行。
+ 'todo_write',
])
const CANCEL_CONVERGENCE_TIMEOUT_MS = 10_000