fix(agent-core): nudge todo reconciliation when a turn ends with unfinished todos - #2373
fix(agent-core): nudge todo reconciliation when a turn ends with unfinished todos#2373airudotsh wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 81f48ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aae8d7f52f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| function turnEndedWithoutTodoWrite(history: readonly ContextMessage[]): boolean { | ||
| const lastAssistant = history.findLast((message) => message.role === 'assistant'); | ||
| if (lastAssistant === undefined) return false; | ||
| if (lastAssistant.toolCalls.length > 0) return false; | ||
| return true; |
There was a problem hiding this comment.
Honor same-turn TodoList writes before nudging
When a normal tool-use turn calls TodoList, receives its tool result, and then sends a final assistant response with no tool calls, this helper still returns true because it only inspects that final assistant message. If the list still has pending/in_progress items and the reminder spacing is met, the next user prompt gets a turn-end reminder immediately after a fresh TodoList update, which defeats the intended “no TodoList write on the way out” noise control. Please check for TodoList writes across the just-finished turn, not just on the terminal assistant step.
Useful? React with 👍 / 👎.
…nder Addresses review feedback: the turn-end check now scans the whole just-finished turn (back to the user prompt that started it) for a TodoList write, so a mid-turn update followed by a closing text reply no longer triggers a spurious reminder. Also adds the required changeset.
Closes #2372
What
Adds a turn-end reconciliation rule to
TodoListReminderInjector: when the previous turn ended (latest assistant step made no tool calls) with unfinished todos and no TodoList write on the way out, the next step gets a reminder immediately, instead of waiting out the 10-turn cadence.Why
The existing reminder only fires after 10 assistant turns since the last TodoList write. The common failure — work finished, turn ended, bookkeeping forgotten — completes in far fewer turns, so the reminder never fires and the todo list stays silently stale.
How
Tests
tsc --noEmitandoxlintclean on the touched files.