fix(todo): address todo_write review feedback

This commit is contained in:
Tianyi Cui
2026-06-29 19:44:38 +08:00
parent 55088d1cfc
commit 9f1caf7c5b
8 changed files with 36 additions and 29 deletions

View File

@@ -16,7 +16,9 @@
- id: llm-replay
name: '@deepseek-ai/dsh-llm-replay'
# Local bash executor (the agent's only tool, via agent-core's tool-bash schema).
# Local bash executor for agent-core's tool-bash schema.
# FIXME(config-comments): keep this executor note from implying bash is the
# whole tool set; subagent and todo_write are loaded below.
- id: bash
name: '@deepseek-ai/dsh-bash-local'
config:
@@ -43,9 +45,10 @@
final result) — give it a complete, standalone instruction.
For multi-step work, use the todo_write tool to track a task list:
send the WHOLE list each call (it replaces the previous one), keep
exactly one task in_progress, and mark a task completed as soon as it
is done. Skip it for trivial single-step tasks.
send the WHOLE list each call (it replaces the previous one), keep at
most one task in_progress (exactly one while work remains), and mark a
task completed as soon as it is done. Skip it for trivial single-step
tasks.
# The subagent seam + both in-process backends + two model-facing tools —
# identical to cordis.yml's wiring (only the LLM backend differs above): spawn

View File

@@ -23,7 +23,9 @@
- deepseek-v4-flash
- deepseek-v4-pro
# Local bash executor (the agent's only tool, via agent-core's tool-bash schema).
# Local bash executor for agent-core's tool-bash schema.
# FIXME(config-comments): keep this executor note from implying bash is the
# whole tool set; subagent and todo_write are loaded below.
- id: bash
name: '@deepseek-ai/dsh-bash-local'
config:
@@ -52,9 +54,10 @@
final result) — give it a complete, standalone instruction.
For multi-step work, use the todo_write tool to track a task list:
send the WHOLE list each call (it replaces the previous one), keep
exactly one task in_progress, and mark a task completed as soon as it
is done. Skip it for trivial single-step tasks.
send the WHOLE list each call (it replaces the previous one), keep at
most one task in_progress (exactly one while work remains), and mark a
task completed as soon as it is done. Skip it for trivial single-step
tasks.
# The subagent seam + both in-process backends + two model-facing tools, as leaf
# entries after the app (which provides ctx.agents/ctx.tools). spawn (a fresh

View File

@@ -28,7 +28,9 @@
- deepseek-v4-flash
- deepseek-v4-pro
# Local bash executor (the model's only tool, via agent-core's tool-bash schema).
# Local bash executor for agent-core's tool-bash schema.
# FIXME(config-comments): keep this executor note from implying bash is the
# whole tool set; subagent and todo_write are loaded below.
- id: bash
name: '@deepseek-ai/dsh-bash-local'
config:
@@ -66,9 +68,10 @@
tests. Keep answers brief and factual.
For multi-step work, use the todo_write tool to track a task list:
send the WHOLE list each call (it replaces the previous one), keep
exactly one task in_progress, and mark a task completed as soon as it
is done. Skip it for trivial single-step tasks.
send the WHOLE list each call (it replaces the previous one), keep at
most one task in_progress (exactly one while work remains), and mark a
task completed as soon as it is done. Skip it for trivial single-step
tasks.
# The subagent seam + BOTH in-process backends + two model-facing tools, as leaf
# entries after the app (which provides ctx.agents/ctx.tools). spawn (a fresh

View File

@@ -19,14 +19,15 @@ import SessionPersistenceJsonl from '@deepseek-ai/dsh-session-persistence-jsonl'
* file's tests.
*/
export const SYSTEM_PROMPT = 'You are a coding agent. Your only tool is bash; '
+ 'do file operations with cat/grep/heredocs, check [exit code: N] markers, '
export const SYSTEM_PROMPT = 'You are a coding agent. Use bash for file operations '
+ 'with cat/grep/heredocs; check [exit code: N] markers, '
+ 'and report results briefly.'
/** System prompt for the todo_write e2e: nudges the model to plan with the tool. */
export const TODO_SYSTEM_PROMPT = 'You are a coding agent. For multi-step work, '
+ 'use the todo_write tool to track a task list: send the WHOLE list each call, '
+ 'keep exactly one task in_progress, and mark a task completed as soon as it is done.'
+ 'keep at most one task in_progress (exactly one while work remains), and mark '
+ 'a task completed as soon as it is done.'
export async function codingHarness(workdir: string, persistenceRoot?: string): Promise<Context> {
const ctx = new Context()

View File

@@ -1,7 +1,6 @@
import { afterEach, describe, expect, it } from 'vitest'
import type { Context } from 'cordis'
import { AgentId } from '@deepseek-ai/dsh-agent'
import type { TodoItem } from '@deepseek-ai/dsh-session'
import { codingHarness, TODO_SYSTEM_PROMPT, waitForIdle } from './harness.ts'
/**
@@ -42,14 +41,9 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)('todo_write: real model records a
expect(todoEvents.length).toBeGreaterThan(0)
const todos = (todoEvents.at(-1)!).data.todos
expect(todos.length).toBeGreaterThanOrEqual(2)
// Every entry has a non-empty content and a valid status…
const valid: TodoItem['status'][] = ['pending', 'in_progress', 'completed']
for (const todo of todos) {
expect(todo.content.trim().length).toBeGreaterThan(0)
expect(valid).toContain(todo.status)
}
// …and the one-in-progress invariant the tool enforces held.
expect(todos.filter(t => t.status === 'in_progress').length).toBeLessThanOrEqual(1)
expect(todos).toEqual([
{ content: 'inspect the failing test', status: 'in_progress' },
{ content: 'apply the fix', status: 'pending' },
])
}, 120_000)
})