From 5f744e4fa6acff4e50bcce1f9ef63ee51d887f9b Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Mon, 29 Jun 2026 11:06:41 +0800 Subject: [PATCH] test(tool-todo): guard that stored content is trimmed Codex confirmation review: the trim-the-stored-content fix had no test that would fail if it regressed (existing assertions use already-trimmed todos). Add a focused test asserting " plan the work " appends content "plan the work". Verified it fails red against the pre-fix code. --- packages/todo/tool-todo/tests/tool-todo.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/todo/tool-todo/tests/tool-todo.spec.ts b/packages/todo/tool-todo/tests/tool-todo.spec.ts index cecfac19ca..8b1c504840 100644 --- a/packages/todo/tool-todo/tests/tool-todo.spec.ts +++ b/packages/todo/tool-todo/tests/tool-todo.spec.ts @@ -75,6 +75,16 @@ describe('dsh-tool-todo', () => { expect(event.data.todos).toEqual(todos) }) + it('stores the trimmed content (the dedupe/length key), not the raw input', async () => { + const ctx = await setup() + const agent = agentWithSession('trim') + const result = await callTodo(ctx, { todos: [{ content: ' plan the work ', status: 'pending' }] }, { agent }) + expect(result.isError).toBe(false) + + const event = agent.session.events.findLast(e => e.type === 'todo/write')! + expect(event.data.todos).toEqual([{ content: 'plan the work', status: 'pending' }]) + }) + it('replaces the list on a second call (last-write-wins on the log)', async () => { const ctx = await setup() const agent = agentWithSession('writer-2')