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 files changed
+36 -29

No files matched your search

+4 -3
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()
+4 -10
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)
})