Hyeonsang Cho 1f1192fd80
fix(agents): keep the todo completion reminder when a model call is retried (#6132)
* fix(agents): keep the todo completion reminder when a model call is retried

TodoMiddleware drained its queued completion reminder inside
wrap_model_call before calling the handler. LLMErrorHandlingMiddleware
sits outside it and retries a failed call by running that wrap again, so
the retry went out with an empty queue while the run had already spent
one of its two reminders on the lost one.

Drain the reminder once per wrap, and when the handler raises put it
back in front of the queue without counting it again, then re-raise. A
run whose reminder state was cleared while the call was in flight does
not get it back.

* docs(changelog): reference #6132 in the todo reminder retry entry

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-10-01 10:37:09 +08:00
..