Repository navigation
fix(reflect): retry a forced retrieval step instead of silently skipping it - #5236
Merged
Merged
Conversation
…ing it When a forced step (search_mental_models / search_observations / recall) came back with no tool call after an earlier tool call, reflect went straight to answering and the pending searches never ran. The forced step was also indexed by iteration, so an LLM-error retry moved on to the next step and dropped the failed one. The next forced step is now indexed by how many forced steps actually produced a tool call. An empty reply on a pending forced step is retried once (with a warning); if it is empty again, reflect logs and answers. Fixes #4564
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4564.
Before: reflect runs planned searches in order (mental models → observations → raw memories). If the model returned no tool call on one of them after an earlier tool call, reflect treated it as "done" and answered — the remaining searches never ran, with no log. Separately, an LLM-error retry advanced to the next planned search, dropping the failed one.
After:
Compliant models see no change.
Tests: new
test_empty_reply_on_forced_step_retries_that_step;test_transient_llm_error_is_still_retriednow asserts the retry asks for the same step; two tests whose mocks stopped before all planned searches ran were adjusted.