[BUG] Reasoning plan misses bare READY verdicts, loops forever (refs #6204)
Description
All three planning paths in lib/crewai/src/crewai/utilities/reasoning_handler.py
(_call_with_function x2, _parse_planning_response) detect readiness with
only the literal "READY: I am ready to execute the task.". Models that emit
a bare READY verdict (e.g. Ollama, vLLM) never register as ready, so the
refine loop never exits.
Reproduced on main@738c8e19: the three call sites still use the exact
string match; there is no bare-READY handling.
Predecessor #6204 reported the same bug but was closed as NOT_PLANNED by
the stale bot (no-issue-activity); the bug is still present, so re-opening
per the contributing guide (PRs need a linked open issue).
Proposed fix
Centralize detection in _detect_ready(): strip markdown emphasis, match
\b(NOT\s+)?READY\b case-insensitively, last verdict wins — so a trailing
NOT READY (including NOT **READY**) can never false-positive as ready.
Keeps backward compatibility with the legacy sentence. Regression tests
included. PR incoming.
Willingness to Contribute
Yes, PR incoming.
Note for maintainers: this issue was drafted with AI assistance — please
apply the llm-generated label per CONTRIBUTING.md (I don't have triage
permission to set labels myself).
Good catch on the exact-sentence match. Models served through Ollama or vLLM often shorten the verdict, so a strict string compare never fires and the refine loop never ends. Until a fix lands, a workaround is to cap the plan refinement attempts in your own config and treat hitting the cap as "ready" instead of retrying. Also worth parsing the last verdict with a word-boundary regex, as you propose, so "NOT READY" cannot pass.
Separately, a per-run cost cap would stop this kind of loop from running up tokens while it is being fixed. SteerPlane (open source, http://github.com/vijaym2k6/SteerPlane) has a per-run cost cap and repeated-action loop detection that would catch it.