From f0be38441a75e0ea4a4404b3f5850f5280e4fd9f Mon Sep 17 00:00:00 2001 From: mjwsolo <19599997+mjwsolo@users.noreply.github.com> Date: Sat, 26 Sep 2026 23:06:18 +0100 Subject: [PATCH] plugin: open todos ride only on continuation nudges, not on the user's own message A leftover todo list from an earlier task in the same session was attached to a new, unrelated request and could pull the model back to the old work. --- src/localcode/ui/plugin/localcode.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/localcode/ui/plugin/localcode.ts b/src/localcode/ui/plugin/localcode.ts index 70cc47e5..f8f1aac7 100644 --- a/src/localcode/ui/plugin/localcode.ts +++ b/src/localcode/ui/plugin/localcode.ts @@ -549,10 +549,15 @@ const LocalcodePlugin: Plugin = async ({ client, directory }) => { turnStartedAt = Date.now() - 1000; plateau = new PlateauTracker(directory); plateauStopped = false; seenSteps.clear(); } - // Open todos travel with the turn (user message or nudge), never in the - // system prompt, so the cached prefix stays stable across todo updates. - const open = renderTodos(todos); - if (open) output.parts.push({ type: "text", text: open, synthetic: true, sessionID: input.sessionID, messageID: input.messageID } as any); + // Open todos travel with the gate's continuation nudges, never in the + // system prompt (the cached prefix) and never on the user's own message: + // a leftover list from an earlier task would pull a new, unrelated + // request back to the old work. The model's own todowrite history is + // still in the conversation. + if (text.startsWith(NUDGE_PREFIX)) { + const open = renderTodos(todos); + if (open) output.parts.push({ type: "text", text: open, synthetic: true, sessionID: input.sessionID, messageID: input.messageID } as any); + } }, "tool.execute.after": async (input, output) => {